summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-02-19 16:35:51 (GMT)
committerBrad King <brad.king@kitware.com>2015-02-19 16:35:51 (GMT)
commit1d82105e29fc6f0bb71a474f876a7553b397cc26 (patch)
tree25918c24cedd897673f5f326497ad2b5f836a49f /Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake
parentd7662141a771f105e64b56543d99ee43e7d00849 (diff)
downloadCMake-1d82105e29fc6f0bb71a474f876a7553b397cc26.zip
CMake-1d82105e29fc6f0bb71a474f876a7553b397cc26.tar.gz
CMake-1d82105e29fc6f0bb71a474f876a7553b397cc26.tar.bz2
Tests: Rename RunCMake.{CTestMemcheck => ctest_memcheck}
Follow the convention of naming tests after the command they test.
Diffstat (limited to 'Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake')
-rw-r--r--Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake
new file mode 100644
index 0000000..8ef3c0a
--- /dev/null
+++ b/Tests/RunCMake/ctest_memcheck/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
+")