summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FileAPI
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-11-12 20:01:49 (GMT)
committerBrad King <brad.king@kitware.com>2018-12-12 14:46:13 (GMT)
commit3f6ee75a66042370fe48833bcd5c712448ec59c0 (patch)
tree4201698ae31c8ad1a105748f9746d4f4554ad888 /Tests/RunCMake/FileAPI
parent7489e95b8ec35c7faa1f9dcfc3a6962a56969531 (diff)
downloadCMake-3f6ee75a66042370fe48833bcd5c712448ec59c0.zip
CMake-3f6ee75a66042370fe48833bcd5c712448ec59c0.tar.gz
CMake-3f6ee75a66042370fe48833bcd5c712448ec59c0.tar.bz2
fileapi: Add test for cache v2
Diffstat (limited to 'Tests/RunCMake/FileAPI')
-rw-r--r--Tests/RunCMake/FileAPI/cache-v2-check.py121
-rw-r--r--Tests/RunCMake/FileAPI/cache-v2.cmake15
2 files changed, 134 insertions, 2 deletions
diff --git a/Tests/RunCMake/FileAPI/cache-v2-check.py b/Tests/RunCMake/FileAPI/cache-v2-check.py
index 13553c3..756ef80 100644
--- a/Tests/RunCMake/FileAPI/cache-v2-check.py
+++ b/Tests/RunCMake/FileAPI/cache-v2-check.py
@@ -5,10 +5,129 @@ def check_objects(o):
assert len(o) == 1
check_index_object(o[0], "cache", 2, 0, check_object_cache)
+def check_cache_entry(actual, expected):
+ assert is_dict(actual)
+ assert sorted(actual.keys()) == ["name", "properties", "type", "value"]
+
+ assert is_string(actual["type"], expected["type"])
+ assert is_string(actual["value"], expected["value"])
+
+ def check_property(actual, expected):
+ assert is_dict(actual)
+ assert sorted(actual.keys()) == ["name", "value"]
+ assert is_string(actual["value"], expected["value"])
+
+ check_list_match(lambda a, e: is_string(a["name"], e["name"]), actual["properties"], expected["properties"], check=check_property)
+
def check_object_cache(o):
assert sorted(o.keys()) == ["entries", "kind", "version"]
# The "kind" and "version" members are handled by check_index_object.
- # FIXME: Check "entries" member
+ check_list_match(lambda a, e: is_string(a["name"], e["name"]), o["entries"], [
+ {
+ "name": "CM_OPTION_BOOL",
+ "type": "BOOL",
+ "value": "OFF",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing option()",
+ },
+ ],
+ },
+ {
+ "name": "CM_SET_BOOL",
+ "type": "BOOL",
+ "value": "ON",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing set(CACHE BOOL)",
+ },
+ {
+ "name": "ADVANCED",
+ "value": "1",
+ },
+ ],
+ },
+ {
+ "name": "CM_SET_FILEPATH",
+ "type": "FILEPATH",
+ "value": "dir1/dir2/empty.txt",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing set(CACHE FILEPATH)",
+ },
+ ],
+ },
+ {
+ "name": "CM_SET_PATH",
+ "type": "PATH",
+ "value": "dir1/dir2",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing set(CACHE PATH)",
+ },
+ {
+ "name": "ADVANCED",
+ "value": "ON",
+ },
+ ],
+ },
+ {
+ "name": "CM_SET_STRING",
+ "type": "STRING",
+ "value": "test",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing set(CACHE STRING)",
+ },
+ ],
+ },
+ {
+ "name": "CM_SET_STRINGS",
+ "type": "STRING",
+ "value": "1",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing set(CACHE STRING) with STRINGS",
+ },
+ {
+ "name": "STRINGS",
+ "value": "1;2;3;4",
+ },
+ ],
+ },
+ {
+ "name": "CM_SET_INTERNAL",
+ "type": "INTERNAL",
+ "value": "int2",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing set(CACHE INTERNAL)",
+ },
+ ],
+ },
+ {
+ "name": "CM_SET_TYPE",
+ "type": "STRING",
+ "value": "1",
+ "properties": [
+ {
+ "name": "HELPSTRING",
+ "value": "Testing set(CACHE INTERNAL) with set_property(TYPE)",
+ },
+ {
+ "name": "ADVANCED",
+ "value": "0",
+ },
+ ],
+ },
+ ], check=check_cache_entry, allow_extra=True)
assert is_dict(index)
assert sorted(index.keys()) == ["cmake", "objects", "reply"]
diff --git a/Tests/RunCMake/FileAPI/cache-v2.cmake b/Tests/RunCMake/FileAPI/cache-v2.cmake
index 7b98869..45b402d 100644
--- a/Tests/RunCMake/FileAPI/cache-v2.cmake
+++ b/Tests/RunCMake/FileAPI/cache-v2.cmake
@@ -1 +1,14 @@
-# FIXME: add some specific cache entries to cover in test, with properties
+option(CM_OPTION_BOOL "Testing option()" "OFF")
+set(CM_SET_BOOL "ON" CACHE BOOL "Testing set(CACHE BOOL)")
+mark_as_advanced(CM_SET_BOOL)
+set(CM_SET_FILEPATH "dir1/dir2/empty.txt" CACHE FILEPATH "Testing set(CACHE FILEPATH)")
+set(CM_SET_PATH "dir1/dir2" CACHE PATH "Testing set(CACHE PATH)")
+set_property(CACHE CM_SET_PATH PROPERTY ADVANCED ON)
+set(CM_SET_STRING "test" CACHE STRING "Testing set(CACHE STRING)")
+set(CM_SET_STRINGS "1" CACHE STRING "Testing set(CACHE STRING) with STRINGS")
+set_property(CACHE CM_SET_STRINGS PROPERTY STRINGS "1;2;3;4")
+set(CM_SET_INTERNAL "int" CACHE INTERNAL "Testing set(CACHE INTERNAL)")
+set_property(CACHE CM_SET_INTERNAL PROPERTY VALUE "int2")
+set(CM_SET_TYPE "1" CACHE INTERNAL "Testing set(CACHE INTERNAL) with set_property(TYPE)")
+set_property(CACHE CM_SET_TYPE PROPERTY TYPE "STRING")
+set_property(CACHE CM_SET_TYPE PROPERTY ADVANCED "0")