diff --git a/awlib/cmake/aw-common.cmake b/awlib/cmake/aw-common.cmake index 559cb73f..236a9fb0 100644 --- a/awlib/cmake/aw-common.cmake +++ b/awlib/cmake/aw-common.cmake @@ -99,9 +99,15 @@ function(aw_add_test NAME) set(multivalue SOURCES PARAMS) cmake_parse_arguments(PARSE_ARGV 1 ARG "${options}" "${arguments}" "${multivalue}") + if (AW_OUTPUT_JUNIT) + set(ADDITIONAL_PARAMS) + else() + set(ADDITIONAL_PARAMS "--output-format=junit") + endif() + add_executable(${NAME} ${ARG_SOURCES}) add_test( NAME ${NAME} - COMMAND ${NAME} ${ARG_PARAMS} + COMMAND ${NAME} ${ARG_PARAMS} ${ADDITIONAL_PARAMS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endfunction() diff --git a/test/include/aw/test/main.h b/test/include/aw/test/main.h index ba44c514..e888cdcd 100644 --- a/test/include/aw/test/main.h +++ b/test/include/aw/test/main.h @@ -72,7 +72,7 @@ int main(int n_param, char** parameters) report* _report = config.use_junit ? (report*)&junit : (report*)&classic; - int fail_count = aw::test::registry::run(_report); + int fail_count = aw::test::registry::run(_report); return config.no_exitcode ? 0 : fail_count; } diff --git a/test/include/aw/test/report_impl.h b/test/include/aw/test/report_impl.h index 53367800..58486690 100644 --- a/test/include/aw/test/report_impl.h +++ b/test/include/aw/test/report_impl.h @@ -102,9 +102,10 @@ class report_junit : public report { this->total = test_count; } - void end_suite() + void end_suite() override { int skipped = total - succeeded - failed; + println(""); print(""); for (const auto& test_case : test_cases) @@ -126,6 +127,7 @@ class report_junit : public report { } } println(""); + println(""); }