diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-10-06 18:13:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-10-07 19:27:34 (GMT) |
commit | 9ba8bf123c0a5c8410580b059ec33af656a569b8 (patch) | |
tree | ea55a2665c45cc1eade58ec123207307f45b0c9f /Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake | |
parent | 816c100ae2d1ef9ad42186a260724a279b6b5934 (diff) | |
download | CMake-9ba8bf123c0a5c8410580b059ec33af656a569b8.zip CMake-9ba8bf123c0a5c8410580b059ec33af656a569b8.tar.gz CMake-9ba8bf123c0a5c8410580b059ec33af656a569b8.tar.bz2 |
tests: add a test for ctest_memcheck UndefinedBehaviorSanitizer
Diffstat (limited to 'Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake')
-rw-r--r-- | Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake | 21 |
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 +") |