Skip to content

Commit b5bf44d

Browse files
committed
Run integration tests with valgrind
Funnel all test program running through a shell script that optionally runs it under $VALGRIND.
1 parent bffe031 commit b5bf44d

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.github/workflows/libssl.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ jobs:
5555
run: sudo apt-get update && sudo apt-get install -y valgrind
5656
- name: Install build dependencies
5757
run: sudo apt-get update && sudo apt-get install -y openssl libssl3 libssl-dev lld
58-
- run: export VALGRIND="valgrind -q"
59-
- run: make test
58+
- run: VALGRIND="valgrind -q" make test integration
6059

6160
docs:
6261
name: Check for documentation errors

rustls-libssl/tests/maybe-valgrind.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec $VALGRIND "$@"

rustls-libssl/tests/runner.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,33 +53,33 @@ fn client() {
5353

5454
wait_for_port(4443);
5555

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

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

7171
assert_eq!(openssl_insecure_output, rustls_insecure_output);
7272

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

81-
let rustls_secure_output = Command::new("target/client")
82-
.args(&["localhost", "4443", "test-ca/rsa/ca.cert"])
81+
let rustls_secure_output = Command::new("tests/maybe-valgrind.sh")
82+
.args(&["target/client", "localhost", "4443", "test-ca/rsa/ca.cert"])
8383
.stdout(Stdio::piped())
8484
.output()
8585
.map(print_output)
@@ -91,14 +91,16 @@ fn client() {
9191
#[test]
9292
#[ignore]
9393
fn constants() {
94-
let openssl_output = Command::new("target/constants")
94+
let openssl_output = Command::new("tests/maybe-valgrind.sh")
95+
.args(&["target/constants"])
9596
.env("LD_LIBRARY_PATH", "")
9697
.stdout(Stdio::piped())
9798
.output()
9899
.map(print_output)
99100
.unwrap();
100101

101-
let rustls_output = Command::new("target/constants")
102+
let rustls_output = Command::new("tests/maybe-valgrind.sh")
103+
.args(&["target/constants"])
102104
.stdout(Stdio::piped())
103105
.output()
104106
.map(print_output)
@@ -110,14 +112,16 @@ fn constants() {
110112
#[test]
111113
#[ignore]
112114
fn ciphers() {
113-
let openssl_output = Command::new("target/ciphers")
115+
let openssl_output = Command::new("tests/maybe-valgrind.sh")
116+
.args(&["target/ciphers"])
114117
.env("LD_LIBRARY_PATH", "")
115118
.stdout(Stdio::piped())
116119
.output()
117120
.map(print_output)
118121
.unwrap();
119122

120-
let rustls_output = Command::new("target/ciphers")
123+
let rustls_output = Command::new("tests/maybe-valgrind.sh")
124+
.args(&["target/ciphers"])
121125
.stdout(Stdio::piped())
122126
.output()
123127
.map(print_output)

0 commit comments

Comments
 (0)