right xml export of unit test cases for test target

This commit is contained in:
lukas 2020-05-20 19:25:37 +02:00
parent d8c3d4ffb8
commit 998f3ea5e8
2 changed files with 13 additions and 10 deletions

View File

@ -52,7 +52,7 @@ test:
- make build-test - make build-test
artifacts: artifacts:
reports: reports:
junit: build/report.xml junit: build/*.xml
dependencies: dependencies:
- build - build

View File

@ -343,20 +343,23 @@ if (TESTS)
target_link_libraries(${TESTNAME} gtest gtest_main -lpthread -lm dynuiprefresher api ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES}) target_link_libraries(${TESTNAME} gtest gtest_main -lpthread -lm dynuiprefresher api ${CURL_LIBRARIES} ${LIBCONFIG++_LIBRARIES})
# see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it # see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it
gtest_discover_tests(${TESTNAME} gtest_discover_tests(${TESTNAME}
WORKING_DIRECTORY ${PROJECT_DIR} TEST_PREFIX new:
EXTRA_ARGS --gtest_output=xml:report.xml -VV EXTRA_ARGS --gtest_output=xml
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_DIR}" XML_OUTPUT_DIR diri
) )
set_target_properties(${TESTNAME} PROPERTIES FOLDER tests)
add_custom_command(TARGET build-test
POST_BUILD
COMMAND "bin/${item}" --gtest_output=xml:${item}-test-report.xml)
endmacro() endmacro()
add_custom_target(build-test
"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target ${testTargets}
DEPENDS ${PROJECT_NAME}
COMMENT "Testing ${PROJECT_NAME}")
package_add_test(test1 tests/UnitTest.cpp ${SOURCE}) package_add_test(test1 tests/UnitTest.cpp ${SOURCE})
add_custom_target(build-test
"${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target test1
COMMAND ctest --force-new-ctest-process --gtest_output="xml:report.xml"
DEPENDS ${PROJECT_NAME}
COMMENT "Packing ${PROJECT_NAME}")
else () else ()
message(STATUS "GTEST environment not found!") message(STATUS "GTEST environment not found!")
endif () endif ()