Skip to content

Commit a11c032

Browse files
committed
core::rt: Fix a broken uvio test
1 parent e564fc7 commit a11c032

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/libcore/rt/uvio.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,22 +434,39 @@ fn test_read_and_block() {
434434
}
435435
}
436436

437-
#[test] #[ignore(reason = "needs server")]
437+
#[test]
438438
fn test_read_read_read() {
439439
do run_in_newsched_task {
440440
let addr = Ipv4(127, 0, 0, 1, next_test_port());
441+
static MAX: uint = 5000000;
442+
443+
do spawn_immediately {
444+
unsafe {
445+
let io = local_sched::unsafe_borrow_io();
446+
let mut listener = io.bind(addr).unwrap();
447+
let mut stream = listener.listen().unwrap();
448+
let mut buf = [0, .. 2048];
449+
let mut total_bytes_written = 0;
450+
while total_bytes_written < MAX {
451+
stream.write(buf);
452+
total_bytes_written += buf.len();
453+
}
454+
stream.close();
455+
listener.close();
456+
}
457+
}
441458

442459
do spawn_immediately {
443460
let io = unsafe { local_sched::unsafe_borrow_io() };
444461
let mut stream = io.connect(addr).unwrap();
445462
let mut buf = [0, .. 2048];
446463
let mut total_bytes_read = 0;
447-
while total_bytes_read < 500000000 {
464+
while total_bytes_read < MAX {
448465
let nread = stream.read(buf).unwrap();
449466
rtdebug!("read %u bytes", nread as uint);
450467
total_bytes_read += nread;
451468
}
452-
rtdebug_!("read %u bytes total", total_bytes_read as uint);
469+
rtdebug!("read %u bytes total", total_bytes_read as uint);
453470
stream.close();
454471
}
455472
}

0 commit comments

Comments
 (0)