From f7bdab0591753dd972404163d6a1f035c00487c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 14 Apr 2023 06:20:48 +0200 Subject: [PATCH] Revert "Kill unit tests that run more than 1200 seconds" This reverts commit 6cdeb5b046a67f6cea36f853be1e3894fd62e136 which added wrapper around all the unit tests that would run the unit test in the forked process. This makes any debugging of the unit tests too hard. Futures attempts to fix #3980 (closed) should add a custom automake test harness (log driver) that would kill the unit test after configured timeout. --- lib/isc/include/isc/util.h | 6 ----- tests/include/tests/isc.h | 53 ++++++++++---------------------------- 2 files changed, 14 insertions(+), 45 deletions(-) diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 81a793d87d..922661beaa 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -59,12 +59,6 @@ */ #define UNUSED(x) (void)(x) -#if __has_c_attribute(maybe_unused) -#define ISC_ATTR_UNUSED [[maybe_unused]] -#else -#define ISC_ATTR_UNUSED __attribute__((__unused__)) -#endif - #if __GNUC__ >= 8 && !defined(__clang__) #define ISC_NONSTRING __attribute__((nonstring)) #else /* if __GNUC__ >= 8 && !defined(__clang__) */ diff --git a/tests/include/tests/isc.h b/tests/include/tests/isc.h index 9165a4208a..6131c20185 100644 --- a/tests/include/tests/isc.h +++ b/tests/include/tests/isc.h @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -36,9 +35,6 @@ #include "task_p.h" #include "timer_p.h" -#include -#include - #define CHECK(r) \ do { \ result = (r); \ @@ -106,39 +102,18 @@ teardown_managers(void **state); #define ISC_TEST_MAIN ISC_TEST_MAIN_CUSTOM(NULL, NULL) -#define ISC_TEST_MAIN_CUSTOM(setup, teardown) \ - static int __child = 0; \ - static void __alarm(int sig ISC_ATTR_UNUSED) { \ - kill(__child, SIGABRT); \ - } \ - int main(void) { \ - int r, status; \ - \ - switch ((__child = fork())) { \ - case 0: \ - break; \ - case -1: \ - exit(1); \ - default: \ - signal(SIGALRM, __alarm); \ - alarm(1200); \ - if ((r = waitpid(__child, &status, 0)) == __child) { \ - /* Pass the exit status to the caller. */ \ - if (WIFEXITED(status)) { \ - exit(WEXITSTATUS(status)); \ - } \ - } \ - exit(1); \ - } \ - \ - signal(SIGPIPE, SIG_IGN); \ - \ - isc_mem_debugging |= ISC_MEM_DEBUGRECORD; \ - isc_mem_create(&mctx); \ - \ - r = cmocka_run_group_tests(tests, setup, teardown); \ - \ - isc_mem_destroy(&mctx); \ - \ - return (r); \ +#define ISC_TEST_MAIN_CUSTOM(setup, teardown) \ + int main(void) { \ + int r; \ + \ + signal(SIGPIPE, SIG_IGN); \ + \ + isc_mem_debugging |= ISC_MEM_DEBUGRECORD; \ + isc_mem_create(&mctx); \ + \ + r = cmocka_run_group_tests(tests, setup, teardown); \ + \ + isc_mem_destroy(&mctx); \ + \ + return (r); \ }