From 0b9ffffcd437c3538ff5aa1858d743a289b06129 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 3 Oct 2014 13:42:43 -0400 Subject: ctest: update documentation for CTEST_MEMORYCHECK_TYPE The AddressSanitizer value was not documented. Also fix some typos. --- Help/manual/ctest.1.rst | 6 ++++++ Help/variable/CTEST_MEMORYCHECK_TYPE.rst | 5 +++-- Source/CTest/cmCTestMemCheckHandler.h | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index a3210a9..9b783ba 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -824,6 +824,12 @@ Configuration settings include: * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_COMMAND_OPTIONS` * :module:`CTest` module variable: ``MEMORYCHECK_COMMAND_OPTIONS`` +``MemoryCheckType`` + Specify the type of memory checking to perform. + + * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_TYPE` + * :module:`CTest` module variable: ``MEMORYCHECK_TYPE`` + ``MemoryCheckSuppressionFile`` Specify a file containing suppression rules for the ``MemoryCheckCommand`` tool. It will be passed with options diff --git a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst index f7875da..e8d5461 100644 --- a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst +++ b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst @@ -1,6 +1,7 @@ CTEST_MEMORYCHECK_TYPE -------------------------- +---------------------- Specify the CTest ``MemoryCheckType`` setting in a :manual:`ctest(1)` dashboard client script. -Valid values are Valgrind, Purify, BoundsChecker, and ThreadSanitizer. +Valid values are Valgrind, Purify, BoundsChecker, and ThreadSanitizer, +and AddressSanitizer. diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 2195dab..f442376 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -49,7 +49,7 @@ private: VALGRIND, PURIFY, BOUNDS_CHECKER, - // checkers after hear do not use the standard error list + // checkers after here do not use the standard error list THREAD_SANITIZER, ADDRESS_SANITIZER }; -- cgit v0.12 From ca9cc25ce8c6f74998fd9f30d36449814c170ea5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 3 Oct 2014 13:45:07 -0400 Subject: ctest: add support for additional sanitizer options Sanitizers receive options through their environment variable; support user-specified options here. --- Help/manual/cmake-variables.7.rst | 1 + Help/manual/ctest.1.rst | 6 ++++++ Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst | 5 +++++ Modules/DartConfiguration.tcl.in | 1 + Source/CTest/cmCTestMemCheckCommand.cxx | 2 ++ Source/CTest/cmCTestMemCheckHandler.cxx | 16 +++++++++++----- 6 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 3f92ec5..864ea6e 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -351,6 +351,7 @@ Variables for CTest /variable/CTEST_HG_UPDATE_OPTIONS /variable/CTEST_MEMORYCHECK_COMMAND /variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS + /variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS /variable/CTEST_MEMORYCHECK_SUPPRESSIONS_FILE /variable/CTEST_MEMORYCHECK_TYPE /variable/CTEST_NIGHTLY_START_TIME diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 9b783ba..f7681d6 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -830,6 +830,12 @@ Configuration settings include: * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_TYPE` * :module:`CTest` module variable: ``MEMORYCHECK_TYPE`` +``MemoryCheckSanitizerOptions`` + Specify options to sanitizers when running with a sanitize-enabled build. + + * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS` + * :module:`CTest` module variable: ``MEMORYCHECK_SANITIZER_OPTIONS`` + ``MemoryCheckSuppressionFile`` Specify a file containing suppression rules for the ``MemoryCheckCommand`` tool. It will be passed with options diff --git a/Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst b/Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst new file mode 100644 index 0000000..2de5fb6 --- /dev/null +++ b/Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst @@ -0,0 +1,5 @@ +CTEST_MEMORYCHECK_SANITIZER_OPTIONS +----------------------------------- + +Specify the CTest ``MemoryCheckSanitizerOptions`` setting +in a :manual:`ctest(1)` dashboard client script. diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 86049d0..37a0a40 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -75,6 +75,7 @@ PurifyCommand: @PURIFYCOMMAND@ ValgrindCommand: @VALGRIND_COMMAND@ ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@ MemoryCheckType: @MEMORYCHECK_TYPE@ +MemoryCheckSanitizerOptions: @MEMORYCHECK_SANITIZER_OPTIONS@ MemoryCheckCommand: @MEMORYCHECK_COMMAND@ MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@ diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index 939b4dc..f144066 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -23,6 +23,8 @@ cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, + "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS"); + this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS"); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index a7ab077..16ac37c 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -686,15 +686,21 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() // TSAN_OPTIONS string with the log_path in it. this->MemoryTesterDynamicOptions.push_back("-E"); this->MemoryTesterDynamicOptions.push_back("env"); - std::string envVar = "TSAN_OPTIONS"; - std::string extraOptions; - if(this->MemoryTesterStyle == cmCTestMemCheckHandler::ADDRESS_SANITIZER) + std::string envVar; + std::string extraOptions = + this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions"); + if(this->MemoryTesterStyle == cmCTestMemCheckHandler::THREAD_SANITIZER) + { + envVar = "TSAN_OPTIONS"; + } + else if(this->MemoryTesterStyle == + cmCTestMemCheckHandler::ADDRESS_SANITIZER) { envVar = "ASAN_OPTIONS"; - extraOptions = " detect_leaks=1"; + extraOptions += " detect_leaks=1"; } std::string outputFile = envVar + "=log_path=\"" - + this->MemoryTesterOutputFile + "\""; + + this->MemoryTesterOutputFile + "\" "; this->MemoryTesterEnvironmentVariable = outputFile + extraOptions; break; } -- cgit v0.12 From f0661bf318b75ebb191a4e0ba07e4e15d260710d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 6 Oct 2014 13:43:28 -0400 Subject: tests: fix copy/paste from tsan -> asan comments --- Tests/CTestTestMemcheck/testAddressSanitizer.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake index a073151..3082e4b 100644 --- a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake +++ b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake @@ -1,4 +1,4 @@ -# this file simulates a program that has been built with thread sanitizer +# this file simulates a program that has been built with address sanitizer # options message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") @@ -12,8 +12,7 @@ endif() # clear the log file file(REMOVE "${LOG_FILE}.2343") -# create an error of each type of thread santizer -# these names come from tsan_report.cc in llvm +# create an example error from address santizer file(APPEND "${LOG_FILE}.2343" "================================================================= -- cgit v0.12 From f25e431d6efc2f03b49e15c831df9ee17594eea2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 6 Oct 2014 14:00:15 -0400 Subject: tests: set sanitizer options properly Prior to this, these options were just being set in the environment. --- Tests/CTestTestMemcheck/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 3ad0b26..7422eb5 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -121,7 +121,7 @@ set(CTEST_EXTRA_CODE) # add LeakSanitizer test set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") ") set(CMAKELISTS_EXTRA_CODE @@ -136,7 +136,7 @@ set_tests_properties(CTestTestMemcheckDummyLeakSanitizer PROPERTIES ".*Memory checking results:.*Direct leak - 2.*Indirect leak - 1.*") # add AddressSanitizer test set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") ") set(CMAKELISTS_EXTRA_CODE -- cgit v0.12