From: tobhe Date: Mon, 29 Nov 2021 15:56:33 +0000 (+0000) Subject: Avoid including sys/param.h. Make a local copy of MINIMUM() in test_helper.h X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6d91411b6895606fc262d10a0c65b00dac216d94;p=openbsd Avoid including sys/param.h. Make a local copy of MINIMUM() in test_helper.h instead, like we did elsewhere. ok bluhm@ --- 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 -#include #include #include 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 -#include #include +#include #include #include #include @@ -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 #include +#define MINIMUM(a,b) (((a)<(b))?(a):(b)) + enum test_predicate { TEST_EQ, TEST_NE, TEST_LT, TEST_LE, TEST_GT, TEST_GE };