From 7e30cb9c4a494c55fad0451467d9fc1c39d83a03 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 11 Feb 2015 04:55:36 +0000 Subject: [PATCH] Only run SSL nsock tests if configured with OpenSSL --- nsock/tests/run_tests.sh | 2 +- nsock/tests/tests_main.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/nsock/tests/run_tests.sh b/nsock/tests/run_tests.sh index f2b45f68d..d8c468dec 100755 --- a/nsock/tests/run_tests.sh +++ b/nsock/tests/run_tests.sh @@ -76,7 +76,7 @@ cleanup_all() { main() { setup_echo_udp $PORT_UDP setup_echo_tcp $PORT_TCP - setup_echo_tcpssl $PORT_TCPSSL + $EXEC_MAIN --ssl && setup_echo_tcpssl $PORT_TCPSSL $TRACER $EXEC_MAIN diff --git a/nsock/tests/tests_main.c b/nsock/tests/tests_main.c index 29b963747..bfa6b93d9 100644 --- a/nsock/tests/tests_main.c +++ b/nsock/tests/tests_main.c @@ -5,6 +5,7 @@ #include "test-common.h" +#include "string.h" #ifndef WIN32 @@ -36,7 +37,9 @@ extern const struct test_case TestGHHeaps; extern const struct test_case TestHeapOrdering; extern const struct test_case TestCancelTCP; extern const struct test_case TestCancelUDP; +#ifdef HAVE_OPENSSL extern const struct test_case TestCancelSSL; +#endif static const struct test_case *TestCases[] = { @@ -58,7 +61,9 @@ static const struct test_case *TestCases[] = { /* ---- cancel.c */ &TestCancelTCP, &TestCancelUDP, +#ifdef HAVE_OPENSSL &TestCancelSSL, +#endif NULL }; @@ -94,6 +99,15 @@ static int win_init(void) { int main(int ac, char **av) { int rc, i; + /* simple "do we have ssl" check for run_tests.sh */ + if (ac == 2 && !strncmp(av[1], "--ssl", 5)) { +#ifdef HAVE_SSL + return 0; +#else + return 1; +#endif + } + #ifdef WIN32 win_init(); #endif