diff options
-rw-r--r-- | qbs-resources/imports/QbsAutotest.qbs | 4 | ||||
-rw-r--r-- | tests/auto/auto.pri | 3 | ||||
-rw-r--r-- | tests/auto/shared.h | 4 | ||||
-rw-r--r-- | tests/auto/tools/tools.qbs | 2 |
4 files changed, 12 insertions, 1 deletions
diff --git a/qbs-resources/imports/QbsAutotest.qbs b/qbs-resources/imports/QbsAutotest.qbs index 7fc959394..7a727e660 100644 --- a/qbs-resources/imports/QbsAutotest.qbs +++ b/qbs-resources/imports/QbsAutotest.qbs @@ -1,5 +1,6 @@ import qbs import qbs.FileInfo +import qbs.Utilities QtApplication { type: ["application", "autotest"] @@ -9,6 +10,9 @@ QtApplication { Depends { name: "Qt.testlib" } Depends { name: "qbscore" } Depends { name: "qbsbuildconfig" } + cpp.defines: [ + "QBS_TEST_SUITE_NAME=" + Utilities.cStringQuote(testName.toUpperCase().replace("-", "_")) + ] cpp.includePaths: [ "../../../src", "../../../src/app/shared", // for the logger diff --git a/tests/auto/auto.pri b/tests/auto/auto.pri index f0d6e9be4..304202e0b 100644 --- a/tests/auto/auto.pri +++ b/tests/auto/auto.pri @@ -1,6 +1,9 @@ TEMPLATE = app DESTDIR = ../../../bin DEFINES += SRCDIR=\\\"$$_PRO_FILE_PWD_\\\" +qbs_test_suite_name = $$replace(_PRO_FILE_, ^.*/([^/.]+)\\.pro$, \\1) +qbs_test_suite_name = $$upper($$replace(qbs_test_suite_name, -, _)) +DEFINES += QBS_TEST_SUITE_NAME=\\\"$${qbs_test_suite_name}\\\" INCLUDEPATH += $$PWD/../../src $$PWD/../../src/app/shared QT = core testlib diff --git a/tests/auto/shared.h b/tests/auto/shared.h index 24bfc1e68..60bb3f64d 100644 --- a/tests/auto/shared.h +++ b/tests/auto/shared.h @@ -62,6 +62,10 @@ inline SettingsPtr settings() inline QString profileName() { + const QString suiteProfile = QLatin1String( + qgetenv("QBS_AUTOTEST_PROFILE_" QBS_TEST_SUITE_NAME)); + if (!suiteProfile.isEmpty()) + return suiteProfile; const QString profile = QLatin1String(qgetenv("QBS_AUTOTEST_PROFILE")); return !profile.isEmpty() ? profile : QLatin1String("none"); } diff --git a/tests/auto/tools/tools.qbs b/tests/auto/tools/tools.qbs index bdf597b7e..64cced80e 100644 --- a/tests/auto/tools/tools.qbs +++ b/tests/auto/tools/tools.qbs @@ -11,5 +11,5 @@ QbsAutotest { "tst_tools.h" ] - cpp.defines: ["QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version)] + cpp.defines: base.concat(["QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version)]) } |