tests: if server failed to start, print exit code instead of timing out
```
% cargo +stable test --lib ssl::test::test_connect_with_alpn_successful_single_match --features=v102
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Running /Users/nga/devel/left/rust-openssl/target/debug/deps/openssl-a38e12a3527f6932
running 1 test
test ssl::test::test_connect_with_alpn_successful_single_match ... FAILED
failures:
---- ssl::test::test_connect_with_alpn_successful_single_match stdout ----
thread 'ssl::test::test_connect_with_alpn_successful_single_match' panicked at 'server exited: exit code: 1', src/ssl/test.rs:91:24
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
ssl::test::test_connect_with_alpn_successful_single_match
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 159 filtered out
```
This commit is contained in:
parent
38ddad99af
commit
81f7d17822
|
|
@ -82,11 +82,14 @@ impl Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_tcp(args: &[&str]) -> (Server, TcpStream) {
|
fn new_tcp(args: &[&str]) -> (Server, TcpStream) {
|
||||||
let (server, addr) = Server::spawn(args, None);
|
let (mut server, addr) = Server::spawn(args, None);
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
match TcpStream::connect(&addr) {
|
match TcpStream::connect(&addr) {
|
||||||
Ok(s) => return (server, s),
|
Ok(s) => return (server, s),
|
||||||
Err(ref e) if e.kind() == io::ErrorKind::ConnectionRefused => {
|
Err(ref e) if e.kind() == io::ErrorKind::ConnectionRefused => {
|
||||||
|
if let Some(exit_status) = server.p.try_wait().expect("try_wait") {
|
||||||
|
panic!("server exited: {}", exit_status);
|
||||||
|
}
|
||||||
thread::sleep(Duration::from_millis(100));
|
thread::sleep(Duration::from_millis(100));
|
||||||
}
|
}
|
||||||
Err(e) => panic!("wut: {}", e),
|
Err(e) => panic!("wut: {}", e),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue