diff options
Diffstat (limited to 'regress/unittests/test_helper')
-rw-r--r-- | regress/unittests/test_helper/test_helper.c | 12 | ||||
-rw-r--r-- | regress/unittests/test_helper/test_helper.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c index 127e76c2b..9014ce8e4 100644 --- a/regress/unittests/test_helper/test_helper.c +++ b/regress/unittests/test_helper/test_helper.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> |
24 | #include <sys/uio.h> | 24 | #include <sys/uio.h> |
25 | 25 | ||
26 | #include <stdarg.h> | ||
26 | #include <fcntl.h> | 27 | #include <fcntl.h> |
27 | #include <stdio.h> | 28 | #include <stdio.h> |
28 | #ifdef HAVE_STDINT_H | 29 | #ifdef HAVE_STDINT_H |
@@ -34,8 +35,10 @@ | |||
34 | #include <unistd.h> | 35 | #include <unistd.h> |
35 | #include <signal.h> | 36 | #include <signal.h> |
36 | 37 | ||
38 | #ifdef WITH_OPENSSL | ||
37 | #include <openssl/bn.h> | 39 | #include <openssl/bn.h> |
38 | #include <openssl/err.h> | 40 | #include <openssl/err.h> |
41 | #endif | ||
39 | 42 | ||
40 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS) | 43 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS) |
41 | # include <vis.h> | 44 | # include <vis.h> |
@@ -126,7 +129,9 @@ main(int argc, char **argv) | |||
126 | int ch; | 129 | int ch; |
127 | 130 | ||
128 | seed_rng(); | 131 | seed_rng(); |
132 | #ifdef WITH_OPENSSL | ||
129 | ERR_load_CRYPTO_strings(); | 133 | ERR_load_CRYPTO_strings(); |
134 | #endif | ||
130 | 135 | ||
131 | /* Handle systems without __progname */ | 136 | /* Handle systems without __progname */ |
132 | if (__progname == NULL) { | 137 | if (__progname == NULL) { |
@@ -287,6 +292,7 @@ test_subtest_info(const char *fmt, ...) | |||
287 | void | 292 | void |
288 | ssl_err_check(const char *file, int line) | 293 | ssl_err_check(const char *file, int line) |
289 | { | 294 | { |
295 | #ifdef WITH_OPENSSL | ||
290 | long openssl_error = ERR_get_error(); | 296 | long openssl_error = ERR_get_error(); |
291 | 297 | ||
292 | if (openssl_error == 0) | 298 | if (openssl_error == 0) |
@@ -294,6 +300,10 @@ ssl_err_check(const char *file, int line) | |||
294 | 300 | ||
295 | fprintf(stderr, "\n%s:%d: uncaught OpenSSL error: %s", | 301 | fprintf(stderr, "\n%s:%d: uncaught OpenSSL error: %s", |
296 | file, line, ERR_error_string(openssl_error, NULL)); | 302 | file, line, ERR_error_string(openssl_error, NULL)); |
303 | #else /* WITH_OPENSSL */ | ||
304 | fprintf(stderr, "\n%s:%d: uncaught OpenSSL error ", | ||
305 | file, line); | ||
306 | #endif /* WITH_OPENSSL */ | ||
297 | abort(); | 307 | abort(); |
298 | } | 308 | } |
299 | 309 | ||
@@ -338,6 +348,7 @@ test_header(const char *file, int line, const char *a1, const char *a2, | |||
338 | a2 != NULL ? ", " : "", a2 != NULL ? a2 : ""); | 348 | a2 != NULL ? ", " : "", a2 != NULL ? a2 : ""); |
339 | } | 349 | } |
340 | 350 | ||
351 | #ifdef WITH_OPENSSL | ||
341 | void | 352 | void |
342 | assert_bignum(const char *file, int line, const char *a1, const char *a2, | 353 | assert_bignum(const char *file, int line, const char *a1, const char *a2, |
343 | const BIGNUM *aa1, const BIGNUM *aa2, enum test_predicate pred) | 354 | const BIGNUM *aa1, const BIGNUM *aa2, enum test_predicate pred) |
@@ -350,6 +361,7 @@ assert_bignum(const char *file, int line, const char *a1, const char *a2, | |||
350 | fprintf(stderr, "%12s = 0x%s\n", a2, BN_bn2hex(aa2)); | 361 | fprintf(stderr, "%12s = 0x%s\n", a2, BN_bn2hex(aa2)); |
351 | test_die(); | 362 | test_die(); |
352 | } | 363 | } |
364 | #endif | ||
353 | 365 | ||
354 | void | 366 | void |
355 | assert_string(const char *file, int line, const char *a1, const char *a2, | 367 | assert_string(const char *file, int line, const char *a1, const char *a2, |
diff --git a/regress/unittests/test_helper/test_helper.h b/regress/unittests/test_helper/test_helper.h index 1f893c8dd..66302201c 100644 --- a/regress/unittests/test_helper/test_helper.h +++ b/regress/unittests/test_helper/test_helper.h | |||
@@ -27,8 +27,10 @@ | |||
27 | # include <stdint.h> | 27 | # include <stdint.h> |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #ifdef WITH_OPENSSL | ||
30 | #include <openssl/bn.h> | 31 | #include <openssl/bn.h> |
31 | #include <openssl/err.h> | 32 | #include <openssl/err.h> |
33 | #endif | ||
32 | 34 | ||
33 | enum test_predicate { | 35 | enum test_predicate { |
34 | TEST_EQ, TEST_NE, TEST_LT, TEST_LE, TEST_GT, TEST_GE | 36 | TEST_EQ, TEST_NE, TEST_LT, TEST_LE, TEST_GT, TEST_GE |
@@ -50,9 +52,11 @@ int test_is_slow(void); | |||
50 | void test_subtest_info(const char *fmt, ...) | 52 | void test_subtest_info(const char *fmt, ...) |
51 | __attribute__((format(printf, 1, 2))); | 53 | __attribute__((format(printf, 1, 2))); |
52 | void ssl_err_check(const char *file, int line); | 54 | void ssl_err_check(const char *file, int line); |
55 | #ifdef WITH_OPENSSL | ||
53 | void assert_bignum(const char *file, int line, | 56 | void assert_bignum(const char *file, int line, |
54 | const char *a1, const char *a2, | 57 | const char *a1, const char *a2, |
55 | const BIGNUM *aa1, const BIGNUM *aa2, enum test_predicate pred); | 58 | const BIGNUM *aa1, const BIGNUM *aa2, enum test_predicate pred); |
59 | #endif | ||
56 | void assert_string(const char *file, int line, | 60 | void assert_string(const char *file, int line, |
57 | const char *a1, const char *a2, | 61 | const char *a1, const char *a2, |
58 | const char *aa1, const char *aa2, enum test_predicate pred); | 62 | const char *aa1, const char *aa2, enum test_predicate pred); |