]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Properly disable lib/ns tests when run under ASAN
authorOndřej Surý <ondrej@sury.org>
Wed, 13 Nov 2019 08:29:04 +0000 (09:29 +0100)
committerMark Andrews <marka@isc.org>
Fri, 15 Nov 2019 05:09:52 +0000 (05:09 +0000)
lib/ns/tests/listenlist_test.c
lib/ns/tests/notify_test.c
lib/ns/tests/query_test.c

index ca8130b181d133dd1272bf95acb3e9c37363a46d..78ca786d8fdf0b99d2496c5fbad3045fb69e573d 100644 (file)
@@ -9,7 +9,9 @@
  * information regarding copyright ownership.
  */
 
-#if HAVE_CMOCKA
+#include <isc/util.h>
+
+#if HAVE_CMOCKA && !__SANITIZE_ADDRESS__
 
 #include <stdarg.h>
 #include <stddef.h>
@@ -26,7 +28,6 @@
 
 #include <isc/list.h>
 #include <isc/print.h>
-#include <isc/util.h>
 
 #include <dns/acl.h>
 
@@ -119,25 +120,25 @@ main(void) {
                                                _setup, _teardown),
        };
 
-       /*
-        * We disable this test when the address sanitizer is in
-        * the use, as libuv will trigger errors.
-        */
-       if (getenv("ASAN_OPTIONS") != NULL) {
-               printf("1..0 # Skip ASAN is in use\n");
-               return (0);
-       }
-
        return (cmocka_run_group_tests(tests, NULL, NULL));
 }
-#else /* HAVE_CMOCKA */
+
+#else /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */
 
 #include <stdio.h>
 
 int
 main(void) {
+#if __SANITIZE_ADDRESS__
+       /*
+        * We disable this test when the address sanitizer is in
+        * the use, as libuv will trigger errors.
+        */
+       printf("1..0 # Skip ASAN is in use\n");
+#else /* ADDRESS_SANIZITER */
        printf("1..0 # Skip cmocka not available\n");
+#endif /* __SANITIZE_ADDRESS__ */
        return (0);
 }
 
-#endif /* HAVE_CMOCKA */
+#endif /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */
index 7f3974dd67df68aa04f030c2062f4aa33bd32767..bc94fcc01b71c4aa6c240e2e57faedc81f684960 100644 (file)
@@ -9,7 +9,9 @@
  * information regarding copyright ownership.
  */
 
-#if HAVE_CMOCKA
+#include <isc/util.h>
+
+#if HAVE_CMOCKA && !__SANITIZE_ADDRESS__
 
 #include <stdarg.h>
 #include <stddef.h>
@@ -27,7 +29,6 @@
 #include <isc/event.h>
 #include <isc/print.h>
 #include <isc/task.h>
-#include <isc/util.h>
 
 #include <dns/acl.h>
 #include <dns/rcode.h>
@@ -146,25 +147,24 @@ main(void) {
                                                _setup, _teardown),
        };
 
-       /*
-        * We disable this test when the address sanitizer is in
-        * the use, as libuv will trigger errors.
-        */
-       if (getenv("ASAN_OPTIONS") != NULL) {
-               printf("1..0 # Skip ASAN is in use\n");
-               return (0);
-       }
-
        return (cmocka_run_group_tests(tests, NULL, NULL));
 }
-#else /* HAVE_CMOCKA */
+#else /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */
 
 #include <stdio.h>
 
 int
 main(void) {
+#if __SANITIZE_ADDRESS__
+       /*
+        * We disable this test when the address sanitizer is in
+        * the use, as libuv will trigger errors.
+        */
+       printf("1..0 # Skip ASAN is in use\n");
+#else /* __SANITIZE_ADDRESS__ */
        printf("1..0 # Skip cmocka not available\n");
+#endif /* __SANITIZE_ADDRESS__ */
        return (0);
 }
 
-#endif
+#endif /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */
index 3540a3f91e63ac10736c93473f73da52b6883038..3094ced2b8aa3d9322c2422422e0cb6c73bcff30 100644 (file)
@@ -9,7 +9,9 @@
  * information regarding copyright ownership.
  */
 
-#if HAVE_CMOCKA
+#include <isc/util.h>
+
+#if HAVE_CMOCKA && !__SANITIZE_ADDRESS__
 
 #include <stdarg.h>
 #include <stddef.h>
@@ -24,8 +26,6 @@
 #define UNIT_TESTING
 #include <cmocka.h>
 
-#include <isc/util.h>
-
 #include <dns/badcache.h>
 #include <dns/view.h>
 
@@ -598,25 +598,25 @@ main(void) {
                                                _setup, _teardown),
        };
 
-       /*
-        * We disable this test when the address sanitizer is in
-        * the use, as libuv will trigger errors.
-        */
-       if (getenv("ASAN_OPTIONS") != NULL) {
-               printf("1..0 # Skip ASAN is in use\n");
-               return (0);
-       }
-
        return (cmocka_run_group_tests(tests, NULL, NULL));
 }
-#else /* HAVE_CMOCKA */
+
+#else /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */
 
 #include <stdio.h>
 
 int
 main(void) {
+#if __SANITIZE_ADDRESS__
+       /*
+        * We disable this test when the address sanitizer is in
+        * the use, as libuv will trigger errors.
+        */
+       printf("1..0 # Skip ASAN is in use\n");
+#else /* ADDRESS_SANIZITER */
        printf("1..0 # Skip cmocka not available\n");
+#endif /* __SANITIZE_ADDRESS__ */
        return (0);
 }
 
-#endif /* HAVE_CMOCKA */
+#endif /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */