From f1e51ec3a5b3ed54dec054aa422fdd7a81b078b3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 18 Apr 2017 15:05:59 -0400 Subject: Tests: Fix CMakeTestAllGenerators generator list Since `cmake --help` output now uses `[arch]` placeholders for the VS generators, this test has been extracting invalid generator names. Switch to using `cmake -E capabilities` to get a more robust listing of the generators that does not depend on parsing human-readable help output. --- Tests/CMakeTestAllGenerators/RunCMake.cmake | 35 +++++++---------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/Tests/CMakeTestAllGenerators/RunCMake.cmake b/Tests/CMakeTestAllGenerators/RunCMake.cmake index 6d27d3b..768c689 100644 --- a/Tests/CMakeTestAllGenerators/RunCMake.cmake +++ b/Tests/CMakeTestAllGenerators/RunCMake.cmake @@ -9,42 +9,23 @@ endif() # Analyze 'cmake --help' output for list of available generators: # execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}) -execute_process(COMMAND ${CMAKE_COMMAND} --help +execute_process(COMMAND ${CMAKE_COMMAND} -E capabilities RESULT_VARIABLE result OUTPUT_VARIABLE stdout ERROR_VARIABLE stderr WORKING_DIRECTORY ${dir}) -string(REPLACE ";" "\\;" stdout "${stdout}") -string(REPLACE "\n" "E;" stdout "${stdout}") - -set(collecting 0) set(generators) -foreach(eline ${stdout}) - string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}") - if(collecting AND NOT line STREQUAL "") - if(line MATCHES "=") - string(REGEX REPLACE "^ (.+)= (.*)$" "\\1" gen "${line}") - if(gen MATCHES "[A-Za-z]") - string(REGEX REPLACE "^(.*[^ ]) +$" "\\1" gen "${gen}") - if(gen) - set(generators ${generators} ${gen}) - endif() - endif() - else() - if(line MATCHES "^ [A-Za-z0-9]") - string(REGEX REPLACE "^ (.+)$" "\\1" gen "${line}") - string(REGEX REPLACE "^(.*[^ ]) +$" "\\1" gen "${gen}") - if(gen) - set(generators ${generators} ${gen}) - endif() - endif() +string(REGEX MATCHALL [["name":"[^"]+","platformSupport"]] generators_json "${stdout}") +foreach(gen_json IN LISTS generators_json) + if("${gen_json}" MATCHES [["name":"([^"]+)"]]) + set(gen "${CMAKE_MATCH_1}") + if(NOT gen MATCHES " (Win64|IA64|ARM)$") + list(APPEND generators "${gen}") endif() endif() - if(line STREQUAL "The following generators are available on this platform:") - set(collecting 1) - endif() endforeach() +list(REMOVE_DUPLICATES generators) # Also call with one non-existent generator: # -- cgit v0.12 From 2790ffc96f4e52017718bd1ce3fe1ef70ccae2d2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 18 Apr 2017 15:10:17 -0400 Subject: Tests: Run CMakeTestAllGenerators serially This test may take a long time because it runs many other tools. Do not make it compete with other tests for resources. --- Tests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 910ff39..4269de1 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1158,6 +1158,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators") + # This test runs a lot of processes. Do not make them compete + # for resources with other tests. + set_property(TEST CMakeTestAllGenerators PROPERTY RUN_SERIAL 1) endif() if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures) -- cgit v0.12 From 9e338b57b7a7094b150e10512e6fd758e19eac8c Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 18 Apr 2017 15:12:22 -0400 Subject: Tests: Drop machine-specific logic from CMakeTestAllGenerators Drop hard-coded paths from this test. If we later need machine-specific environment entries we can add dedicated infrastructure for it to be configured locally. --- Tests/CMakeTestAllGenerators/RunCMake.cmake | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/Tests/CMakeTestAllGenerators/RunCMake.cmake b/Tests/CMakeTestAllGenerators/RunCMake.cmake index 768c689..bfbb3a5 100644 --- a/Tests/CMakeTestAllGenerators/RunCMake.cmake +++ b/Tests/CMakeTestAllGenerators/RunCMake.cmake @@ -41,28 +41,6 @@ message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") message(STATUS "CMake generators='${generators}'") -# If we'll be testing any of the MinGW Makefiles generators, adjust the -# ENV{PATH} to make sure libgmp-10.dll can be loaded as needed. But only if -# the testing machine has a default MinGW install... (If you have a -# non-default install, append to the PATH before running the test...) -# -if(generators MATCHES "MinGW Makefiles") - if(EXISTS "C:/MinGW/bin/libgmp-10.dll") - string(TOLOWER "$ENV{PATH}" path) - if(NOT path MATCHES "/mingw/bin") - if(UNIX) - set(sep ":") - set(mingw_bin "/mingw/bin") - else() - set(sep ";") - set(mingw_bin "C:/MinGW/bin") - endif() - set(ENV{PATH} "$ENV{PATH}${sep}${mingw_bin}") - message(STATUS "info: appending '${sep}${mingw_bin}' to the PATH") - endif() - endif() -endif() - # First setup a source tree to run CMake on. # execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory -- cgit v0.12