summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FileAPI/codemodel-v2-check.py
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-01-14 20:10:49 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-16 20:47:43 (GMT)
commita12d7f70b1b97f74293d9861a1827c88ef46ec39 (patch)
treecc6e798f5ad63468679ef7a3abcb21438173d12a /Tests/RunCMake/FileAPI/codemodel-v2-check.py
parentfd30bd93e6f4334a9cd317a1e5eb8181fffa7a42 (diff)
downloadCMake-a12d7f70b1b97f74293d9861a1827c88ef46ec39.zip
CMake-a12d7f70b1b97f74293d9861a1827c88ef46ec39.tar.gz
CMake-a12d7f70b1b97f74293d9861a1827c88ef46ec39.tar.bz2
fileapi: Add a "directory" object to codemodel-v2
This object will contain more detailed directory-level information. Co-Authored-by: Kyle Edwards <kyle.edwards@kitware.com>
Diffstat (limited to 'Tests/RunCMake/FileAPI/codemodel-v2-check.py')
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index e155037..0e5b3b9 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, 2, check_object_codemodel(g))
+ check_index_object(o[0], "codemodel", 2, 3, check_object_codemodel(g))
def check_backtrace(t, b, backtrace):
btg = t["backtraceGraph"]
@@ -55,7 +55,7 @@ def check_backtraces(t, actual, expected):
def check_directory(c):
def _check(actual, expected):
assert is_dict(actual)
- expected_keys = ["build", "source", "projectIndex"]
+ expected_keys = ["build", "jsonFile", "source", "projectIndex"]
assert matches(actual["build"], expected["build"])
assert is_int(actual["projectIndex"])
@@ -92,6 +92,17 @@ def check_directory(c):
assert sorted(actual.keys()) == sorted(expected_keys)
+ assert is_string(actual["jsonFile"])
+ filepath = os.path.join(reply_dir, actual["jsonFile"])
+ with open(filepath) as f:
+ d = json.load(f)
+
+ assert is_dict(d)
+ assert sorted(d.keys()) == ["paths"]
+
+ assert is_string(d["paths"]["source"], actual["source"])
+ assert is_string(d["paths"]["build"], actual["build"])
+
return _check
def check_backtrace_graph(btg):
@@ -704,6 +715,13 @@ def gen_check_targets(c, g, inSource):
if sys.platform not in ("win32", "cygwin", "msys"):
for e in expected:
e["artifacts"] = filter_list(lambda a: not a["_dllExtra"], e["artifacts"])
+ if e["install"] is not None:
+ e["install"]["destinations"] = filter_list(lambda d: "_dllExtra" not in d or not d["_dllExtra"], e["install"]["destinations"])
+
+ else:
+ for e in expected:
+ if e["install"] is not None:
+ e["install"]["destinations"] = filter_list(lambda d: "_namelink" not in d or not d["_namelink"], e["install"]["destinations"])
if "aix" not in sys.platform:
for e in expected: