summaryrefslogtreecommitdiff
path: root/tests/auto/language/tst_language.cpp
diff options
context:
space:
mode:
authorRichard Weickelt <richard@weickelt.de>2020-02-16 14:33:11 +0100
committerRichard Weickelt <richard@weickelt.de>2020-02-27 09:48:20 +0000
commita3a89138cf8924c1236d9d288e9ab3cdc37ef8c7 (patch)
treec61d46f781a5d414ce410af8eaf4e80fe1ffc296 /tests/auto/language/tst_language.cpp
parente5f115d256361359917614b34886e09d04c766f0 (diff)
downloadqbs-a3a89138cf8924c1236d9d288e9ab3cdc37ef8c7.tar.gz
Introduce QBS_TEST_SOURCE_ROOT environment variable
This patch introduces QBS_TEST_SOURCE_ROOT environment variable that can be used to customize the source location of test data. Previously, the original testdata location was compiled into the test binaries. Thus it was impossible to run the test suites on a different host than the build host. In order to improve test coverage, we want to build the test suites once (for instance in a Docker environment) and then run them multiple times in different environments which might have a different file layout. In that case, the testdata location must be configurable. Change-Id: I7673826e6ea6f2e3aa893e657351a84c49a1033e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/language/tst_language.cpp')
-rw-r--r--tests/auto/language/tst_language.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index cc87fb750..25e549d18 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -79,8 +79,7 @@ using namespace qbs;
using namespace qbs::Internal;
static QString testDataDir() {
- return FileInfo::resolvePath(QStringLiteral(SRCDIR),
- QStringLiteral("../../../tests/auto/language/testdata"));
+ return testDataSourceDir(SRCDIR "/testdata");
}
static QString testProject(const char *fileName) {
return testDataDir() + QLatin1Char('/') + QLatin1String(fileName);
@@ -180,7 +179,7 @@ void TestLanguage::initTestCase()
m_engine = ScriptEngine::create(m_logger, EvalContext::PropertyEvaluation, this);
loader = new Loader(m_engine, m_logger);
loader->setSearchPaths(QStringList()
- << QStringLiteral(SRCDIR "/../../../share/qbs"));
+ << (testDataDir() + "/../../../../share/qbs"));
defaultParameters.setTopLevelProfile(profileName());
defaultParameters.setConfigurationName("default");
defaultParameters.expandBuildConfiguration();
@@ -2480,7 +2479,7 @@ void TestLanguage::projectFileLookup_data()
QTest::addColumn<QString>("projectFileOutput");
QTest::addColumn<bool>("failureExpected");
- const QString baseDir = QLatin1String(SRCDIR) + "/testdata";
+ const QString baseDir = testDataDir();
const QString multiProjectsDir = baseDir + "/dirwithmultipleprojects";
const QString noProjectsDir = baseDir + "/dirwithnoprojects";
const QString oneProjectDir = baseDir + "/dirwithoneproject";