From cbd33cb55757122e2c02356285c335af969dcd43 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 8 Sep 2021 14:04:59 +0200 Subject: Add missing dependencies of tests on their helper programs This ensures that a command such as $ ninja tst_qlocale && ninja tst_qlocale_check will automagically build the syslocaleapp program that the test runs from a subtest. Similar for testlib's selftests and tst_QProcess. As a drive-by, pruned some legacy comments from when CMakeLists.txt files were generated from .pro files. Change-Id: I67691a8175aaef124d4104cf1898193993408bdf Reviewed-by: Alexey Edelev Reviewed-by: Thiago Macieira Reviewed-by: Andrei Golubev --- tests/auto/corelib/io/qfile/CMakeLists.txt | 7 ++-- tests/auto/corelib/io/qlockfile/CMakeLists.txt | 6 ++-- tests/auto/corelib/io/qprocess/CMakeLists.txt | 6 +--- tests/auto/corelib/io/qprocess/test/CMakeLists.txt | 37 ++++++++++++++++------ .../io/qprocess/testForwarding/CMakeLists.txt | 4 +-- .../corelib/kernel/qsharedmemory/CMakeLists.txt | 12 +++---- .../corelib/kernel/qsystemsemaphore/CMakeLists.txt | 7 ++-- .../auto/corelib/plugin/quuid/test/CMakeLists.txt | 16 +++------- .../serialization/qtextstream/test/CMakeLists.txt | 7 ++-- .../auto/corelib/text/qlocale/test/CMakeLists.txt | 8 ++--- .../corelib/thread/qthreadstorage/CMakeLists.txt | 6 ++-- .../qthreadstorage/crashonexit/CMakeLists.txt | 11 ++----- .../tools/qcommandlineparser/CMakeLists.txt | 5 +-- tests/auto/testlib/selftests/CMakeLists.txt | 32 +++---------------- 14 files changed, 71 insertions(+), 93 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/CMakeLists.txt b/tests/auto/corelib/io/qfile/CMakeLists.txt index 4d9a0d2598..d9c148e9db 100644 --- a/tests/auto/corelib/io/qfile/CMakeLists.txt +++ b/tests/auto/corelib/io/qfile/CMakeLists.txt @@ -1,18 +1,14 @@ -# Generated from qfile.pro. - ##################################################################### ## tst_qfile Test: ##################################################################### # Collect test data -# list(APPEND test_data "BLACKLIST") # special case remove list(APPEND test_data "dosfile.txt") list(APPEND test_data "noendofline.txt") list(APPEND test_data "testfile.txt") list(APPEND test_data "testlog.txt") list(APPEND test_data "two.dots.file") list(APPEND test_data "tst_qfile.cpp") -# list(APPEND test_data "Makefile") # special case remove list(APPEND test_data "forCopying.txt") list(APPEND test_data "forRenaming.txt") list(APPEND test_data "resources/file1.ext1") @@ -83,3 +79,6 @@ qt_internal_extend_target(tst_qfile CONDITION WIN32 uuid ) add_subdirectory(stdinprocess) +if(QT_FEATURE_process) + add_dependencies(tst_qfile stdinprocess_helper) +endif() diff --git a/tests/auto/corelib/io/qlockfile/CMakeLists.txt b/tests/auto/corelib/io/qlockfile/CMakeLists.txt index 828aea049e..456ee88bb0 100644 --- a/tests/auto/corelib/io/qlockfile/CMakeLists.txt +++ b/tests/auto/corelib/io/qlockfile/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from qlockfile.pro. - ##################################################################### ## tst_qlockfile Test: ##################################################################### @@ -20,3 +18,7 @@ qt_internal_extend_target(tst_qlockfile CONDITION WIN32 advapi32 ) add_subdirectory(qlockfiletesthelper) + +if(QT_FEATURE_process AND NOT ANDROID) + add_dependencies(tst_qlockfile qlockfile_test_helper) +endif() diff --git a/tests/auto/corelib/io/qprocess/CMakeLists.txt b/tests/auto/corelib/io/qprocess/CMakeLists.txt index 3e91cc98d9..2cd25cd07c 100644 --- a/tests/auto/corelib/io/qprocess/CMakeLists.txt +++ b/tests/auto/corelib/io/qprocess/CMakeLists.txt @@ -1,5 +1,4 @@ -# Generated from qprocess.pro. - +add_subdirectory(test) add_subdirectory(testProcessCrash) add_subdirectory(testProcessEcho) add_subdirectory(testProcessEcho2) @@ -13,18 +12,15 @@ add_subdirectory(testProcessEOF) add_subdirectory(testExitCodes) add_subdirectory(testForwarding) add_subdirectory(testForwardingHelper) -# special case begin if(TARGET Qt::Widgets) add_subdirectory(testGuiProcess) endif() -# special case end add_subdirectory(testDetached) add_subdirectory(fileWriterProcess) add_subdirectory(testSetWorkingDirectory) add_subdirectory(testSoftExit) add_subdirectory(testProcessSpacesArgs) add_subdirectory(testSpaceInName) -add_subdirectory(test) if(WIN32) add_subdirectory(testProcessEchoGui) add_subdirectory(testSetNamedPipeHandleState) diff --git a/tests/auto/corelib/io/qprocess/test/CMakeLists.txt b/tests/auto/corelib/io/qprocess/test/CMakeLists.txt index 086a5663e8..9cd8fee6e8 100644 --- a/tests/auto/corelib/io/qprocess/test/CMakeLists.txt +++ b/tests/auto/corelib/io/qprocess/test/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from test.pro. - ##################################################################### ## tst_qprocess Test: ##################################################################### @@ -13,14 +11,33 @@ qt_internal_add_test(tst_qprocess Qt::Network ) -#### Keys ignored in scope 1:.:.:test.pro:: -# TEST_HELPER_INSTALLS = "../testProcessSpacesArgs/nospace" "../testProcessSpacesArgs/one space" "../testProcessSpacesArgs/two space s" "../test Space In Name/testSpaceInName" - -## Scopes: -##################################################################### +## Build assorted sub-programs called from the test: +add_dependencies(tst_qprocess + testProcessCrash + testProcessEcho + testProcessEcho2 + testProcessEcho3 + testProcessEnvironment + testProcessHang + testProcessNormal + testProcessOutput + testProcessDeadWhileReading + testProcessEOF + testExitCodes + testForwarding + testDetached + fileWriterProcess + testSetWorkingDirectory + testSoftExit + nospace onespace twospaces + testSpaceInName +) +if(TARGET Qt::Widgets) + add_dependencies(tst_qprocess testGuiProcess) +endif() +if(WIN32) + add_dependencies(tst_qprocess testProcessEchoGui testSetNamedPipeHandleState) +endif() #### Keys ignored in scope 2:.:.:test.pro:WIN32: # TESTDATA = "../testBatFiles/*" - -#### Keys ignored in scope 5:.:..:../qprocess.pri:NOT TARGET Qt::Widgets: -# SUBPROGRAMS = "-testGuiProcess" diff --git a/tests/auto/corelib/io/qprocess/testForwarding/CMakeLists.txt b/tests/auto/corelib/io/qprocess/testForwarding/CMakeLists.txt index 914785178c..adadbeca7a 100644 --- a/tests/auto/corelib/io/qprocess/testForwarding/CMakeLists.txt +++ b/tests/auto/corelib/io/qprocess/testForwarding/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from testForwarding.pro. - ##################################################################### ## testForwarding Binary: ##################################################################### @@ -9,3 +7,5 @@ qt_internal_add_executable(testForwarding SOURCES main.cpp ) + +add_dependencies(testForwarding testForwardingHelper) diff --git a/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt index f853f00440..5553dfd56b 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt @@ -1,6 +1,4 @@ -# Generated from qsharedmemory.pro. - -if(QT_FEATURE_sharedmemory) # special case +if(QT_FEATURE_sharedmemory) ##################################################################### ## tst_qsharedmemory Test: ##################################################################### @@ -16,9 +14,11 @@ if(QT_FEATURE_sharedmemory) # special case ##################################################################### qt_internal_extend_target(tst_qsharedmemory CONDITION LINUX - PUBLIC_LIBRARIES - rt + PUBLIC_LIBRARIES + rt ) -# if(QT_FEATURE_sharedmemory) # special case add_subdirectory(producerconsumer) + if(QT_FEATURE_process) + add_dependencies(tst_qsharedmemory producerconsumer_helper) + endif() endif() diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt b/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt index 1c091bd979..d4f1d69593 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from qsystemsemaphore.pro. - ##################################################################### ## tst_qsystemsemaphore Test: ##################################################################### @@ -9,6 +7,7 @@ qt_internal_add_test(tst_qsystemsemaphore tst_qsystemsemaphore.cpp ) -## Scopes: -##################################################################### add_subdirectory(acquirerelease) +if(QT_FEATURE_process) + add_dependencies(tst_qsystemsemaphore acquirerelease_helper) +endif() diff --git a/tests/auto/corelib/plugin/quuid/test/CMakeLists.txt b/tests/auto/corelib/plugin/quuid/test/CMakeLists.txt index 51712cfc05..233a410db6 100644 --- a/tests/auto/corelib/plugin/quuid/test/CMakeLists.txt +++ b/tests/auto/corelib/plugin/quuid/test/CMakeLists.txt @@ -1,17 +1,14 @@ -# Generated from test.pro. - ##################################################################### ## tst_quuid Test: ##################################################################### qt_internal_add_test(tst_quuid - OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" SOURCES ../tst_quuid.cpp ) ## Scopes: -##################################################################### qt_internal_extend_target(tst_quuid CONDITION APPLE SOURCES @@ -20,11 +17,6 @@ qt_internal_extend_target(tst_quuid CONDITION APPLE ${FWFoundation} ) -#### Keys ignored in scope 4:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug): -# DESTDIR = "../debug" - -#### Keys ignored in scope 5:.:.:test.pro:else: -# DESTDIR = "../release" - -#### Keys ignored in scope 6:.:.:test.pro:else: -# DESTDIR = ".." +if(QT_FEATURE_process AND NOT ANDROID) + add_dependencies(tst_quuid testProcessUniqueness) +endif() diff --git a/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt b/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt index 2dccf09ac4..b9094287f7 100644 --- a/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt +++ b/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from test.pro. - ##################################################################### ## tst_qtextstream Test: ##################################################################### @@ -39,9 +37,12 @@ qt_internal_add_resource(tst_qtextstream "qtextstream" ## Scopes: -##################################################################### qt_internal_extend_target(tst_qtextstream CONDITION builtin_testdata DEFINES BUILTIN_TESTDATA ) + +if(QT_FEATURE_process) + add_dependencies(tst_qtextstream stdinProcess readAllStdinProcess readLineStdinProcess) +endif() diff --git a/tests/auto/corelib/text/qlocale/test/CMakeLists.txt b/tests/auto/corelib/text/qlocale/test/CMakeLists.txt index 863252cf77..faf90c0a8e 100644 --- a/tests/auto/corelib/text/qlocale/test/CMakeLists.txt +++ b/tests/auto/corelib/text/qlocale/test/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from test.pro. - ##################################################################### ## tst_qlocale Test: ##################################################################### @@ -25,5 +23,7 @@ qt_internal_extend_target(tst_qlocale CONDITION NOT QT_FEATURE_doubleconversion QT_NO_DOUBLECONVERSION ) -#### Keys ignored in scope 7:.:.:test.pro:NOT ANDROID: -# TEST_HELPER_INSTALLS = "../syslocaleapp/syslocaleapp" +## Depends on ../syslocaleapp +if(QT_FEATURE_process) + add_dependencies(tst_qlocale syslocaleapp) +endif() diff --git a/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt index 1340b30388..26a691e8ca 100644 --- a/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt +++ b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt @@ -1,6 +1,3 @@ -# special case skip regeneration -# Generated from qthreadstorage.pro. - ##################################################################### ## tst_qthreadstorage Test: ##################################################################### @@ -15,4 +12,7 @@ qt_internal_add_test(tst_qthreadstorage if(NOT ANDROID) add_subdirectory(crashonexit) + if(QT_FEATURE_process) + add_dependencies(tst_qthreadstorage crashOnExit_helper) + endif() endif() diff --git a/tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt b/tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt index a6de9678c0..c76dbda738 100644 --- a/tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt +++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from crashonexit.pro. - ##################################################################### ## crashonexit Binary: ##################################################################### -qt_internal_add_executable(crashOnExit_helper # special case - OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." # special case - INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qthreadstorage/crashOnExit_helper" # special case +qt_internal_add_executable(crashOnExit_helper + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." + INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qthreadstorage/crashOnExit_helper" SOURCES crashOnExit.cpp ) - -## Scopes: -##################################################################### diff --git a/tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt b/tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt index 128b8cfd73..f25766164a 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt +++ b/tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from qcommandlineparser.pro. - ##################################################################### ## tst_qcommandlineparser Test: ##################################################################### @@ -9,3 +7,6 @@ qt_internal_add_test(tst_qcommandlineparser tst_qcommandlineparser.cpp ) add_subdirectory(testhelper) +if(QT_FEATURE_process AND NOT ANDROID) + add_dependencies(tst_qcommandlineparser qcommandlineparser_test_helper) +endif() diff --git a/tests/auto/testlib/selftests/CMakeLists.txt b/tests/auto/testlib/selftests/CMakeLists.txt index 5ff460546d..2dd26211f2 100644 --- a/tests/auto/testlib/selftests/CMakeLists.txt +++ b/tests/auto/testlib/selftests/CMakeLists.txt @@ -1,5 +1,4 @@ # The whole file is written manually. -# special case skip regeneration include(../../../../src/testlib/selfcover.cmake) @@ -14,7 +13,6 @@ qt_internal_add_test(tst_selftests catch.cpp PUBLIC_LIBRARIES Qt::TestPrivate - # special case begin # These lines need to be commented out as they need to be enabled # COMPILE_OPTIONS # conditionally @@ -24,7 +22,6 @@ qt_internal_add_test(tst_selftests # --cs-mcdc # LINK_OPTIONS # "$$COVERAGE_OPTIONS" - # special case end ) file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "expected_*") @@ -41,26 +38,15 @@ qt_internal_add_resource(tst_selftests "qmake_expected_files" PREFIX "/" BASE - "${CMAKE_CURRENT_SOURCE_DIR}" # special case + "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${qmake_expected_files_resource_files} ) - -## Scopes: -##################################################################### - -#### Keys ignored in scope 5:.:.:test.pro:NOT ANDROID AND for(file,SUBPROGRAMS): -# TEST_HELPER_INSTALLS = "../$${file}/$${file}" - -#### Keys ignored in scope 7:.:..:../selftests.pri:TARGET Qt::Gui: -# SUBPROGRAMS = "keyboard" "mouse" - qt_internal_apply_testlib_coverage_options(tst_selftests) # ------------- Sub tests ------------- -# special case begin set(subprograms assert badxml @@ -131,6 +117,9 @@ add_definitions(-DQT_MESSAGELOGCONTEXT) foreach(subprogram IN LISTS subprograms) add_subdirectory(${subprogram}) + if(QT_FEATURE_process) + add_dependencies(tst_selftests ${subprogram}) + endif() endforeach() list(JOIN subprograms " " subprograms) @@ -138,16 +127,3 @@ qt_internal_extend_target(tst_selftests DEFINES $<$:SUBPROGRAMS=${subprograms}> ) -# special case end - -#### Keys ignored in scope 1:.:.:test.pro:: -# CONFIG = "testcase" -# expected_files.base = "$$PWD/.." -# expected_files.files = "$$files$$PWD/../expected_*" - -## Scopes: -##################################################################### - -#### Keys ignored in scope 5:.:.:test.pro:NOT ANDROID AND for(file,SUBPROGRAMS): -# TEST_HELPER_INSTALLS = "../$${file}/$${file}" -# special case end -- cgit v1.2.3