mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-23 00:48:55 +08:00
Testing: Convert cmake_host_system_information
tests into RunCMake
This commit is contained in:
@@ -31,7 +31,6 @@ AddCMakeTest(CompilerIdVendor "")
|
||||
AddCMakeTest(ProcessorCount "-DKWSYS_TEST_EXE=$<TARGET_FILE:cmsysTestsCxx>")
|
||||
AddCMakeTest(PushCheckState "")
|
||||
AddCMakeTest(While "")
|
||||
AddCMakeTest(CMakeHostSystemInformation "")
|
||||
|
||||
AddCMakeTest(FileDownload "")
|
||||
set_tests_properties(CMake.FileDownload PROPERTIES
|
||||
|
@@ -349,6 +349,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
|
||||
endif()
|
||||
add_RunCMake_test(execute_process)
|
||||
add_RunCMake_test(export)
|
||||
add_RunCMake_test(cmake_host_system_information)
|
||||
add_RunCMake_test(cmake_language)
|
||||
add_RunCMake_test(cmake_minimum_required)
|
||||
add_RunCMake_test(cmake_parse_arguments)
|
||||
|
@@ -0,0 +1 @@
|
||||
1
|
@@ -0,0 +1,4 @@
|
||||
CMake Error at BadArg1\.cmake:1 \(cmake_host_system_information\):
|
||||
cmake_host_system_information missing RESULT specification.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:7 \(include\)
|
@@ -0,0 +1 @@
|
||||
1
|
@@ -0,0 +1,4 @@
|
||||
CMake Error at BadArg2\.cmake:1 \(cmake_host_system_information\):
|
||||
cmake_host_system_information missing QUERY specification
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:7 \(include\)
|
@@ -0,0 +1 @@
|
||||
1
|
@@ -0,0 +1,4 @@
|
||||
CMake Error at BadArg3\.cmake:1 \(cmake_host_system_information\):
|
||||
cmake_host_system_information does not recognize <key> FOOBAR
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:7 \(include\)
|
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
project(${RunCMake_TEST} NONE)
|
||||
|
||||
set(CMAKE_SYSROOT ${PROJECT_SOURCE_DIR}/${RunCMake_TEST})
|
||||
|
||||
include(${RunCMake_TEST}.cmake)
|
@@ -0,0 +1,27 @@
|
||||
-- NUMBER_OF_LOGICAL_CORES=`[0-9]+`
|
||||
-- NUMBER_OF_PHYSICAL_CORES=`[0-9]+`
|
||||
-- HOSTNAME=`.*`
|
||||
-- FQDN=`.*`
|
||||
-- TOTAL_VIRTUAL_MEMORY=`[0-9]+`
|
||||
-- AVAILABLE_VIRTUAL_MEMORY=`[0-9]+`
|
||||
-- TOTAL_PHYSICAL_MEMORY=`[0-9]+`
|
||||
-- AVAILABLE_PHYSICAL_MEMORY=`[0-9]+`
|
||||
-- IS_64BIT=`[01]`
|
||||
-- HAS_FPU=`[01]`
|
||||
-- HAS_MMX=`[01]`
|
||||
-- HAS_MMX_PLUS=`[01]`
|
||||
-- HAS_SSE=`[01]`
|
||||
-- HAS_SSE2=`[01]`
|
||||
-- HAS_SSE_FP=`[01]`
|
||||
-- HAS_SSE_MMX=`[01]`
|
||||
-- HAS_AMD_3DNOW=`[01]`
|
||||
-- HAS_AMD_3DNOW_PLUS=`[01]`
|
||||
-- HAS_IA64=`[01]`
|
||||
-- HAS_SERIAL_NUMBER=`[01]`
|
||||
-- PROCESSOR_SERIAL_NUMBER=`.*`
|
||||
-- PROCESSOR_NAME=`.*`
|
||||
-- PROCESSOR_DESCRIPTION=`.*`
|
||||
-- OS_NAME=`.*`
|
||||
-- OS_RELEASE=`.*`
|
||||
-- OS_VERSION=`.*`
|
||||
-- OS_PLATFORM=`.*`
|
@@ -1,19 +1,8 @@
|
||||
set(BadArg1-RESULT 1)
|
||||
set(BadArg1-STDERR "missing RESULT specification")
|
||||
set(BadArg2-RESULT 1)
|
||||
set(BadArg2-STDERR "missing QUERY specification")
|
||||
set(BadArg3-RESULT 1)
|
||||
set(BadArg3-STDERR "does not recognize <key> FOOBAR")
|
||||
set(QueryList-RESULT 0)
|
||||
set(QueryList-STDERR "\\[[0-9]+;[0-9]+\\]")
|
||||
|
||||
function(try_and_print key)
|
||||
cmake_host_system_information(RESULT RESULT QUERY ${key})
|
||||
message(STATUS "[${key}] [${RESULT}]")
|
||||
cmake_host_system_information(RESULT RESULT QUERY ${key})
|
||||
message(STATUS "${key}=`${RESULT}`")
|
||||
endfunction()
|
||||
|
||||
message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
|
||||
|
||||
try_and_print(NUMBER_OF_LOGICAL_CORES)
|
||||
try_and_print(NUMBER_OF_PHYSICAL_CORES)
|
||||
try_and_print(HOSTNAME)
|
||||
@@ -41,12 +30,3 @@ try_and_print(OS_NAME)
|
||||
try_and_print(OS_RELEASE)
|
||||
try_and_print(OS_VERSION)
|
||||
try_and_print(OS_PLATFORM)
|
||||
|
||||
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
|
||||
|
||||
check_cmake_test(CMakeHostSystemInformation
|
||||
BadArg1
|
||||
BadArg2
|
||||
BadArg3
|
||||
QueryList
|
||||
)
|
@@ -0,0 +1 @@
|
||||
-- \[[0-9]+;[0-9]+\]
|
@@ -2,4 +2,4 @@ cmake_host_system_information(RESULT RESULT
|
||||
QUERY NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES
|
||||
)
|
||||
|
||||
message("[${RESULT}]")
|
||||
message(STATUS "[${RESULT}]")
|
@@ -0,0 +1,8 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(BadArg1)
|
||||
run_cmake(BadArg2)
|
||||
run_cmake(BadArg3)
|
||||
|
||||
run_cmake(QueryList)
|
||||
run_cmake(QueryKeys)
|
Reference in New Issue
Block a user