From e03f83f394c53acbcc9dcff03f189170b2f33322 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 24 Jan 2013 23:15:13 +0100 Subject: [PATCH 1/2] ProcessorCount test: fix path to cmsysTestsCxx executable Use a generator expression to get the real place of this target instead of guessing it wrong. --- Tests/CMakeTests/CMakeLists.txt | 5 +++-- Tests/CMakeTests/ProcessorCountTest.cmake.in | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index d34d4a618..b0499954b 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -4,7 +4,8 @@ set(CMAKE_EXECUTABLE "${CMake_BIN_DIR}/cmake") macro(AddCMakeTest TestName PreArgs) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${TestName}Test.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" @ONLY IMMEDIATE) - add_test(CMake.${TestName} ${CMAKE_EXECUTABLE} ${PreArgs} + add_test(NAME CMake.${TestName} + COMMAND ${CMAKE_EXECUTABLE} ${PreArgs} -P "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" ${ARGN}) endmacro() @@ -28,7 +29,7 @@ AddCMakeTest(String "") AddCMakeTest(Math "") AddCMakeTest(CMakeMinimumRequired "") AddCMakeTest(CompilerIdVendor "") -AddCMakeTest(ProcessorCount "") +AddCMakeTest(ProcessorCount "-DKWSYS_TEST_EXE=$") AddCMakeTest(PushCheckState "") AddCMakeTest(While "") diff --git a/Tests/CMakeTests/ProcessorCountTest.cmake.in b/Tests/CMakeTests/ProcessorCountTest.cmake.in index 98f6ab16d..15e021948 100644 --- a/Tests/CMakeTests/ProcessorCountTest.cmake.in +++ b/Tests/CMakeTests/ProcessorCountTest.cmake.in @@ -9,7 +9,7 @@ message("### 3. ProcessorCount(...) function call is emitting output that it sho message("processor_count='${processor_count}'") execute_process( - COMMAND "@CMAKE_BINARY_DIR@/Source/kwsys/$ENV{CMAKE_CONFIG_TYPE}/cmsysTestsCxx" + COMMAND "${KWSYS_TEST_EXE}" testSystemInformation OUTPUT_VARIABLE tsi_out ERROR_VARIABLE tsi_err) From 4d0e2e81e9c60f6f147f3b332b1d885d543b2084 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 23 Jan 2013 20:23:18 +0100 Subject: [PATCH 2/2] ProcessorCount test: require SystemInformation process to work Currently this silently fails on some systems. Make sure those things get noticed so we can fix that. --- Tests/CMakeTests/ProcessorCountTest.cmake.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeTests/ProcessorCountTest.cmake.in b/Tests/CMakeTests/ProcessorCountTest.cmake.in index 15e021948..f92dcc44c 100644 --- a/Tests/CMakeTests/ProcessorCountTest.cmake.in +++ b/Tests/CMakeTests/ProcessorCountTest.cmake.in @@ -12,7 +12,14 @@ execute_process( COMMAND "${KWSYS_TEST_EXE}" testSystemInformation OUTPUT_VARIABLE tsi_out - ERROR_VARIABLE tsi_err) + ERROR_VARIABLE tsi_err + RESULT_VARIABLE tsi_res +) +if (tsi_res) + message("executing \"${KWSYS_TEST_EXE}\" failed") + message(FATAL_ERROR "output: ${tsi_res}") +endif () + string(REGEX REPLACE "(.*)GetNumberOfPhysicalCPU:.([0-9]*)(.*)" "\\2" system_info_processor_count "${tsi_out}")