瀏覽代碼

Merge topic 'fix-CMakeTestAllGenerators'

9e338b57 Tests: Drop machine-specific logic from CMakeTestAllGenerators
2790ffc9 Tests: Run CMakeTestAllGenerators serially
f1e51ec3 Tests: Fix CMakeTestAllGenerators generator list

Acked-by: Kitware Robot <[email protected]>
Merge-request: !720
Brad King 8 年之前
父節點
當前提交
a7e0453a32
共有 2 個文件被更改,包括 11 次插入49 次删除
  1. 3 0
      Tests/CMakeLists.txt
  2. 8 49
      Tests/CMakeTestAllGenerators/RunCMake.cmake

+ 3 - 0
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)

+ 8 - 49
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:
 #
@@ -60,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