Skip to content

Commit

Permalink
Run integration tests with valgrind
Browse files Browse the repository at this point in the history
Funnel all test program running through a shell script
that optionally runs it under $VALGRIND.
  • Loading branch information
ctz committed Apr 4, 2024
1 parent bffe031 commit b5bf44d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/libssl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y valgrind
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y openssl libssl3 libssl-dev lld
- run: export VALGRIND="valgrind -q"
- run: make test
- run: VALGRIND="valgrind -q" make test integration

docs:
name: Check for documentation errors
Expand Down
2 changes: 2 additions & 0 deletions rustls-libssl/tests/maybe-valgrind.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec $VALGRIND "$@"
28 changes: 16 additions & 12 deletions rustls-libssl/tests/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,33 @@ fn client() {

wait_for_port(4443);

let openssl_insecure_output = Command::new("target/client")
let openssl_insecure_output = Command::new("tests/maybe-valgrind.sh")
.env("LD_LIBRARY_PATH", "")
.args(&["localhost", "4443", "insecure"])
.args(&["target/client", "localhost", "4443", "insecure"])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

let rustls_insecure_output = Command::new("target/client")
.args(&["localhost", "4443", "insecure"])
let rustls_insecure_output = Command::new("tests/maybe-valgrind.sh")
.args(&["target/client", "localhost", "4443", "insecure"])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

assert_eq!(openssl_insecure_output, rustls_insecure_output);

let openssl_secure_output = Command::new("target/client")
let openssl_secure_output = Command::new("tests/maybe-valgrind.sh")
.env("LD_LIBRARY_PATH", "")
.args(&["localhost", "4443", "test-ca/rsa/ca.cert"])
.args(&["target/client", "localhost", "4443", "test-ca/rsa/ca.cert"])
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

let rustls_secure_output = Command::new("target/client")
.args(&["localhost", "4443", "test-ca/rsa/ca.cert"])
let rustls_secure_output = Command::new("tests/maybe-valgrind.sh")
.args(&["target/client", "localhost", "4443", "test-ca/rsa/ca.cert"])
.stdout(Stdio::piped())
.output()
.map(print_output)
Expand All @@ -91,14 +91,16 @@ fn client() {
#[test]
#[ignore]
fn constants() {
let openssl_output = Command::new("target/constants")
let openssl_output = Command::new("tests/maybe-valgrind.sh")
.args(&["target/constants"])
.env("LD_LIBRARY_PATH", "")
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

let rustls_output = Command::new("target/constants")
let rustls_output = Command::new("tests/maybe-valgrind.sh")
.args(&["target/constants"])
.stdout(Stdio::piped())
.output()
.map(print_output)
Expand All @@ -110,14 +112,16 @@ fn constants() {
#[test]
#[ignore]
fn ciphers() {
let openssl_output = Command::new("target/ciphers")
let openssl_output = Command::new("tests/maybe-valgrind.sh")
.args(&["target/ciphers"])
.env("LD_LIBRARY_PATH", "")
.stdout(Stdio::piped())
.output()
.map(print_output)
.unwrap();

let rustls_output = Command::new("target/ciphers")
let rustls_output = Command::new("tests/maybe-valgrind.sh")
.args(&["target/ciphers"])
.stdout(Stdio::piped())
.output()
.map(print_output)
Expand Down

0 comments on commit b5bf44d

Please sign in to comment.