Commit 81f7d178 authored by Stepan Koltsov's avatar Stepan Koltsov
Browse files

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
```
parent 38ddad99
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -82,11 +82,14 @@ impl Server {
    }

    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 {
            match TcpStream::connect(&addr) {
                Ok(s) => return (server, s),
                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));
                }
                Err(e) => panic!("wut: {}", e),