diff options
author | Tobias Heider <tobhe@cvs.openbsd.org> | 2021-11-29 15:56:34 +0000 |
---|---|---|
committer | Tobias Heider <tobhe@cvs.openbsd.org> | 2021-11-29 15:56:34 +0000 |
commit | 80bb7251c0ade6ffb7ac7e190336a1d2966c3156 (patch) | |
tree | 548dd2e72cd16b76761fd2c3db3cb21303c352c6 /regress/sbin | |
parent | cc2d4a9249818b809744118bc67c073c353a650b (diff) |
Avoid including sys/param.h. Make a local copy of MINIMUM() in test_helper.h
instead, like we did elsewhere.
ok bluhm@
Diffstat (limited to 'regress/sbin')
-rw-r--r-- | regress/sbin/iked/parser/common.c | 3 | ||||
-rw-r--r-- | regress/sbin/iked/test_helper/test_helper.c | 10 | ||||
-rw-r--r-- | regress/sbin/iked/test_helper/test_helper.h | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/regress/sbin/iked/parser/common.c b/regress/sbin/iked/parser/common.c index f2f01eabd13..8917b7d04bf 100644 --- a/regress/sbin/iked/parser/common.c +++ b/regress/sbin/iked/parser/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.10 2021/02/04 20:45:13 tobhe Exp $ */ +/* $OpenBSD: common.c,v 1.11 2021/11/29 15:56:33 tobhe Exp $ */ /* * A bunch of stub functions so we can compile and link ikev2_pld.c * in a standalone program for testing purposes. @@ -7,7 +7,6 @@ */ #include <sys/socket.h> -#include <sys/param.h> #include <sys/time.h> #include <sys/uio.h> diff --git a/regress/sbin/iked/test_helper/test_helper.c b/regress/sbin/iked/test_helper/test_helper.c index cc642cae9da..26ff4a629c9 100644 --- a/regress/sbin/iked/test_helper/test_helper.c +++ b/regress/sbin/iked/test_helper/test_helper.c @@ -18,9 +18,9 @@ /* Utility functions/framework for regress tests */ #include <sys/types.h> -#include <sys/param.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> @@ -269,8 +269,10 @@ assert_mem(const char *file, int line, const char *a1, const char *a2, TEST_CHECK_INT(r, pred); test_header(file, line, a1, a2, "STRING", pred); - fprintf(stderr, "%12s = %s (len %zu)\n", a1, tohex(aa1, MIN(l, 256)), l); - fprintf(stderr, "%12s = %s (len %zu)\n", a2, tohex(aa2, MIN(l, 256)), l); + fprintf(stderr, "%12s = %s (len %zu)\n", a1, + tohex(aa1, MINIMUM(l, 256)), l); + fprintf(stderr, "%12s = %s (len %zu)\n", a2, + tohex(aa2, MINIMUM(l, 256)), l); test_die(); } @@ -301,7 +303,7 @@ assert_mem_filled(const char *file, int line, const char *a1, TEST_CHECK_INT(r, pred); test_header(file, line, a1, NULL, "MEM_ZERO", pred); fprintf(stderr, "%20s = %s%s (len %zu)\n", a1, - tohex(aa1, MIN(l, 20)), l > 20 ? "..." : "", l); + tohex(aa1, MINIMUM(l, 20)), l > 20 ? "..." : "", l); snprintf(tmp, sizeof(tmp), "(%s)[%zu]", a1, where); fprintf(stderr, "%20s = 0x%02x (expected 0x%02x)\n", tmp, ((u_char *)aa1)[where], v); diff --git a/regress/sbin/iked/test_helper/test_helper.h b/regress/sbin/iked/test_helper/test_helper.h index f6fd518c39a..6e81aa0ea06 100644 --- a/regress/sbin/iked/test_helper/test_helper.h +++ b/regress/sbin/iked/test_helper/test_helper.h @@ -26,6 +26,8 @@ #include <openssl/bn.h> #include <openssl/err.h> +#define MINIMUM(a,b) (((a)<(b))?(a):(b)) + enum test_predicate { TEST_EQ, TEST_NE, TEST_LT, TEST_LE, TEST_GT, TEST_GE }; |