diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-05-03 12:06:59 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-05-03 12:06:59 +0000 |
commit | 657c7a70619d3f2643fa7fdd02b5792c25b60097 (patch) | |
tree | ed48629a04149934dab423f6488a38d8a187ffc8 /vespalib/src/tests/exception_classes | |
parent | 8c5dd0899ed02ceb849cac072a872af70b037778 (diff) |
Add utility header for detecting sanitizer-instrumented compilation
Diffstat (limited to 'vespalib/src/tests/exception_classes')
-rw-r--r-- | vespalib/src/tests/exception_classes/silenceuncaught_test.cpp | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp index 9f6917d5d65..8f8ce2cc915 100644 --- a/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp +++ b/vespalib/src/tests/exception_classes/silenceuncaught_test.cpp @@ -1,26 +1,11 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/util/exception.h> +#include <vespa/vespalib/util/sanitizers.h> #include <vespa/vespalib/process/process.h> using namespace vespalib; -#ifndef __SANITIZE_ADDRESS__ -#if defined(__has_feature) -#if __has_feature(address_sanitizer) -#define __SANITIZE_ADDRESS__ -#endif -#endif -#endif - -#ifndef __SANITIZE_THREAD__ -#if defined(__has_feature) -#if __has_feature(thread_sanitizer) -#define __SANITIZE_THREAD__ -#endif -#endif -#endif - TEST("that uncaught exception causes negative exitcode.") { Process proc("ulimit -c 0 && exec ./vespalib_caught_uncaught_app uncaught"); EXPECT_LESS(proc.join(), 0); @@ -41,8 +26,8 @@ TEST("that caught silenced exception causes exitcode 0") { EXPECT_EQUAL(proc.join(), 0); } -#ifndef __SANITIZE_ADDRESS__ -#ifndef __SANITIZE_THREAD__ +#ifndef VESPA_USE_SANITIZER + #ifdef __APPLE__ // setrlimit with RLIMIT_AS is broken on Darwin #else @@ -60,7 +45,7 @@ TEST("that mmap beyond limits with set VESPA_SILENCE_CORE_ON_OOM cause exitcode Process proc("VESPA_SILENCE_CORE_ON_OOM=1 exec ./vespalib_mmap_app 100000000 10485760 10"); EXPECT_EQUAL(proc.join(), 66); } -#endif + #endif #endif |