Closed
Description
These two programs replicate the flakiness which I've seen on bors for the past few months. This flakiness can also be seen on travis.
This test only fails on linux, not on OSX. It also only fails once every 2000 child processes or so.
// foo.rs
use std::io::Process;
use std::str;
fn main() {
static N: int = 10;
let (tx, rx) = channel();
for _ in range(0, N) {
let tx = tx.clone();
spawn(proc() {
let p = Process::output("./bar", []).unwrap();
assert!(p.status.matches_exit_status(101), "{}", p.status);
let out = str::from_utf8(p.output).unwrap();
if out != "" {
println!("{}", out);
}
assert_eq!(str::from_utf8(p.error).unwrap(),
"task '<main>' failed at 'test', bar.rs:2\n");
tx.send(());
});
}
drop(tx);
for _ in range(0, N) { rx.recv() }
}
// bar.rs
fn main() {
fail!("test");
}
It's key that within one instance of foo
many instances of bar
are run in parallel. I'm not quite sure why just yet.
$ for i in {0..1000}; do echo $i; ./foo || break; done
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
task '<unnamed>' failed at 'assertion failed: `(left == right) && (right == left)` (left: `task '<main>' failed at '
test', `, right: `task '<main>' failed at 'test', bar.rs:2
`)', foo.rs:12
task '<main>' failed at 'receiving on a closed channel', /home/alex/rust/src/libstd/comm/mod.rs:507