Merge topic 'fileapi-check-script'

bb704d0390 Tests: Refactor RunCMake.FileAPI check script to support more arguments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11215
This commit is contained in:
Brad King
2025-09-19 14:07:16 +00:00
committed by Kitware Robot
4 changed files with 15 additions and 8 deletions
+4 -2
View File
@@ -108,8 +108,10 @@ function(check_python case prefix)
endif()
file(GLOB index ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/reply/${prefix}-*.json)
execute_process(
COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/${case}-check.py" "${index}" "${CMAKE_CXX_COMPILER_ID}"
"${RunCMake_TEST_BINARY_DIR}"
COMMAND ${Python_EXECUTABLE} "${RunCMake_SOURCE_DIR}/${case}-check.py"
--build-dir "${RunCMake_TEST_BINARY_DIR}"
--reply-index "${index}"
--cxx-compiler-id "${CMAKE_CXX_COMPILER_ID}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
+9 -3
View File
@@ -2,6 +2,7 @@ import sys
import os
import json
import re
import argparse
if sys.version_info[0] >= 3:
unicode = str
@@ -158,8 +159,13 @@ def check_error_re(value, error):
assert is_string(value["error"])
assert re.search(error, value["error"])
reply_index = sys.argv[1]
reply_dir = os.path.dirname(reply_index)
parser = argparse.ArgumentParser()
parser.add_argument("--build-dir")
parser.add_argument("--reply-index")
parser.add_argument("--cxx-compiler-id")
args = parser.parse_args()
with open(reply_index) as f:
reply_dir = os.path.dirname(args.reply_index)
with open(args.reply_index) as f:
index = json.load(f)
+1 -2
View File
@@ -900,7 +900,7 @@ def gen_check_targets(c, g, inSource):
e["compileGroups"] = apple_exe_framework["compileGroups"]
e["link"] = apple_exe_framework["link"]
if cxx_compiler_id in ['Clang', 'AppleClang', 'LCC', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero', 'CrayClang', 'IBMClang'] and g["name"] != "Xcode":
if args.cxx_compiler_id in ['Clang', 'AppleClang', 'LCC', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero', 'CrayClang', 'IBMClang'] and g["name"] != "Xcode":
for e in expected:
if e["name"] == "cxx_exe":
if matches(g["name"], "^(Visual Studio |Ninja Multi-Config)"):
@@ -1087,7 +1087,6 @@ def check_object_codemodel(g, major, minor):
check_object_codemodel_configuration(c, g, major, minor, inSource)
return _check
cxx_compiler_id = sys.argv[2]
assert is_dict(index)
assert sorted(index.keys()) == ["cmake", "objects", "reply"]
check_objects(index["objects"], index["cmake"]["generator"])
@@ -77,7 +77,7 @@ def check_object_toolchain(o, expected):
else:
assert False
with open(os.path.join(sys.argv[3], "toolchain_variables.json")) as f:
with open(os.path.join(args.build_dir, "toolchain_variables.json")) as f:
variables = json.load(f)
assert is_dict(variables)