qt5base-lts/tests/auto/testlib/selftests/CMakeLists.txt
Ivan Solovev 343e0ff485 Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}()
[ChangeLog][QTestLib] Add QCOMPARE_{EQ,NE,LT,LE,GT,GE}()
macros. These new macros behave similarly to QVERIFY(a op b),
where 'op' is ==, !=, <, <=, >, >= respectively, but print
a formatted error message with argument values in case of failure.
The formatting is done lazily, which means that the strings will
be generated only when the comparison fails.

Also add a new test for tst_selftest and generate expected output
for it.

Fixes: QTBUG-98873
Task-number: QTBUG-98874
Change-Id: Ic8074798901d7a469b1f58d5cd28bbf49a3da1db
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-06-03 22:37:50 +02:00

121 lines
2.5 KiB
CMake

# The whole file is written manually.
include(../../../../src/testlib/selfcover.cmake)
# ------------- Test runner -------------
# Resources:
file(GLOB qmake_expected_files_resource_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "expected_*")
foreach(file IN LISTS qmake_expected_files_resource_files)
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
endforeach()
qt_internal_add_test(tst_selftests
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
EXCEPTIONS
CATCH
SOURCES
tst_selftests.cpp
catch.cpp
PUBLIC_LIBRARIES
Qt::TestPrivate
TESTDATA ${qmake_expected_files_resource_files}
BUILTIN_TESTDATA
# These lines need to be commented out as they need to be enabled
# COMPILE_OPTIONS
# conditionally
# --cs-exclude-file-abs-wildcard=${QT_SOURCE_TREE}/*
# --cs-include-file-abs-wildcard=*/src/testlib/*
# --cs-mcc
# --cs-mcdc
# LINK_OPTIONS
# "$$COVERAGE_OPTIONS"
)
qt_internal_apply_testlib_coverage_options(tst_selftests)
# ------------- Sub tests -------------
set(subprograms
assert
badxml
benchlibcallgrind
benchlibcounting
benchlibeventcounter
benchliboptions
benchlibtickcounter
benchlibwalltime
blacklisted
cmptest
commandlinedata
counting
crashes
datatable
datetime
deleteLater
deleteLater_noApp
differentexec
exceptionthrow
expectfail
extendedcompare
failcleanup
faildatatype
failfetchtype
failinit
failinitdata
fetchbogus
findtestdata
float
globaldata
junit
longstring
maxwarnings
multiexec
pass
pairdiagnostics
printdatatags
printdatatagswithglobaltags
qexecstringlist
silent
signaldumper
singleskip
skip
skipcleanup
skipinit
skipinitdata
sleep
strcmp
subtest
testlib
tuplediagnostics
verbose1
verbose2
verifyexceptionthrown
warnings
watchdog
)
if(TARGET Qt::Gui)
list(APPEND subprograms
keyboard
mouse
)
endif()
# Ensure uniform location info between release and debug builds
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)
qt_internal_extend_target(tst_selftests
DEFINES
$<$<COMPILE_LANGUAGE:CXX>:SUBPROGRAMS=${subprograms}>
)