Commit d1825c7a authored by Cody P Schafer's avatar Cody P Schafer
Browse files

openssl/ssl/context: test that we are refcounting correctly

Not a perfect test, on failure it _might_ exit with this output:

Process didn't exit successfully:
`/home/cody/g/rust-openssl/openssl/target/debug/openssl-8e712036e3aac4fe`
(signal: 11)

But unclear if we can do any better.
parent dacde211
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1045,3 +1045,16 @@ fn flush_panic() {
    let mut stream = SslStream::connect(&ctx, stream).unwrap();
    let _ = stream.flush();
}

#[test]
fn refcount_ssl_context() {
    let ssl = {
        let ctx = SslContext::new(SslMethod::Sslv23).unwrap();
        ssl::Ssl::new(&ctx).unwrap()
    };

    {
        let new_ctx_a = SslContext::new(SslMethod::Sslv23).unwrap();
        let _new_ctx_b = ssl.set_ssl_context(&new_ctx_a);
    }
}