diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2021-08-28 19:12:30 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2021-09-09 01:04:46 (GMT) |
commit | ce44c2cec306e6d7266ba3e5444ee36bce879e3d (patch) | |
tree | c16b434ea468b1d9079caf8228c5f93a69ba656a /Tests/RunCMake/ctest_memcheck | |
parent | 9c8e25c5fdc3029020768116d01507bd84cbde42 (diff) | |
download | CMake-ce44c2cec306e6d7266ba3e5444ee36bce879e3d.zip CMake-ce44c2cec306e6d7266ba3e5444ee36bce879e3d.tar.gz CMake-ce44c2cec306e6d7266ba3e5444ee36bce879e3d.tar.bz2 |
ctest_memcheck: generate `DynamicAnalysis-Test.xml` as well
This is useful so that memcheck results also show up as test results on
CDash. It will be submitted with the other `MemCheck` parts.
Fixes: #22190
Diffstat (limited to 'Tests/RunCMake/ctest_memcheck')
4 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-check.cmake b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-check.cmake new file mode 100644 index 0000000..9d2a059 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-check.cmake @@ -0,0 +1,10 @@ +function (find_xml_file name) + file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/${name}.xml") + if (NOT test_xml_file) + message(FATAL_ERROR + "${name}.xml not created.") + endif () +endfunction () + +find_xml_file(DynamicAnalysis) +find_xml_file(DynamicAnalysis-Test) diff --git a/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stderr.txt b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stderr.txt new file mode 100644 index 0000000..e1fc77a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stderr.txt @@ -0,0 +1 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-build/Testing/Temporary/MemoryChecker.1.log\.\* diff --git a/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stdout.txt b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stdout.txt new file mode 100644 index 0000000..b3473bf --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/ExpectedOutputs-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +left shift of negative value -256 - 1 diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake index 6e0a91c..cb8f696 100644 --- a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -95,6 +95,19 @@ unset(CMAKELISTS_EXTRA_CODE) unset(CTEST_EXTRA_CODE) #----------------------------------------------------------------------------- +# add output test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testUndefinedBehaviorSanitizer.cmake\") +") +run_mc_test(ExpectedOutputs "" -DMEMCHECK_TYPE=UndefinedBehaviorSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- set(CTEST_EXTRA_CODE "string(REPLACE \" \" \"\\\\ \" PRE_POST_COMMAND \"\${CTEST_MEMORYCHECK_COMMAND}\") set(CTEST_CUSTOM_PRE_MEMCHECK \"\${PRE_POST_COMMAND} pre command\") |