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 <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
Edward Welbourne 2021-09-08 14:04:59 +02:00
parent fb3549fc47
commit cbd33cb557
14 changed files with 71 additions and 93 deletions
tests/auto
corelib
io
kernel
qsharedmemory
qsystemsemaphore
plugin/quuid/test
serialization/qtextstream/test
text/qlocale/test
thread/qthreadstorage
tools/qcommandlineparser
testlib/selftests

View File

@ -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()

View File

@ -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()

View File

@ -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)

View File

@ -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:<TRUE>:
# 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"

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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:
#####################################################################

View File

@ -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()

View File

@ -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
$<$<COMPILE_LANGUAGE:CXX>:SUBPROGRAMS=${subprograms}>
)
# special case end
#### Keys ignored in scope 1:.:.:test.pro:<TRUE>:
# 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