From e85c531c5111bf8305d5789d90d151204952ddb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 23 Jul 2020 09:53:18 +0200 Subject: [PATCH] testlib selftest: Don't pass TESTARGS to Catch2 It doesn't understand the arguments we usually pass to testlib. Change-Id: Iea83d1d8c31a510b2bc442cbfc810eac631322e7 Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 8 ++++++-- mkspecs/features/testcase.prf | 2 +- tests/auto/testlib/selftests/CMakeLists.txt | 1 + tests/auto/testlib/selftests/selftest.pro | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 7ad7e6e252..e7af6dba1c 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -4134,7 +4134,7 @@ endfunction() # This function creates a CMake test target with the specified name for use with CTest. function(qt_add_test name) qt_parse_all_arguments(arg "qt_add_test" - "RUN_SERIAL;EXCEPTIONS;GUI;QMLTEST" + "RUN_SERIAL;EXCEPTIONS;GUI;QMLTEST;CATCH" "OUTPUT_DIRECTORY;WORKING_DIRECTORY;TIMEOUT;VERSION" "QML_IMPORTPATH;TESTDATA;${__default_private_args};${__default_public_args}" ${ARGN} ) @@ -4236,7 +4236,11 @@ function(qt_add_test name) set(test_executable "${name}") endif() - add_test(NAME "${name}" COMMAND ${test_executable} ${extra_test_args} -o ${name}.xml,xml -o -,txt WORKING_DIRECTORY "${test_working_dir}") + if (NOT arg_CATCH) + list(APPEND test_outputs "-o" "${name}.xml,xml" "-o" "-,txt") + endif() + + add_test(NAME "${name}" COMMAND ${test_executable} ${extra_test_args} ${test_outputs} WORKING_DIRECTORY "${test_working_dir}") endif() set_tests_properties("${name}" PROPERTIES RUN_SERIAL "${arg_RUN_SERIAL}" LABELS "${label}") if (arg_TIMEOUT) diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index 7e9903d663..83c9d574f4 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -83,7 +83,7 @@ unix { } # Allow for custom arguments to tests -$${type}.commands += $(TESTARGS) +!catch: $${type}.commands += $(TESTARGS) !isEmpty(TESTRUN_CWD):!contains(TESTRUN_CWD, ^\\./?): \ $${type}.commands = $$QMAKE_CD $$shell_path($$TESTRUN_CWD) && $$eval($${type}.commands) diff --git a/tests/auto/testlib/selftests/CMakeLists.txt b/tests/auto/testlib/selftests/CMakeLists.txt index bce68a37d8..7445776561 100644 --- a/tests/auto/testlib/selftests/CMakeLists.txt +++ b/tests/auto/testlib/selftests/CMakeLists.txt @@ -8,6 +8,7 @@ include(../../../../src/testlib/selfcover.cmake) qt_add_test(tst_selftests OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" EXCEPTIONS + CATCH SOURCES ../../../shared/emulationdetector.h tst_selftests.cpp diff --git a/tests/auto/testlib/selftests/selftest.pro b/tests/auto/testlib/selftests/selftest.pro index 4d926d3572..4cb3cf6798 100644 --- a/tests/auto/testlib/selftests/selftest.pro +++ b/tests/auto/testlib/selftests/selftest.pro @@ -1,4 +1,4 @@ -CONFIG += testcase +CONFIG += testcase catch SOURCES += tst_selftests.cpp catch.cpp QT = core testlib-private