Properly disable lib/ns tests when run under ASAN

This commit is contained in:
Ondřej Surý
2019-11-13 09:29:04 +01:00
committed by Mark Andrews
parent abe8fa5253
commit d50322ed95
3 changed files with 41 additions and 40 deletions

View 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__ */