Skip to content

Commit bcd3742

Browse files
committed
Exit 77 for skipped Python tests so automake reports SKIP
Add test_main() helper in wolfclu_test.py that runs unittest with exit=False and translates the result: all-skipped/no-tests -> exit 77 (automake SKIP), failures -> exit 1, otherwise -> exit 0.
1 parent e7e1d5d commit bcd3742

26 files changed

Lines changed: 71 additions & 50 deletions

tests/base64/base64-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# Allow importing the shared helper when run standalone or via the test runner
1111
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
12-
from wolfclu_test import WOLFSSL_BIN, CERTS_DIR, run_wolfssl
12+
from wolfclu_test import WOLFSSL_BIN, CERTS_DIR, run_wolfssl, test_main
1313

1414

1515
class Base64Test(unittest.TestCase):
@@ -105,4 +105,4 @@ def test_stdin_input(self):
105105

106106

107107
if __name__ == "__main__":
108-
unittest.main()
108+
test_main()

tests/bench/bench-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import unittest
77

88
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
9-
from wolfclu_test import run_wolfssl
9+
from wolfclu_test import run_wolfssl, test_main
1010

1111

1212
class BenchTest(unittest.TestCase):
@@ -25,4 +25,4 @@ def test_bench_md5(self):
2525

2626

2727
if __name__ == "__main__":
28-
unittest.main()
28+
test_main()

tests/client/client-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import unittest
88

99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
10-
from wolfclu_test import WOLFSSL_BIN, CERTS_DIR, run_wolfssl
10+
from wolfclu_test import WOLFSSL_BIN, CERTS_DIR, run_wolfssl, test_main
1111

1212

1313
class ClientTest(unittest.TestCase):
@@ -58,4 +58,4 @@ def test_s_client_x509(self):
5858

5959

6060
if __name__ == "__main__":
61-
unittest.main()
61+
test_main()

tests/dgst/dgst-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import unittest
88

99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
10-
from wolfclu_test import CERTS_DIR, run_wolfssl
10+
from wolfclu_test import CERTS_DIR, run_wolfssl, test_main
1111

1212
DGST_DIR = os.path.join(".", "tests", "dgst")
1313

@@ -213,4 +213,4 @@ def test_ecc_sign_verify_roundtrip(self):
213213

214214

215215
if __name__ == "__main__":
216-
unittest.main()
216+
test_main()

tests/dh/dh-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import unittest
77

88
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
9-
from wolfclu_test import CERTS_DIR, run_wolfssl
9+
from wolfclu_test import CERTS_DIR, run_wolfssl, test_main
1010

1111

1212
class DhParamTest(unittest.TestCase):
@@ -108,4 +108,4 @@ def test_bad_input_fails(self):
108108

109109

110110
if __name__ == "__main__":
111-
unittest.main()
111+
test_main()

tests/dsa/dsa-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import unittest
77

88
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
9-
from wolfclu_test import CERTS_DIR, run_wolfssl
9+
from wolfclu_test import CERTS_DIR, run_wolfssl, test_main
1010

1111

1212
class DsaParamTest(unittest.TestCase):
@@ -95,4 +95,4 @@ def test_bad_input_fails(self):
9595

9696

9797
if __name__ == "__main__":
98-
unittest.main()
98+
test_main()

tests/encrypt/enc-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import unittest
1010

1111
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
12-
from wolfclu_test import CERTS_DIR, WOLFSSL_BIN, run_wolfssl
12+
from wolfclu_test import CERTS_DIR, WOLFSSL_BIN, run_wolfssl, test_main
1313

1414

1515
def run_enc(*args, password=""):
@@ -276,4 +276,4 @@ def test_legacy_aes_cbc_128_roundtrip(self):
276276

277277

278278
if __name__ == "__main__":
279-
unittest.main()
279+
test_main()

tests/genkey_sign_ver/genkey-sign-ver-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import unittest
77

88
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
9-
from wolfclu_test import WOLFSSL_BIN, run_wolfssl
9+
from wolfclu_test import WOLFSSL_BIN, run_wolfssl, test_main
1010

1111
# Files that tests may create; cleaned up by tearDownClass
1212
_TEMP_FILES = []
@@ -250,4 +250,4 @@ def test_xmss_raw(self):
250250

251251

252252
if __name__ == "__main__":
253-
unittest.main()
253+
test_main()

tests/hash/hash-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import unittest
77

88
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
9-
from wolfclu_test import CERTS_DIR, run_wolfssl
9+
from wolfclu_test import CERTS_DIR, run_wolfssl, test_main
1010

1111
HASH_DIR = os.path.join(".", "tests", "hash")
1212
CERT_FILE = os.path.join(CERTS_DIR, "ca-cert.pem")
@@ -89,4 +89,4 @@ def test_sha512(self):
8989

9090

9191
if __name__ == "__main__":
92-
unittest.main()
92+
test_main()

tests/ocsp-scgi/ocsp-scgi-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import unittest
2222

2323
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
24-
from wolfclu_test import WOLFSSL_BIN, CERTS_DIR
24+
from wolfclu_test import WOLFSSL_BIN, CERTS_DIR, test_main
2525

2626
HAS_OPENSSL = shutil.which("openssl") is not None
2727

@@ -288,4 +288,4 @@ def test_08_graceful_shutdown(self):
288288

289289

290290
if __name__ == "__main__":
291-
unittest.main()
291+
test_main()

0 commit comments

Comments
 (0)