summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-06-24 12:37:37 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-06-24 12:37:37 (GMT)
commitbd2e3c77660caf029637f7736e8a8b65ece5c8c5 (patch)
tree686ba0fd5144da1c26cf4b001b4ad44f6a08a671 /Tests
parent7bf42bf9cc7f987337767655f59d8eabd77b81fe (diff)
parentbb71a3a0dfaba317c7a98b92301310e15f602c38 (diff)
downloadCMake-bd2e3c77660caf029637f7736e8a8b65ece5c8c5.zip
CMake-bd2e3c77660caf029637f7736e8a8b65ece5c8c5.tar.gz
CMake-bd2e3c77660caf029637f7736e8a8b65ece5c8c5.tar.bz2
Merge topic 'add-cmake_host_system_information-command'
bb71a3a Add cmake_host_system_information command
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake1
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake1
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake1
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake5
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in33
-rw-r--r--Tests/CMakeTests/CMakeLists.txt1
6 files changed, 42 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake
new file mode 100644
index 0000000..1655eb4
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake
@@ -0,0 +1 @@
+cmake_host_system_information(HOSTNAME)
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake
new file mode 100644
index 0000000..1f056d5
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake
@@ -0,0 +1 @@
+cmake_host_system_information(RESULT FQDN HOSTNAME)
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake
new file mode 100644
index 0000000..9c5a558
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake
@@ -0,0 +1 @@
+cmake_host_system_information(RESULT RESULT QUERY FOOBAR)
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake
new file mode 100644
index 0000000..1c3156d
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake
@@ -0,0 +1,5 @@
+cmake_host_system_information(RESULT RESULT
+ QUERY NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES
+)
+
+message("[${RESULT}]")
diff --git a/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
new file mode 100644
index 0000000..3294a2f
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
@@ -0,0 +1,33 @@
+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}]")
+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)
+try_and_print(FQDN)
+try_and_print(TOTAL_VIRTUAL_MEMORY)
+try_and_print(AVAILABLE_VIRTUAL_MEMORY)
+try_and_print(TOTAL_PHYSICAL_MEMORY)
+try_and_print(AVAILABLE_PHYSICAL_MEMORY)
+
+include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
+
+check_cmake_test(CMakeHostSystemInformation
+ BadArg1
+ BadArg2
+ BadArg3
+ QueryList
+)
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index b049995..344b772 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -32,6 +32,7 @@ AddCMakeTest(CompilerIdVendor "")
AddCMakeTest(ProcessorCount "-DKWSYS_TEST_EXE=$<TARGET_FILE:cmsysTestsCxx>")
AddCMakeTest(PushCheckState "")
AddCMakeTest(While "")
+AddCMakeTest(CMakeHostSystemInformation "")
AddCMakeTest(FileDownload "")
set_property(TEST CMake.FileDownload PROPERTY