From 5859eba4c69dfd20accd812de78129a94014768a Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Thu, 4 Apr 2024 11:33:20 -0400 Subject: [PATCH] test: add client -> example.com test This commit adds a unit test that uses the client test binary to connect to https://example.com, validating the presented certificate chain using the system default CA bundle. We do this with `NO_ECHO=1` to avoid trying to write a non-HTTP request and asserting on an echoed response. --- rustls-libssl/tests/runner.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rustls-libssl/tests/runner.rs b/rustls-libssl/tests/runner.rs index 24168eb..e295859 100644 --- a/rustls-libssl/tests/runner.rs +++ b/rustls-libssl/tests/runner.rs @@ -88,6 +88,29 @@ fn client() { assert_eq!(openssl_secure_output, rustls_secure_output); } +#[test] +#[ignore] +fn client_real_world() { + let openssl_output = Command::new("tests/maybe-valgrind.sh") + .env("LD_LIBRARY_PATH", "") + .env("NO_ECHO", "1") + .args(&["target/client", "example.com", "443", "default"]) + .stdout(Stdio::piped()) + .output() + .map(print_output) + .unwrap(); + + let rustls_output = Command::new("tests/maybe-valgrind.sh") + .env("NO_ECHO", "1") + .args(&["target/client", "example.com", "443", "default"]) + .stdout(Stdio::piped()) + .output() + .map(print_output) + .unwrap(); + + assert_eq!(openssl_output, rustls_output); +} + #[test] #[ignore] fn constants() {