summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6CTestMacros.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Replace BUILD_OPTIONS_LIST variable by the getter functionAlexey Edelev2021-12-021-54/+70
| | | | | | | | | Encapsulate configuration options in a function and use it instead of a globally defined variable. Pick-to: 6.2 Change-Id: I5c69c207788fe069fdd046b68a6bc58aa16e71b4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Bump almost all cmake_minimum_required calls to 3.16Alexandru Croitor2021-09-221-2/+2
| | | | | | | | | | | | Needed for subsequent change that will check and error out if the version is lower than 3.16. We do that to ensure all policies introduced by CMake up to version 3.16 have their behavior set to NEW. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: Ieaf82c10987dd797d86a3fd4a986a67e72de486a Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Build a subset of tests when targeting iOS in the CIAlexandru Croitor2021-08-261-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | Add infrastructure to build cmake auto tests in the CI when targeting iOS. Currently the are only CI instructions for qtbase. More work is needed to make it work for other repos. With this change, we will build a single Widgets application targeting the iOS simulator. We can't target the device SDK in the CI because signing fails due to a missing signing certificate and provisioning profile. The Coin instructions will now set a QT_BUILD_ENVIRONMENT=ci env var whose value will be checked in _qt_internal_test_expect_pass, to ensure we build for the simulator SDK when using a universal Qt. Without this, xcodebuild will try to build with the device SDK and fail to build the project. Pick-to: 6.2 Task-number: QTBUG-95839 Change-Id: Ib39c9527b107b2004746ccbdc9d9d1d658f88c76 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Make _qt_internal_test_expect_pass more configurableAlexandru Croitor2021-08-261-6/+84
| | | | | | | | | | | | | | | | | | Introduce new options: NO_CLEAN_STEP, NO_BUILD_PROJECT_ARG, GENERATOR, MAKE_PROGRAM, BUILD_TYPE. If cache or env var QT_CMAKE_TESTS_ADDITIONAL_CONFIGURE_OPTIONS is provided, the value is interpreted as a list of additional configure arguments to pass to the built project. Also skip adding a test command if there is no BINARY or BINARY_ARGS option provided. Pick-to: 6.2 Change-Id: I3a1d82b41a734dcd3f473e59cc64efd00363e49b Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix indentation in _qt_internal_test_expect_passAlexandru Croitor2021-08-241-11/+11
| | | | | Change-Id: Ib92bcd600bbfb0f2ee8ad8e5d44eaecdf9d16916 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow specifying custom build directories for CMake autotestsAlexandru Croitor2021-07-021-2/+26
| | | | | | | | | | | | It's useful when one project needs to be configured multiple times in different directories without overlapping CMakeCache.txt files, due to differing options passed during configuration. Pick-to: 6.2 Change-Id: Id2969e989824f980fba6ed58f9e0323ab3a862dd Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow passing arguments to tests/auto/cmake test commandAlexandru Croitor2021-05-101-2/+6
| | | | | | | Useful to pass -V if the test command is 'ctest'. Change-Id: I77193ff2c15d8df4de71730f66afc0ee87953384 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't build cmake build tests as macOS universalAlexandru Croitor2021-05-101-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | We want standalone tests added by qt_internal_add_test to be built as universal executables, so we can build them on an intel machine and run them on an ARM machine. But CMake build tests will be built on the final machine that runs the tests and it might lack a universal SDK. That's why they should be built only targeting the architecture of the machine they're running on. Change the generated qt.tooclhain.cmake file to allow opting in or out of building projects with the same architectures as Qt was configured with. Now standalone tests will be multi-arch, but CMake build tests will be single-arch. Amends e379147f9571af8c3af5768b9040e0180819a855 Task-number: QTBUG-85447 Task-number: QTBUG-87580 Task-number: QTBUG-92933 Change-Id: I41ab047983115f84eb2333cc9ac2d19ca08d621f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add the SIMULATE_IN_SOURCE argument to _qt_internal_test_expect_passAlexey Edelev2021-04-071-21/+72
| | | | | | | | | | | | | | test_QFINDTESTDATA builds the project in the source tree, this is necessary because the test requires relative paths to the source file names. This function could be useful for other tests, so it makes sense to extend the _qt_internal_test_expect_pass/fail macros to support build in the source tree. Note that, the SIMULATE_IN_SOURCE argument doesn't build the test in the existing source tree, but copies source files to the build tree first to do not litter the source directory. Change-Id: I16e790d74be2a0c5ca0593e0f88580dbe09882b9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Choose better defaults for qt_add_plugin STATIC/SHAREDAlexandru Croitor2021-04-071-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a recent behavior change where the public CMake API qt_add_plugin API took into account the value of BUILD_SHARED_LIBS to decide whether the plugin should be a static or shared library. Instead, use the following new behavior - If no explicit option STATIC / SHARED option is passed, default to whatever flavor Qt was built as. Aka if Qt was configured with -shared, qt_add_plugin defaults to creating shared plugins. If it's a -static Qt, create static plugins. - If an explicit STATIC / SHARED option is set, override the default computed value with the given value. As a result BUILD_SHARED_LIBS does not affect Qt plugins anymore. This is more in line with Qt expectations. Add SHARED as a new valid option to pass to qt_add_plugin (it wasn't before). Add tests to check for the above behavior. Amends aa4a1006cbccbc180c600f9b4dc9e882bb5ed5ca Pick-to: 6.1 Fixes: QTBUG-92361 Task-number: QTBUG-88763 Change-Id: Iae806024ddd5cf10cfe58ddbcebd2818084b0bd7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Rework the failure macros in the Qt CTest kitAlexey Edelev2021-03-171-1/+13
| | | | | | | | | | | The _qt_internal_test_expect_fail macro fails when the test fails during the configuration step. Rename this macro to _qt_internal_test_expect_build_fail and add the _qt_internal_test_expect_fail macro that expects inverted test result. Change-Id: I4635e99152f7a32f5c48202e84fec59800453d34 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix qtbase cmake tests to pass when configured in-treeAlexandru Croitor2020-11-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | As opposed to standalone tests. The problem is that 4 of the cmake failbuild tests use try_compile as an indirection layer to configure /another/ project which is actually the test. That project needs to know the location of Qt. To do that, a FindPackageHints.cmake file is included and the variable it sets is passed to find_package() HINTS option. That's enough to find a specific module, but not any dependent Tools packages. Work around that by adding the Qt location to CMAKE_PREFIX_PATH in the included FindPackageHints.cmake file. The problem does not happen in standalone tests, because the Qt location ends up being propagated via the qt toolchain file, which does get inherited by the compile tests (albeit in a weird way, where a reconfiguration still shows CMAKE_PREFIX_PATH to be empty). Change-Id: I1f7ce940fd31678b46c0356edf6581e523cb885a Fixes: QTBUG-86963 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Normalize dir separators in CMAKE_TOOLCHAIN_FILE when forwarded to CTestKai Koehne2020-11-061-1/+2
| | | | | | | | | | | | | | | | | | | | This fixes an issue where, on Windows, 'ninja test' will error out: [0/1] Running tests... Test project C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools CMake Warning (dev) at C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools/tests/auto/cmake/CTestTestfile.cmake:7 (add_test): Syntax error in cmake code at C:/dev/qt/dev/cmake-msvc-2019-amd64/qttools/tests/auto/cmake/CTestTestfile.cmake:7 when parsing string -DCMAKE_TOOLCHAIN_FILE=C:\dev\qt\dev\cmake-msvc-2019-amd64\qtbase\bin\/../lib/cmake/Qt6/qt.toolchain.cmake Invalid escape sequence \d Change-Id: Ifc727e44b20b899b44c7c1398d4273d73b7519ca Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clean up the public API a bitAlexandru Croitor2020-10-011-3/+3
| | | | | | | | | | Add some missing versionless functions. Rename some functions that are not meant to be public API, and their usages. Task-number: QTBUG-86827 Change-Id: Ifb66c04cd7598d83fe80c01a92ab2d269ebaf396 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Get tests/auto/cmake tests workingAlexandru Croitor2020-07-171-63/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests/auto/cmake project can be configured separately as a standalone project with qt-cmake, or as part of the overall qtbase standalone tests. To do that a bunch of things were done - Ported all Qt5 strings to Qt6 - Replaced in all projects the use of add_definitions and include_directories with a target based approach, except for 2 tests where we check that the old-style approach works, otherwise the tests would file - Removed some (possibly unneeded) EGL / OpenGL tests - Fixed some C++ code - Added setup code to tests/auto/cmake/CMakeLists.txt to figure out which modules are available and should be tested - Fixed Qt6CTestMacros.cmake to be loaded by Qt6Core - Removed the CMake tests to not be run in qmake builds of Qt because they would fail anyway - Enabled the CMake tests to be part of standalone tests - Disabled auto-passing of the C and CXX compiler cache vars when cross-compiling so that the tests can somewhat pass on boot2qt. This is the issue we encountered in e2b2cd9397c76e91ac1ebe493bcac7696767c02e - Ultimately disabled tests for boot2qt, because the -rpath-link flag is not generated by CMake for some reason. - Added code to setup the environment when running an executable that was built as part of the test, so that the proper Qt libraries are found. This handles both the standalone tests case and separate project case. The remaining unported tests are test_import_plugins which requires quite a bit of work to get some modules and plugins built that were done as part of the qmake .pro files, test_plugins that checks some Network plugins which I'm not sure about, and test_add_big_resource which doesn't work with namespaced builds and there's no good way of detecting those at the moment either. Change-Id: Ic8809c72817d1db81af6c6014c11df6473ad8c75 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-06-141-0/+243
This changes many different CMake places to mention Qt6 instead of Qt5. Note that some old qt5 cmake config files in corelib are probably not needed anymore, but I still renamed and kept them for now. Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4