From 863e308e6b49e3ea263c518cd9491daabb41e1d4 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 27 Jul 2022 19:06:39 +0200 Subject: Provide CMake guidance for skipping whole tests The testlib docs on how to skip whole tests was qmake-specific, so add the missing details for CMake. Change-Id: I247d08262302dcedb98ffbf301932d6dd84d7ff7 Reviewed-by: Fabian Kosmale Reviewed-by: Venugopal Shivashankar (cherry picked from commit 8814fb5f4faff2d8442e481feb1bb35c2250e930) Reviewed-by: Qt Cherry-pick Bot --- src/testlib/doc/src/qttest-best-practices.qdoc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/testlib/doc/src/qttest-best-practices.qdoc b/src/testlib/doc/src/qttest-best-practices.qdoc index 57f07d4a16..3980b453f7 100644 --- a/src/testlib/doc/src/qttest-best-practices.qdoc +++ b/src/testlib/doc/src/qttest-best-practices.qdoc @@ -198,11 +198,20 @@ attempt to run a slot that is not implemented. In the second case, the test will not attempt to run a test slot even though it should. - If an entire test program is inapplicable for a specific platform or - unless a particular feature is enabled, the best approach is to use the - parent directory's \c .pro file to avoid building the test. For example, - if the \c tests/auto/gui/someclass test is not valid for \macOS, add the - following line to \c tests/auto/gui.pro: + If an entire test program is inapplicable for a specific platform or unless + a particular feature is enabled, the best approach is to use the parent + directory's build configuration to avoid building the test. For example, if + the \c tests/auto/gui/someclass test is not valid for \macOS, wrap its + inclusion as a subdirectory in \c{tests/auto/gui/CMakeLists.txt} in a + platform check: + + \badcode + if(NOT APPLE) + add_subdirectory(someclass) + endif + \endcode + + or, if using \c qmake, add the following line to \c tests/auto/gui.pro: \badcode mac*: SUBDIRS -= someclass -- cgit v1.2.3