diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2023-09-18 16:25:12 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2023-09-19 13:16:28 +0000 |
commit | a217fa0c223946fbf44592e0e57ce8d68faa8378 (patch) | |
tree | 5bf92c292acc70b07d5d92c89f37864180b2c323 /qbs | |
parent | ef00a7e28b329b62452055b610fb7df978fa6345 (diff) |
qbs build: Clean up testing infrastructure
- Rename ambiguously named "testsEnabled" property to "withPluginTests"
and fix the wrong uses.
- Move AutotestRunner out of main project file and into tests.qbs.
- Move "withAutotests" property into qtc module. We cannot remove it
from the main project file just yet, because some manual tests do not
make use of QtcManualTest at the moment.
- Do not remove the autotests from the project tree if autotests are
disabled. Instead, just disable the products.
Change-Id: I74a4cc717d9adbe53d37536b2565111e1617115b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'qbs')
-rw-r--r-- | qbs/imports/QtcAutotest.qbs | 2 | ||||
-rw-r--r-- | qbs/imports/QtcManualtest.qbs | 1 | ||||
-rw-r--r-- | qbs/imports/QtcPlugin.qbs | 2 | ||||
-rw-r--r-- | qbs/imports/QtcTestFiles.qbs | 2 | ||||
-rw-r--r-- | qbs/modules/qtc/qtc.qbs | 7 |
5 files changed, 10 insertions, 4 deletions
diff --git a/qbs/imports/QtcAutotest.qbs b/qbs/imports/QtcAutotest.qbs index 523f1cdbfd..3d1f3a50ec 100644 --- a/qbs/imports/QtcAutotest.qbs +++ b/qbs/imports/QtcAutotest.qbs @@ -2,6 +2,8 @@ import qbs import qbs.FileInfo QtcProduct { + condition: qtc.withAutotests + // This needs to be absolute, because it is passed to one of the source files. destinationDirectory: project.buildDirectory + '/' + FileInfo.relativePath(project.ide_source_tree, sourceDirectory) diff --git a/qbs/imports/QtcManualtest.qbs b/qbs/imports/QtcManualtest.qbs index 0c47bf1c8f..7a388b8136 100644 --- a/qbs/imports/QtcManualtest.qbs +++ b/qbs/imports/QtcManualtest.qbs @@ -1,6 +1,7 @@ import qbs.FileInfo QtcProduct { + condition: qtc.withAutotests destinationDirectory: project.buildDirectory + '/' + FileInfo.relativePath(project.ide_source_tree, sourceDirectory) targetName: "tst_" + name.split(' ').join("") diff --git a/qbs/imports/QtcPlugin.qbs b/qbs/imports/QtcPlugin.qbs index 8c26050328..d06f99385e 100644 --- a/qbs/imports/QtcPlugin.qbs +++ b/qbs/imports/QtcPlugin.qbs @@ -14,7 +14,7 @@ QtcProduct { property stringList pluginRecommends: [] property stringList pluginTestDepends: [] - Depends { name: "Qt.testlib"; condition: qtc.testsEnabled } + Depends { name: "Qt.testlib"; condition: qtc.withPluginTests } Depends { name: "ExtensionSystem" } Depends { name: "pluginjson" } diff --git a/qbs/imports/QtcTestFiles.qbs b/qbs/imports/QtcTestFiles.qbs index e1be695dac..0dbf377e1f 100644 --- a/qbs/imports/QtcTestFiles.qbs +++ b/qbs/imports/QtcTestFiles.qbs @@ -1,4 +1,4 @@ Group { name: "Unit tests" - condition: qtc.testsEnabled + condition: qtc.withPluginTests } diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index 73b26adf9e..eca67fc9d5 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -72,7 +72,10 @@ Module { property bool preferSystemSyntaxHighlighting: true - property bool testsEnabled: Environment.getEnv("TEST") || qbs.buildVariant === "debug" + property bool withPluginTests: Environment.getEnv("TEST") || qbs.buildVariant === "debug" + property bool testsEnabled: withPluginTests // TODO: compat, remove + property bool withAutotests: project.withAutotests // FIXME: withPluginTests + property stringList generalDefines: [ "QT_CREATOR", 'IDE_LIBRARY_BASENAME="' + libDirName + '"', @@ -88,6 +91,6 @@ Module { "QT_NO_FOREACH", "QT_DISABLE_DEPRECATED_BEFORE=0x050900", "QT_USE_QSTRINGBUILDER", - ].concat(testsEnabled ? ["WITH_TESTS"] : []) + ].concat(withPluginTests ? ["WITH_TESTS"] : []) .concat(qbs.toolchain.contains("msvc") ? ["_CRT_SECURE_NO_WARNINGS"] : []) } |