Skip to content

Commit 183b2dd

Browse files
committed
Ignore entire test modules on emscripten instead of individual tests
1 parent 37abec0 commit 183b2dd

File tree

8 files changed

+10
-132
lines changed

8 files changed

+10
-132
lines changed

src/libstd/net/addr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T {
519519
}
520520
}
521521

522-
#[cfg(test)]
522+
#[cfg(all(test, not(target_os = "emscripten")))]
523523
mod tests {
524524
use net::*;
525525
use net::test::{tsa, sa6, sa4};

src/libstd/net/ip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ impl From<[u8; 16]> for Ipv6Addr {
669669
}
670670

671671
// Tests for this module
672-
#[cfg(test)]
672+
#[cfg(all(test, not(target_os = "emscripten")))]
673673
mod tests {
674674
use net::*;
675675
use net::Ipv6MulticastScope::*;

src/libstd/net/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ mod addr;
3131
mod tcp;
3232
mod udp;
3333
mod parser;
34-
#[cfg(test)] mod test;
34+
#[cfg(all(test, not(target_os = "emscripten")))]
35+
mod test;
3536

3637
/// Possible values which can be passed to the [`shutdown`] method of
3738
/// [`TcpStream`].

src/libstd/net/tcp.rs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ impl fmt::Debug for TcpListener {
428428
}
429429
}
430430

431-
#[cfg(test)]
431+
#[cfg(all(test, not(target_os = "emscripten")))]
432432
mod tests {
433433
use io::ErrorKind;
434434
use io::prelude::*;
@@ -454,7 +454,6 @@ mod tests {
454454
}
455455

456456
#[test]
457-
#[cfg_attr(target_os = "emscripten", ignore)]
458457
fn bind_error() {
459458
match TcpListener::bind("1.1.1.1:9999") {
460459
Ok(..) => panic!(),
@@ -464,7 +463,6 @@ mod tests {
464463
}
465464

466465
#[test]
467-
#[cfg_attr(target_os = "emscripten", ignore)]
468466
fn connect_error() {
469467
match TcpStream::connect("0.0.0.0:1") {
470468
Ok(..) => panic!(),
@@ -477,7 +475,6 @@ mod tests {
477475
}
478476

479477
#[test]
480-
#[cfg_attr(target_os = "emscripten", ignore)]
481478
fn listen_localhost() {
482479
let socket_addr = next_test_ip4();
483480
let listener = t!(TcpListener::bind(&socket_addr));
@@ -495,7 +492,6 @@ mod tests {
495492
}
496493

497494
#[test]
498-
#[cfg_attr(target_os = "emscripten", ignore)]
499495
fn connect_loopback() {
500496
each_ip(&mut |addr| {
501497
let acceptor = t!(TcpListener::bind(&addr));
@@ -517,7 +513,6 @@ mod tests {
517513
}
518514

519515
#[test]
520-
#[cfg_attr(target_os = "emscripten", ignore)]
521516
fn smoke_test() {
522517
each_ip(&mut |addr| {
523518
let acceptor = t!(TcpListener::bind(&addr));
@@ -538,7 +533,6 @@ mod tests {
538533
}
539534

540535
#[test]
541-
#[cfg_attr(target_os = "emscripten", ignore)]
542536
fn read_eof() {
543537
each_ip(&mut |addr| {
544538
let acceptor = t!(TcpListener::bind(&addr));
@@ -558,7 +552,6 @@ mod tests {
558552
}
559553

560554
#[test]
561-
#[cfg_attr(target_os = "emscripten", ignore)]
562555
fn write_close() {
563556
each_ip(&mut |addr| {
564557
let acceptor = t!(TcpListener::bind(&addr));
@@ -585,7 +578,6 @@ mod tests {
585578
}
586579

587580
#[test]
588-
#[cfg_attr(target_os = "emscripten", ignore)]
589581
fn multiple_connect_serial() {
590582
each_ip(&mut |addr| {
591583
let max = 10;
@@ -608,7 +600,6 @@ mod tests {
608600
}
609601

610602
#[test]
611-
#[cfg_attr(target_os = "emscripten", ignore)]
612603
fn multiple_connect_interleaved_greedy_schedule() {
613604
const MAX: usize = 10;
614605
each_ip(&mut |addr| {
@@ -644,7 +635,6 @@ mod tests {
644635
}
645636

646637
#[test]
647-
#[cfg_attr(target_os = "emscripten", ignore)]
648638
fn multiple_connect_interleaved_lazy_schedule() {
649639
const MAX: usize = 10;
650640
each_ip(&mut |addr| {
@@ -678,7 +668,6 @@ mod tests {
678668
}
679669

680670
#[test]
681-
#[cfg_attr(target_os = "emscripten", ignore)]
682671
fn socket_and_peer_name() {
683672
each_ip(&mut |addr| {
684673
let listener = t!(TcpListener::bind(&addr));
@@ -694,7 +683,6 @@ mod tests {
694683
}
695684

696685
#[test]
697-
#[cfg_attr(target_os = "emscripten", ignore)]
698686
fn partial_read() {
699687
each_ip(&mut |addr| {
700688
let (tx, rx) = channel();
@@ -716,7 +704,6 @@ mod tests {
716704
}
717705

718706
#[test]
719-
#[cfg_attr(target_os = "emscripten", ignore)]
720707
fn double_bind() {
721708
each_ip(&mut |addr| {
722709
let _listener = t!(TcpListener::bind(&addr));
@@ -733,7 +720,6 @@ mod tests {
733720
}
734721

735722
#[test]
736-
#[cfg_attr(target_os = "emscripten", ignore)]
737723
fn fast_rebind() {
738724
each_ip(&mut |addr| {
739725
let acceptor = t!(TcpListener::bind(&addr));
@@ -749,7 +735,6 @@ mod tests {
749735
}
750736

751737
#[test]
752-
#[cfg_attr(target_os = "emscripten", ignore)]
753738
fn tcp_clone_smoke() {
754739
each_ip(&mut |addr| {
755740
let acceptor = t!(TcpListener::bind(&addr));
@@ -781,7 +766,6 @@ mod tests {
781766
}
782767

783768
#[test]
784-
#[cfg_attr(target_os = "emscripten", ignore)]
785769
fn tcp_clone_two_read() {
786770
each_ip(&mut |addr| {
787771
let acceptor = t!(TcpListener::bind(&addr));
@@ -816,7 +800,6 @@ mod tests {
816800
}
817801

818802
#[test]
819-
#[cfg_attr(target_os = "emscripten", ignore)]
820803
fn tcp_clone_two_write() {
821804
each_ip(&mut |addr| {
822805
let acceptor = t!(TcpListener::bind(&addr));
@@ -844,7 +827,6 @@ mod tests {
844827
}
845828

846829
#[test]
847-
#[cfg_attr(target_os = "emscripten", ignore)]
848830
fn shutdown_smoke() {
849831
each_ip(&mut |addr| {
850832
let a = t!(TcpListener::bind(&addr));
@@ -865,7 +847,6 @@ mod tests {
865847
}
866848

867849
#[test]
868-
#[cfg_attr(target_os = "emscripten", ignore)]
869850
fn close_readwrite_smoke() {
870851
each_ip(&mut |addr| {
871852
let a = t!(TcpListener::bind(&addr));
@@ -904,7 +885,6 @@ mod tests {
904885
}
905886

906887
#[test]
907-
#[cfg_attr(target_os = "emscripten", ignore)]
908888
fn close_read_wakes_up() {
909889
each_ip(&mut |addr| {
910890
let a = t!(TcpListener::bind(&addr));
@@ -932,7 +912,6 @@ mod tests {
932912
}
933913

934914
#[test]
935-
#[cfg_attr(target_os = "emscripten", ignore)]
936915
fn clone_while_reading() {
937916
each_ip(&mut |addr| {
938917
let accept = t!(TcpListener::bind(&addr));
@@ -973,7 +952,6 @@ mod tests {
973952
}
974953

975954
#[test]
976-
#[cfg_attr(target_os = "emscripten", ignore)]
977955
fn clone_accept_smoke() {
978956
each_ip(&mut |addr| {
979957
let a = t!(TcpListener::bind(&addr));
@@ -992,7 +970,6 @@ mod tests {
992970
}
993971

994972
#[test]
995-
#[cfg_attr(target_os = "emscripten", ignore)]
996973
fn clone_accept_concurrent() {
997974
each_ip(&mut |addr| {
998975
let a = t!(TcpListener::bind(&addr));
@@ -1021,7 +998,6 @@ mod tests {
1021998
}
1022999

10231000
#[test]
1024-
#[cfg_attr(target_os = "emscripten", ignore)]
10251001
fn debug() {
10261002
let name = if cfg!(windows) {"socket"} else {"fd"};
10271003
let socket_addr = next_test_ip4();
@@ -1048,7 +1024,6 @@ mod tests {
10481024
// no longer has rounding errors.
10491025
#[cfg_attr(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"), ignore)]
10501026
#[test]
1051-
#[cfg_attr(target_os = "emscripten", ignore)]
10521027
fn timeouts() {
10531028
let addr = next_test_ip4();
10541029
let listener = t!(TcpListener::bind(&addr));
@@ -1075,7 +1050,6 @@ mod tests {
10751050
}
10761051

10771052
#[test]
1078-
#[cfg_attr(target_os = "emscripten", ignore)]
10791053
fn test_read_timeout() {
10801054
let addr = next_test_ip4();
10811055
let listener = t!(TcpListener::bind(&addr));
@@ -1092,7 +1066,6 @@ mod tests {
10921066
}
10931067

10941068
#[test]
1095-
#[cfg_attr(target_os = "emscripten", ignore)]
10961069
fn test_read_with_timeout() {
10971070
let addr = next_test_ip4();
10981071
let listener = t!(TcpListener::bind(&addr));
@@ -1115,7 +1088,6 @@ mod tests {
11151088
}
11161089

11171090
#[test]
1118-
#[cfg_attr(target_os = "emscripten", ignore)]
11191091
fn nodelay() {
11201092
let addr = next_test_ip4();
11211093
let _listener = t!(TcpListener::bind(&addr));
@@ -1130,7 +1102,6 @@ mod tests {
11301102
}
11311103

11321104
#[test]
1133-
#[cfg_attr(target_os = "emscripten", ignore)]
11341105
fn ttl() {
11351106
let ttl = 100;
11361107

@@ -1147,7 +1118,6 @@ mod tests {
11471118
}
11481119

11491120
#[test]
1150-
#[cfg_attr(target_os = "emscripten", ignore)]
11511121
fn set_nonblocking() {
11521122
let addr = next_test_ip4();
11531123
let listener = t!(TcpListener::bind(&addr));

src/libstd/net/udp.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl fmt::Debug for UdpSocket {
353353
}
354354
}
355355

356-
#[cfg(test)]
356+
#[cfg(all(test, not(target_os = "emscripten")))]
357357
mod tests {
358358
use io::ErrorKind;
359359
use net::*;
@@ -378,7 +378,6 @@ mod tests {
378378
}
379379

380380
#[test]
381-
#[cfg_attr(target_os = "emscripten", ignore)]
382381
fn bind_error() {
383382
match UdpSocket::bind("1.1.1.1:9999") {
384383
Ok(..) => panic!(),
@@ -389,7 +388,6 @@ mod tests {
389388
}
390389

391390
#[test]
392-
#[cfg_attr(target_os = "emscripten", ignore)]
393391
fn socket_smoke_test_ip4() {
394392
each_ip(&mut |server_ip, client_ip| {
395393
let (tx1, rx1) = channel();
@@ -414,7 +412,6 @@ mod tests {
414412
}
415413

416414
#[test]
417-
#[cfg_attr(target_os = "emscripten", ignore)]
418415
fn socket_name_ip4() {
419416
each_ip(&mut |addr, _| {
420417
let server = t!(UdpSocket::bind(&addr));
@@ -423,7 +420,6 @@ mod tests {
423420
}
424421

425422
#[test]
426-
#[cfg_attr(target_os = "emscripten", ignore)]
427423
fn udp_clone_smoke() {
428424
each_ip(&mut |addr1, addr2| {
429425
let sock1 = t!(UdpSocket::bind(&addr1));
@@ -453,7 +449,6 @@ mod tests {
453449
}
454450

455451
#[test]
456-
#[cfg_attr(target_os = "emscripten", ignore)]
457452
fn udp_clone_two_read() {
458453
each_ip(&mut |addr1, addr2| {
459454
let sock1 = t!(UdpSocket::bind(&addr1));
@@ -486,7 +481,6 @@ mod tests {
486481
}
487482

488483
#[test]
489-
#[cfg_attr(target_os = "emscripten", ignore)]
490484
fn udp_clone_two_write() {
491485
each_ip(&mut |addr1, addr2| {
492486
let sock1 = t!(UdpSocket::bind(&addr1));
@@ -525,7 +519,6 @@ mod tests {
525519
}
526520

527521
#[test]
528-
#[cfg_attr(target_os = "emscripten", ignore)]
529522
fn debug() {
530523
let name = if cfg!(windows) {"socket"} else {"fd"};
531524
let socket_addr = next_test_ip4();
@@ -541,7 +534,6 @@ mod tests {
541534
// no longer has rounding errors.
542535
#[cfg_attr(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"), ignore)]
543536
#[test]
544-
#[cfg_attr(target_os = "emscripten", ignore)]
545537
fn timeouts() {
546538
let addr = next_test_ip4();
547539

@@ -566,7 +558,6 @@ mod tests {
566558
}
567559

568560
#[test]
569-
#[cfg_attr(target_os = "emscripten", ignore)]
570561
fn test_read_timeout() {
571562
let addr = next_test_ip4();
572563

@@ -582,7 +573,6 @@ mod tests {
582573
}
583574

584575
#[test]
585-
#[cfg_attr(target_os = "emscripten", ignore)]
586576
fn test_read_with_timeout() {
587577
let addr = next_test_ip4();
588578

@@ -602,7 +592,6 @@ mod tests {
602592
}
603593

604594
#[test]
605-
#[cfg_attr(target_os = "emscripten", ignore)]
606595
fn connect_send_recv() {
607596
let addr = next_test_ip4();
608597

@@ -617,7 +606,6 @@ mod tests {
617606
}
618607

619608
#[test]
620-
#[cfg_attr(target_os = "emscripten", ignore)]
621609
fn ttl() {
622610
let ttl = 100;
623611

@@ -630,7 +618,6 @@ mod tests {
630618
}
631619

632620
#[test]
633-
#[cfg_attr(target_os = "emscripten", ignore)]
634621
fn set_nonblocking() {
635622
let addr = next_test_ip4();
636623

0 commit comments

Comments
 (0)