]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Revert "Kill unit tests that run more than 1200 seconds"
authorOndřej Surý <ondrej@isc.org>
Fri, 14 Apr 2023 04:14:19 +0000 (06:14 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 14 Apr 2023 04:14:19 +0000 (06:14 +0200)
This reverts commit 3d5c7cd46c60e0a534dce0640c4e47b699e7003e 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 should add a custom automake test harness (log driver) that
would kill the unit test after configured timeout.

tests/include/tests/isc.h

index b58695e3a44d6aa370c0c180b6258719c5617536..391a64454becfea6aea47c7dbadcc90a3c0132ee 100644 (file)
@@ -17,9 +17,6 @@
 
 #include <inttypes.h>
 #include <stdbool.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
 
 #include <isc/buffer.h>
 #include <isc/hash.h>
@@ -169,39 +166,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);                                         \
        }