summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FileAPI/codemodel-v2-check.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/FileAPI/codemodel-v2-check.py')
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index b7623de..fda18b5 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -12,7 +12,7 @@ def read_codemodel_json_data(filename):
def check_objects(o, g):
assert is_list(o)
assert len(o) == 1
- check_index_object(o[0], "codemodel", 2, 4, check_object_codemodel(g))
+ check_index_object(o[0], "codemodel", 2, 5, check_object_codemodel(g))
def check_backtrace(t, b, backtrace):
btg = t["backtraceGraph"]
@@ -291,10 +291,30 @@ def check_target(c):
assert matches(obj["paths"]["build"], expected["build"])
assert matches(obj["paths"]["source"], expected["source"])
+ def check_file_set(actual, expected):
+ assert is_dict(actual)
+ expected_keys = ["name", "type", "visibility", "baseDirectories"]
+
+ assert is_string(actual["name"], expected["name"])
+ assert is_string(actual["type"], expected["type"])
+ assert is_string(actual["visibility"], expected["visibility"])
+
+ check_list_match(lambda a, e: matches(a, e), actual["baseDirectories"],
+ expected["baseDirectories"],
+ check_exception=lambda a, e: "File set base directory (check): %s" % a,
+ missing_exception=lambda e: "File set base directory (missing): %s" % e,
+ extra_exception=lambda a: "File set base directory (extra): %s" % a)
+
+ assert sorted(actual.keys()) == sorted(expected_keys)
+
def check_source(actual, expected):
assert is_dict(actual)
expected_keys = ["path"]
+ if expected["fileSetName"] is not None:
+ expected_keys.append("fileSetIndex")
+ assert is_string(obj["fileSets"][actual["fileSetIndex"]]["name"], expected["fileSetName"])
+
if expected["compileGroupLanguage"] is not None:
expected_keys.append("compileGroupIndex")
assert is_string(obj["compileGroups"][actual["compileGroupIndex"]]["language"], expected["compileGroupLanguage"])
@@ -313,6 +333,14 @@ def check_target(c):
assert sorted(actual.keys()) == sorted(expected_keys)
+ if expected["fileSets"] is not None:
+ expected_keys.append("fileSets")
+ check_list_match(lambda a, e: matches(a["name"], e["name"]), obj["fileSets"],
+ expected["fileSets"], check=check_file_set,
+ check_exception=lambda a, e: "File set: %s" % a["name"],
+ missing_exception=lambda e: "File set: %s" % e["name"],
+ extra_exception=lambda a: "File set: %s" % a["name"])
+
check_list_match(lambda a, e: matches(a["path"], e["path"]), obj["sources"],
expected["sources"], check=check_source,
check_exception=lambda a, e: "Source file: %s" % a["path"],
@@ -824,6 +852,7 @@ def gen_check_targets(c, g, inSource):
{
"path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/CMakeFiles/([0-9a-f]+/)?generate\\.stamp\\.rule$",
"isGenerated": True,
+ "fileSetName": None,
"sourceGroupName": "CMake Rules",
"compileGroupLanguage": None,
"backtrace": [