Skip to content

Commit a0c6a28

Browse files
committed
Fix possible FP in catch_discover_tests tests
1 parent c836314 commit a0c6a28

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

tests/TestScripts/DiscoverTests/VerifyRegistration.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def build_project(sources_dir, output_base_path, catch2_path):
1919
'-S', sources_dir,
2020
f'-DCATCH2_PATH={catch2_path}',
2121
'-DCMAKE_BUILD_TYPE=Debug']
22-
22+
2323
build_cmd = ['cmake',
2424
'--build', build_dir,
2525
'--config', 'Debug']
26-
26+
2727
try:
2828
subprocess.run(config_cmd,
2929
capture_output = True,
@@ -39,9 +39,9 @@ def build_project(sources_dir, output_base_path, catch2_path):
3939
print(f'stderr: {err.stderr}')
4040
print(f'stdout: {err.stdout}')
4141
exit(3)
42-
42+
4343
return build_dir
44-
44+
4545

4646

4747
def get_test_names(build_path):
@@ -104,14 +104,16 @@ def list_ctest_tests(build_path):
104104
catch_test_names = get_test_names(build_path)
105105
ctest_test_names = list_ctest_tests(build_path)
106106

107-
if len(catch_test_names) != len(ctest_test_names):
108-
print("Mismatch between catch test names and ctest test names!")
109-
for catch_test in catch_test_names:
110-
if catch_test not in ctest_test_names:
111-
print(f"Catch2 test '{catch_test}' not found in CTest")
112-
for ctest_test in ctest_test_names:
113-
if ctest_test not in catch_test_names:
114-
print(f"CTest test '{ctest_test}' not found in Catch2")
115-
107+
mismatched = 0
108+
for catch_test in catch_test_names:
109+
if catch_test not in ctest_test_names:
110+
print(f"Catch2 test '{catch_test}' not found in CTest")
111+
mismatched += 1
112+
for ctest_test in ctest_test_names:
113+
if ctest_test not in catch_test_names:
114+
print(f"CTest test '{ctest_test}' not found in Catch2")
115+
mismatched += 1
116+
117+
if mismatched:
118+
print(f"Found {mismatched} mismatched tests catch test names and ctest test commands!")
116119
exit(1)
117-

0 commit comments

Comments
 (0)