Add a unit test for testing Qt in its install location.
The Qt CI system runs the unit tests after installation, but with the qmake in the build directory. This means that the installed content is not unit tested. Add an additional cmake unit test to test the files in the install location. The new test is marked insignificant for now until the true effect on the CI system is known. Task-number: QTBUG-27315 Change-Id: If9f12e88cfc741946cfabc25dbf789a11a2af4b8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
5782fc2fa4
commit
efb592503a
@ -1,96 +1,9 @@
|
||||
|
||||
win32 {
|
||||
CMAKE_VERSION = $$system(cmake --version 2>NUL)
|
||||
} else {
|
||||
CMAKE_VERSION = $$system(cmake --version 2>/dev/null)
|
||||
}
|
||||
|
||||
|
||||
check.commands =
|
||||
isEmpty(CMAKE_VERSION) {
|
||||
message("cmake executable not found. Not running CMake unit tests")
|
||||
} else {
|
||||
CTEST_VERSION = $$system(ctest --version)
|
||||
isEmpty(CTEST_VERSION) {
|
||||
message("ctest executable not found. Not running CMake unit tests")
|
||||
} else {
|
||||
CMAKE_VERSION = $$last(CMAKE_VERSION)
|
||||
CMAKE_VERSION_MAJOR = $$section(CMAKE_VERSION, ., 0, 0)
|
||||
CMAKE_VERSION_MINOR = $$section(CMAKE_VERSION, ., 1, 1)
|
||||
CMAKE_VERSION_PATCH = $$section(CMAKE_VERSION, ., 2, 2)
|
||||
# CMake can report versions like 2.8.11-rc1, so strip off the rc part.
|
||||
CMAKE_VERSION_PATCH ~= s,-.*,,
|
||||
|
||||
VERSION_OK =
|
||||
greaterThan(CMAKE_VERSION_MAJOR, 2) {
|
||||
VERSION_OK = 1
|
||||
} else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 8) {
|
||||
VERSION_OK = 1
|
||||
} else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 7):greaterThan(CMAKE_VERSION_PATCH, 2) {
|
||||
VERSION_OK = 1
|
||||
}
|
||||
|
||||
isEmpty(VERSION_OK) {
|
||||
message("cmake $$CMAKE_VERSION is too old for this test.")
|
||||
} else {
|
||||
load(cmake_functions)
|
||||
|
||||
CMAKE_BUILD_TYPE = Debug
|
||||
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
|
||||
win32-g++*:isEmpty(CROSS_COMPILE):CMAKE_GENERATOR = -G \"MinGW Makefiles\"
|
||||
win32:equals(QT_ARCH, x86_64) {
|
||||
win32-msvc2010:CMAKE_GENERATOR = -G \"Visual Studio 10 Win64\"
|
||||
win32-msvc2012:CMAKE_GENERATOR = -G \"Visual Studio 11 Win64\"
|
||||
}
|
||||
|
||||
BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP)
|
||||
CMAKE_TEST_LOCATION = $$_PRO_FILE_PWD_
|
||||
|
||||
for(d, $$list($$split($$list($$[QMAKE_MKSPECS]), $$DIRLIST_SEPARATOR))) {
|
||||
CMAKE_PREFIX_PATH *= $$dirname(d)
|
||||
}
|
||||
CMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\"
|
||||
|
||||
!qtHaveModule(widgets): CMAKE_MODULE_DEFINES += -DNO_WIDGETS=True
|
||||
!qtHaveModule(dbus): CMAKE_MODULE_DEFINES += -DNO_DBUS=True
|
||||
|
||||
dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.")
|
||||
dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST
|
||||
dependentmodules = $$cmakeModuleList($$dependentmodules)
|
||||
|
||||
contains(QT_CONFIG, angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
|
||||
!contains(QT_CONFIG, egl): CMAKE_GL_DEFINES += -DNO_EGL=True
|
||||
|
||||
CMAKE_MODULE_VERSIONS =
|
||||
CMAKE_MODULES_UNDER_TEST =
|
||||
for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
|
||||
CMAKE_NAME = $$cmakeModuleName($$MODULE_UNDER_TEST)
|
||||
CMAKE_MODULE_VERSIONS += \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MAJOR_VERSION) \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MINOR_VERSION) \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.PATCH_VERSION)
|
||||
CMAKE_MODULES_UNDER_TEST += $$CMAKE_NAME
|
||||
}
|
||||
CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
|
||||
|
||||
check.commands = \
|
||||
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
|
||||
cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=1 \
|
||||
$$CMAKE_MODULE_DEFINES \
|
||||
$$CMAKE_GL_DEFINES \
|
||||
-DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} \
|
||||
-DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH \
|
||||
-DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" \
|
||||
$${CMAKE_MODULE_VERSIONS} \
|
||||
-DCMAKE_MODULES_UNDER_TEST=\"$$CMAKE_MODULES_UNDER_TEST\" && \
|
||||
$(TESTRUNNER) ctest --output-on-failure
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
insignificant_test:!isEmpty(check.commands) {
|
||||
check.commands = -$${check.commands}
|
||||
}
|
||||
|
||||
QMAKE_EXTRA_TARGETS *= check
|
||||
include(ctest_testcase_common.prf)
|
||||
|
91
mkspecs/features/ctest_testcase_common.prf
Normal file
91
mkspecs/features/ctest_testcase_common.prf
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
win32 {
|
||||
CMAKE_VERSION = $$system(cmake --version 2>NUL)
|
||||
} else {
|
||||
CMAKE_VERSION = $$system(cmake --version 2>/dev/null)
|
||||
}
|
||||
|
||||
|
||||
check.commands =
|
||||
isEmpty(CMAKE_VERSION) {
|
||||
message("cmake executable not found. Not running CMake unit tests")
|
||||
} else {
|
||||
CTEST_VERSION = $$system(ctest --version)
|
||||
isEmpty(CTEST_VERSION) {
|
||||
message("ctest executable not found. Not running CMake unit tests")
|
||||
} else {
|
||||
CMAKE_VERSION = $$last(CMAKE_VERSION)
|
||||
CMAKE_VERSION_MAJOR = $$section(CMAKE_VERSION, ., 0, 0)
|
||||
CMAKE_VERSION_MINOR = $$section(CMAKE_VERSION, ., 1, 1)
|
||||
CMAKE_VERSION_PATCH = $$section(CMAKE_VERSION, ., 2, 2)
|
||||
# CMake can report versions like 2.8.11-rc1, so strip off the rc part.
|
||||
CMAKE_VERSION_PATCH ~= s,-.*,,
|
||||
|
||||
VERSION_OK =
|
||||
greaterThan(CMAKE_VERSION_MAJOR, 2) {
|
||||
VERSION_OK = 1
|
||||
} else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 8) {
|
||||
VERSION_OK = 1
|
||||
} else:greaterThan(CMAKE_VERSION_MAJOR, 1):greaterThan(CMAKE_VERSION_MINOR, 7):greaterThan(CMAKE_VERSION_PATCH, 2) {
|
||||
VERSION_OK = 1
|
||||
}
|
||||
|
||||
isEmpty(VERSION_OK) {
|
||||
message("cmake $$CMAKE_VERSION is too old for this test.")
|
||||
} else {
|
||||
load(cmake_functions)
|
||||
|
||||
CMAKE_BUILD_TYPE = Debug
|
||||
CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release
|
||||
win32-g++*:isEmpty(CROSS_COMPILE):CMAKE_GENERATOR = -G \"MinGW Makefiles\"
|
||||
win32:equals(QT_ARCH, x86_64) {
|
||||
win32-msvc2010:CMAKE_GENERATOR = -G \"Visual Studio 10 Win64\"
|
||||
win32-msvc2012:CMAKE_GENERATOR = -G \"Visual Studio 11 Win64\"
|
||||
}
|
||||
|
||||
BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP)
|
||||
|
||||
!qtHaveModule(widgets): CMAKE_MODULE_DEFINES += -DNO_WIDGETS=True
|
||||
!qtHaveModule(dbus): CMAKE_MODULE_DEFINES += -DNO_DBUS=True
|
||||
|
||||
dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.")
|
||||
dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST
|
||||
dependentmodules = $$cmakeModuleList($$dependentmodules)
|
||||
|
||||
contains(QT_CONFIG, angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
|
||||
!contains(QT_CONFIG, egl): CMAKE_GL_DEFINES += -DNO_EGL=True
|
||||
|
||||
CMAKE_MODULE_VERSIONS =
|
||||
CMAKE_MODULES_UNDER_TEST =
|
||||
for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
|
||||
CMAKE_NAME = $$cmakeModuleName($$MODULE_UNDER_TEST)
|
||||
CMAKE_MODULE_VERSIONS += \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MAJOR_VERSION) \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MINOR_VERSION) \
|
||||
-DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.PATCH_VERSION)
|
||||
CMAKE_MODULES_UNDER_TEST += $$CMAKE_NAME
|
||||
}
|
||||
CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
|
||||
|
||||
check.commands = \
|
||||
$(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \
|
||||
cmake $$CMAKE_TEST_LOCATION $$CMAKE_GENERATOR \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=1 \
|
||||
$$CMAKE_MODULE_DEFINES \
|
||||
$$CMAKE_GL_DEFINES \
|
||||
-DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} \
|
||||
-DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH \
|
||||
-DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" \
|
||||
$${CMAKE_MODULE_VERSIONS} \
|
||||
-DCMAKE_MODULES_UNDER_TEST=\"$$CMAKE_MODULES_UNDER_TEST\" && \
|
||||
$(TESTRUNNER) ctest --output-on-failure
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
insignificant_test:!isEmpty(check.commands) {
|
||||
check.commands = -$${check.commands}
|
||||
}
|
||||
|
||||
QMAKE_EXTRA_TARGETS *= check
|
8
mkspecs/features/ctest_testcase_installed.prf
Normal file
8
mkspecs/features/ctest_testcase_installed.prf
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
CMAKE_TEST_LOCATION = $$_PRO_FILE_PWD_/../cmake
|
||||
|
||||
CMAKE_PREFIX_PATH = $$[QT_INSTALL_PREFIX]
|
||||
|
||||
CONFIG += insignificant_test
|
||||
|
||||
include(ctest_testcase_common.prf)
|
@ -14,7 +14,8 @@ SUBDIRS += \
|
||||
other \
|
||||
widgets \
|
||||
printsupport \
|
||||
cmake
|
||||
cmake \
|
||||
installed_cmake
|
||||
|
||||
wince*: SUBDIRS -= printsupport
|
||||
cross_compile: SUBDIRS -= tools
|
||||
|
5
tests/auto/installed_cmake/installed_cmake.pro
Normal file
5
tests/auto/installed_cmake/installed_cmake.pro
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
include(../cmake/cmake.pro)
|
||||
|
||||
CONFIG -= ctest_testcase
|
||||
CONFIG += ctest_testcase_installed
|
Loading…
Reference in New Issue
Block a user