diff options
author | Brad King <brad.king@kitware.com> | 2014-12-16 18:59:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-12-18 15:12:16 (GMT) |
commit | 7ca6bdf0355157da9f85f6bbf039a632ffdf66b7 (patch) | |
tree | 0665524d4973903b38fa6779d85c328b6f2305b4 /Tests/CTestTestMemcheck | |
parent | 1651dc96683282c0af8ef47973db9afa950d6bde (diff) | |
download | CMake-7ca6bdf0355157da9f85f6bbf039a632ffdf66b7.zip CMake-7ca6bdf0355157da9f85f6bbf039a632ffdf66b7.tar.gz CMake-7ca6bdf0355157da9f85f6bbf039a632ffdf66b7.tar.bz2 |
Tests: Move CTestTestMemcheck tools into Tests/CMakeLib
The dummy memcheck tools we build for the RunCMake.CTestMemcheck tests
require CMakeLib, so put them in a Tests/CMakeLib/PseudoMemcheck
directory.
Diffstat (limited to 'Tests/CTestTestMemcheck')
-rw-r--r-- | Tests/CTestTestMemcheck/CMakeLists.txt | 41 | ||||
-rw-r--r-- | Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/CTestTestMemcheck/memtester.cxx.in | 60 |
3 files changed, 0 insertions, 123 deletions
diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt deleted file mode 100644 index 5d6319a..0000000 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -foreach (_retval 0 1) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) -endforeach () - -include_directories(${CMake_SOURCE_DIR}/Source ${CMake_BINARY_DIR}/Source) - -# create binaries that we will use as a pseudo memory checker -add_executable(pseudo_valgrind "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") -set_target_properties(pseudo_valgrind PROPERTIES OUTPUT_NAME valgrind) -target_link_libraries(pseudo_valgrind CMakeLib) - -add_executable(pseudo_purify "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") -set_target_properties(pseudo_purify PROPERTIES OUTPUT_NAME purify) -target_link_libraries(pseudo_purify CMakeLib) -add_executable(pseudo_BC "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") -set_target_properties(pseudo_BC PROPERTIES OUTPUT_NAME BC) -target_link_libraries(pseudo_BC CMakeLib) - -# binary to be used as pre- and post-memcheck command that fails -add_executable(memcheck_fail "${CMAKE_CURRENT_BINARY_DIR}/ret1.cxx") -target_link_libraries(memcheck_fail CMakeLib) - -# Binaries that are used as memchecker that do not write the expected -# output file. Need to be in their own subdirectory as they have the -# same filenames. -add_subdirectory(NoLogDummyChecker) - -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - foreach(t - memcheck_fail - pseudo_BC - pseudo_purify - pseudo_valgrind - ) - add_custom_command(TARGET ${t} - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - endforeach() -endif() diff --git a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt deleted file mode 100644 index 3a45bfe..0000000 --- a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# A dummy checker implementation that does not write the requested output file -# so it triggers an error for every checker. - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(){return 0;}\n") - -configure_file( - "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" - "${CMAKE_CURRENT_BINARY_DIR}/ret0.c" - ) - -foreach(_pseudo IN ITEMS valgrind purify BC) - add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") - set_target_properties(pseudonl_${_pseudo} PROPERTIES OUTPUT_NAME ${_pseudo}) - - # Xcode 2.x forgets to create the output directory before linking - # the individual architectures. - if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command(TARGET pseudonl_${_pseudo} - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) - endif() -endforeach() diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in deleted file mode 100644 index 43c0ba7..0000000 --- a/Tests/CTestTestMemcheck/memtester.cxx.in +++ /dev/null @@ -1,60 +0,0 @@ -#include <cmSystemTools.h> -#include <cmsys/Encoding.hxx> -#include <string> -#include <locale.h> - -#define RETVAL @_retval@ - -int -main(int ac, char **av) -{ - setlocale(LC_CTYPE, ""); - cmsys::Encoding::CommandLineArguments args = - cmsys::Encoding::CommandLineArguments::Main(ac, av); - int argc = args.argc(); - const char* const* argv = args.argv(); - - std::string exename = argv[0]; - std::string logarg; - bool nextarg = false; - - if (exename.find("valgrind") != exename.npos) - logarg = "--log-file="; - else if (exename.find("purify") != exename.npos) -#ifdef _WIN32 - logarg = "/SAVETEXTDATA="; -#else - logarg = "-log-file="; -#endif - else if (exename.find("BC") != exename.npos) - { - nextarg = true; - logarg = "/X"; - } - - if (!logarg.empty()) { - std::string logfile; - for (int i = 1; i < argc; i++) { - std::string arg = argv[i]; - if (arg.find(logarg) == 0) - { - if (nextarg) - { - if (i == argc - 1) - return 1; // invalid command line - logfile = argv[i + 1]; - } - else - { - logfile = arg.substr(logarg.length()); - } - // keep searching, it may be overridden later to provoke an error - } - } - - if (!logfile.empty()) - cmSystemTools::Touch(logfile.c_str(), true); - } - - return RETVAL; -} |