diff options
author | Brad King <brad.king@kitware.com> | 2020-04-16 13:35:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-04-17 12:36:01 (GMT) |
commit | e03d3c08f0fbfbe119c7690e06d1c73924a792aa (patch) | |
tree | edceffb8583777a32633af8b42f34217b6b3009d /Tests | |
parent | 82b60917769cf39e5c24917cb6f0fbeb95b89001 (diff) | |
download | CMake-e03d3c08f0fbfbe119c7690e06d1c73924a792aa.zip CMake-e03d3c08f0fbfbe119c7690e06d1c73924a792aa.tar.gz CMake-e03d3c08f0fbfbe119c7690e06d1c73924a792aa.tar.bz2 |
CTest: Fix '-T MemCheck' command-line support for sanitizers
In commit 49948f7221 (ctest_memcheck: Add support for ThreadSanitizer,
2014-07-07, v3.1.0-rc1~322^2~1) and commit 1e005eadbc (CTest: Fix
MemoryCheckType from 'ctest -T MemCheck', 2014-07-15, v3.1.0-rc1~298^2),
the `CMakeCommand` internal setting was left set only when using `ctest
-S` scripts. Instead simply use CTest's corresponding CMake directly
without passing it through an internal setting.
Fixes: #20584
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/MemCheckSan.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 21 |
2 files changed, 28 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/MemCheckSan.cmake b/Tests/RunCMake/CTestCommandLine/MemCheckSan.cmake new file mode 100644 index 0000000..192c30c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/MemCheckSan.cmake @@ -0,0 +1,7 @@ +set(MEMORYCHECK_COMMAND "") +include(CTest) +add_test( + NAME TestSan + COMMAND ${CMAKE_COMMAND} + -P ${CMAKE_CURRENT_LIST_DIR}/../ctest_memcheck/test${MEMORYCHECK_TYPE}.cmake + ) diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 9b9ae65..c76314a 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -345,3 +345,24 @@ run_NoTests() # Check the configuration type variable is passed run_ctest(check-configuration-type) + +function(run_MemCheckSan case opts) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MemCheckSan${case}-build) + set(RunCMake_TEST_OPTIONS + "-DMEMORYCHECK_TYPE=${case}Sanitizer" + "-DMEMORYCHECK_SANITIZER_OPTIONS=${opts}" + ) + run_cmake(MemCheckSan) + unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake-stdout-file "../ctest_memcheck/Dummy${case}Sanitizer-stdout.txt") + run_cmake_command(MemCheckSan${case}-ctest + ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T MemCheck -V + ) +endfunction() +run_MemCheckSan(Address "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(Leak "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(Memory "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(Thread "report_bugs=1:history_size=5:exitcode=55") +run_MemCheckSan(UndefinedBehavior "simulate_sanitizer=1") |