diff --git a/cmake/modules/TestSuite.cmake b/cmake/modules/TestSuite.cmake --- a/cmake/modules/TestSuite.cmake +++ b/cmake/modules/TestSuite.cmake @@ -2,10 +2,11 @@ option(ENABLE_JUNIT_REPORT "Enable Junit report generation for targets that support it" OFF) +set(JUNIT_REPORT_DIRECTORY "${CMAKE_BINARY_DIR}/test/junit") set_property( DIRECTORY "${CMAKE_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_CLEAN_FILES - "${CMAKE_BINARY_DIR}/test/junit" + "${JUNIT_REPORT_DIRECTORY}" "${CMAKE_BINARY_DIR}/test/tmp" ) @@ -20,6 +21,7 @@ add_custom_target(${TARGET} ${ARG_CUSTOM_TARGET_ARGS} + COMMAND ${CMAKE_COMMAND} -E make_directory "${JUNIT_REPORT_DIRECTORY}" COMMAND ${CMAKE_COMMAND} -E env ${TEST_ENVIRONMENT} ${ARG_TEST_COMMAND} ) endfunction() @@ -85,7 +87,7 @@ COMMAND_EXPAND_LISTS COMMAND "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/cmake/utils/junit-reports-merge.py" - "${CMAKE_BINARY_DIR}/test/junit" + "${JUNIT_REPORT_DIRECTORY}" "${CMAKE_BINARY_DIR}/test/tmp" "${SUITE}" "${NAME}" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -49,14 +49,21 @@ list(APPEND _TEST_TARGET_DEPENDS bitcoin-wallet) endif() -macro(add_functional_test_check TARGET COMMENT) +function(add_functional_test_check TARGET DESCRIPTION) + if(ENABLE_JUNIT_REPORT) + string(REGEX REPLACE " " "_" JUNIT_FILE "${DESCRIPTION}.xml") + set(JUNIT_OUTPUT "--junitoutput=${JUNIT_REPORT_DIRECTORY}/${JUNIT_FILE}") + endif() + add_test_custom_target(${TARGET} TEST_COMMAND "${Python_EXECUTABLE}" ./functional/test_runner.py + "--testsuitename=Bitcoin ABC ${DESCRIPTION}" + ${JUNIT_OUTPUT} ${ARGN} CUSTOM_TARGET_ARGS - COMMENT "${COMMENT}" + COMMENT "Running ${DESCRIPTION}" DEPENDS bitcoind ${_TEST_TARGET_DEPENDS} @@ -66,33 +73,29 @@ ) add_custom_target_coverage(${TARGET}) -endmacro() +endfunction() add_functional_test_check(check-functional - "Run the functional tests" + "functional tests" ) add_dependencies(check-all check-functional) add_functional_test_check(check-functional-extended - "Run the extended functional tests" + "extended functional tests" --extended ) add_dependencies(check-extended check-functional-extended) -set(TEST_SUITE_NAME_UPGRADE_ACTIVATED "Bitcoin ABC functional tests with the next upgrade activated") - add_functional_test_check(check-functional-upgrade-activated - "Run the functional tests with the upgrade activated" + "functional tests with the next upgrade activated" --with-axionactivation - -n "${TEST_SUITE_NAME_UPGRADE_ACTIVATED}" ) add_dependencies(check-upgrade-activated check-functional-upgrade-activated) add_functional_test_check(check-functional-upgrade-activated-extended - "Run the extended functional tests with the upgrade activated" + "extended functional tests with the next upgrade activated" --extended --with-axionactivation - -n "${TEST_SUITE_NAME_UPGRADE_ACTIVATED}" ) add_dependencies(check-upgrade-activated-extended check-functional-upgrade-activated-extended)