Fix possible FP in catch_discover_tests tests

This commit is contained in:
Martin Hořeňovský 2023-06-14 23:31:41 +02:00
parent c8363143e7
commit a0c6a28460
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -19,11 +19,11 @@ def build_project(sources_dir, output_base_path, catch2_path):
'-S', sources_dir, '-S', sources_dir,
f'-DCATCH2_PATH={catch2_path}', f'-DCATCH2_PATH={catch2_path}',
'-DCMAKE_BUILD_TYPE=Debug'] '-DCMAKE_BUILD_TYPE=Debug']
build_cmd = ['cmake', build_cmd = ['cmake',
'--build', build_dir, '--build', build_dir,
'--config', 'Debug'] '--config', 'Debug']
try: try:
subprocess.run(config_cmd, subprocess.run(config_cmd,
capture_output = True, capture_output = True,
@ -39,9 +39,9 @@ def build_project(sources_dir, output_base_path, catch2_path):
print(f'stderr: {err.stderr}') print(f'stderr: {err.stderr}')
print(f'stdout: {err.stdout}') print(f'stdout: {err.stdout}')
exit(3) exit(3)
return build_dir return build_dir
def get_test_names(build_path): def get_test_names(build_path):
@ -104,14 +104,16 @@ if __name__ == '__main__':
catch_test_names = get_test_names(build_path) catch_test_names = get_test_names(build_path)
ctest_test_names = list_ctest_tests(build_path) ctest_test_names = list_ctest_tests(build_path)
if len(catch_test_names) != len(ctest_test_names): mismatched = 0
print("Mismatch between catch test names and ctest test names!") for catch_test in catch_test_names:
for catch_test in catch_test_names: if catch_test not in ctest_test_names:
if catch_test not in ctest_test_names: print(f"Catch2 test '{catch_test}' not found in CTest")
print(f"Catch2 test '{catch_test}' not found in CTest") mismatched += 1
for ctest_test in ctest_test_names: for ctest_test in ctest_test_names:
if ctest_test not in catch_test_names: if ctest_test not in catch_test_names:
print(f"CTest test '{ctest_test}' not found in Catch2") print(f"CTest test '{ctest_test}' not found in Catch2")
mismatched += 1
if mismatched:
print(f"Found {mismatched} mismatched tests catch test names and ctest test commands!")
exit(1) exit(1)