Skip to content

Commit

Permalink
Don't use empty match test files
Browse files Browse the repository at this point in the history
This patch removes any empty ".match" files, and instructs ctest to
run the tests verbatim if there is no match file available.

As well as providing more useful output, this also handles the case
where the test startup and/or teardown causes the test runner to fail.
Previously, this would be ignored (as it produced no output).

I also modified cts_exe.py so that it uses the same parameters as
ctest, so the same command invocation could be used for both.
  • Loading branch information
RossBrunton committed Sep 26, 2024
1 parent 6d9c97f commit acb9ca3
Show file tree
Hide file tree
Showing 48 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions test/conformance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ function(add_test_adapter name adapter)
set(TEST_NAME ${name}-${adapter}${EXTRA_NAME})

set(TEST_COMMAND
"${PROJECT_BINARY_DIR}/bin/${TEST_TARGET_NAME} --test_devices_count=${UR_TEST_DEVICES_COUNT} --test_platforms_count=${UR_TEST_PLATFORMS_COUNT}"
"${PROJECT_BINARY_DIR}/bin/${TEST_TARGET_NAME} --devices_count=${UR_TEST_DEVICES_COUNT} --platforms_count=${UR_TEST_PLATFORMS_COUNT}"
)
set(MATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${name}_${adapter}${EXTRA_NAME}.match")

if(UR_CONFORMANCE_ENABLE_MATCH_FILES)
if(${UR_CONFORMANCE_ENABLE_MATCH_FILES} AND EXISTS ${MATCH_FILE})
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_COMMAND}
-D TEST_FILE=${Python3_EXECUTABLE}
-D TEST_ARGS="${UR_CONFORMANCE_TEST_DIR}/cts_exe.py --test_command ${TEST_COMMAND}"
-D MODE=stdout
-D MATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${name}_${adapter}${EXTRA_NAME}.match
-D MATCH_FILE=${MATCH_FILE}
-P ${PROJECT_SOURCE_DIR}/cmake/match.cmake
DEPENDS ${TEST_TARGET_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
8 changes: 4 additions & 4 deletions test/conformance/cts_exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

parser = ArgumentParser()
parser.add_argument("--test_command", help="Ctest test case")
parser.add_argument("--test_devices_count", type=str, help="Number of devices on which tests will be run")
parser.add_argument("--test_platforms_count", type=str, help="Number of platforms on which tests will be run")
parser.add_argument("--devices_count", type=str, help="Number of devices on which tests will be run")
parser.add_argument("--platforms_count", type=str, help="Number of platforms on which tests will be run")
args = parser.parse_args()

result = subprocess.Popen([args.test_command, '--gtest_brief=1', # nosec B603
f'--devices_count={args.test_devices_count}',
f'--platforms_count={args.test_platforms_count}'],
f'--devices_count={args.devices_count}',
f'--platforms_count={args.platforms_count}'],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)

pat = re.compile(r'\[( )*FAILED( )*\]')
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit acb9ca3

Please sign in to comment.