From: Ondřej Surý Date: Wed, 13 Nov 2019 08:29:04 +0000 (+0100) Subject: Properly disable lib/ns tests when run under ASAN X-Git-Tag: v9.15.6~9^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d50322ed9531e5e3ada16da6e364a224d9d88752;p=thirdparty%2Fbind9.git Properly disable lib/ns tests when run under ASAN --- diff --git a/lib/ns/tests/listenlist_test.c b/lib/ns/tests/listenlist_test.c index ca8130b181d..78ca786d8fd 100644 --- a/lib/ns/tests/listenlist_test.c +++ b/lib/ns/tests/listenlist_test.c @@ -9,7 +9,9 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA +#include + +#if HAVE_CMOCKA && !__SANITIZE_ADDRESS__ #include #include @@ -26,7 +28,6 @@ #include #include -#include #include @@ -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 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__ */ diff --git a/lib/ns/tests/notify_test.c b/lib/ns/tests/notify_test.c index 7f3974dd67d..bc94fcc01b7 100644 --- a/lib/ns/tests/notify_test.c +++ b/lib/ns/tests/notify_test.c @@ -9,7 +9,9 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA +#include + +#if HAVE_CMOCKA && !__SANITIZE_ADDRESS__ #include #include @@ -27,7 +29,6 @@ #include #include #include -#include #include #include @@ -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 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__ */ diff --git a/lib/ns/tests/query_test.c b/lib/ns/tests/query_test.c index 3540a3f91e6..3094ced2b8a 100644 --- a/lib/ns/tests/query_test.c +++ b/lib/ns/tests/query_test.c @@ -9,7 +9,9 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA +#include + +#if HAVE_CMOCKA && !__SANITIZE_ADDRESS__ #include #include @@ -24,8 +26,6 @@ #define UNIT_TESTING #include -#include - #include #include @@ -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 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__ */