summaryrefslogtreecommitdiff
path: root/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in')
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in33
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
new file mode 100644
index 000000000..3294a2f0d
--- /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
+)