File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,14 +66,23 @@ grep -q 'tests[\/][\/]*test_smoke.cpp' compile_commands.json || {
6666 exit 1
6767}
6868if command -v python3 > /dev/null 2>&1 ; then
69- python3 - compile_commands.json " $TMP /devkit/include " << 'PY '
70- import json, os, sys
69+ python3 - compile_commands.json << 'PY '
70+ import json, sys
7171entries = json.load(open(sys.argv[1], encoding="utf-8"))
72- normal = lambda p: p.replace("\\", "/")
72+ normal = lambda p: p.replace("\\", "/").rstrip("/")
7373test = next(e for e in entries if normal(e["file"]).endswith("/tests/test_smoke.cpp"))
7474main = next(e for e in entries if normal(e["file"]).endswith("/src/main.cpp"))
7575args = test["arguments"]
76- assert any(os.path.normpath(sys.argv[2]) in os.path.normpath(a) for a in args), args
76+ # Windows 原生进程与 MSYS 可能用不同根路径表示同一临时目录,
77+ # 因此从 CDB 的 directory 字段推导相邻 devkit 路径。
78+ fixture = normal(test["directory"]).rsplit("/", 1)[0]
79+ expected_include = f"{fixture}/devkit/include".casefold()
80+ include_args = {
81+ normal(a[2:]).casefold()
82+ for a in args
83+ if a[:2].casefold() == "-i"
84+ }
85+ assert expected_include in include_args, args
7786assert any("MCPP_CONFIGURE_ONLY_TEST_FLAG=1" in a for a in args), args
7887assert not any("MCPP_CONFIGURE_ONLY_TEST_FLAG=1" in a for a in main["arguments"]), main
7988PY
You can’t perform that action at this time.
0 commit comments