summaryrefslogtreecommitdiffstats
path: root/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-10-08 14:48:12 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-10-08 14:48:12 (GMT)
commitec941fc04bf4facc7ffe45142351126262fdddee (patch)
tree19e4bdf95913c38eb735b4cbdcd17b49fa9d6d03 /Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake
parent26a8b64f7d98c02e0f489e9e1e12e3484ded8bec (diff)
parente0e75a7201d4189693b409f14a3280b6b94a5f51 (diff)
downloadCMake-ec941fc04bf4facc7ffe45142351126262fdddee.zip
CMake-ec941fc04bf4facc7ffe45142351126262fdddee.tar.gz
CMake-ec941fc04bf4facc7ffe45142351126262fdddee.tar.bz2
Merge topic 'ctest-memcheck-sanitizers'
e0e75a72 Help: Add notes for topic 'ctest-memcheck-sanitizers' 7345a1f7 tests: Add a test for ctest_memcheck MemorySanitizer 0c6330da ctest_memcheck: Add support for MemorySanitizer msan 9ba8bf12 tests: add a test for ctest_memcheck UndefinedBehaviorSanitizer 816c100a ctest_memcheck: Add support for UndefinedBehaviorSanitizer ubsan b67ef537 ctest_memcheck: Order sanitizer type code consistently f48a2968 Tests: Organize CTestTestMemcheck inner test code
Diffstat (limited to 'Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake')
-rw-r--r--Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake
new file mode 100644
index 0000000..8ef3c0a
--- /dev/null
+++ b/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake
@@ -0,0 +1,21 @@
+# this file simulates a program that has been built with undefined behavior
+# sanitizer options
+
+message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]")
+string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}")
+message("LOG_FILE=[${LOG_FILE}]")
+
+# if we are not asked to simulate address sanitizer don't do it
+if(NOT "$ENV{UBSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1")
+ return()
+endif()
+# clear the log file
+file(REMOVE "${LOG_FILE}.2343")
+
+# create an error like undefined behavior santizer creates;
+# these names come from ubsan_diag.cc and ubsan_handlers.cc
+# in llvm
+
+file(APPEND "${LOG_FILE}.2343"
+"<unknown>: runtime error: left shift of negative value -256
+")