summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/other/lancelot/lancelot.pro3
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp11
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp11
-rw-r--r--tests/auto/tools/qmake/tst_qmake.cpp9
4 files changed, 20 insertions, 14 deletions
diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro
index bbb48c745e..ced8aceb99 100644
--- a/tests/auto/other/lancelot/lancelot.pro
+++ b/tests/auto/other/lancelot/lancelot.pro
@@ -10,7 +10,6 @@ RESOURCES += images.qrc
include($$PWD/../../../baselineserver/shared/qbaselinetest.pri)
-!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\"
-linux-g++-maemo:DEFINES += USE_RUNTIME_DIR
+TESTDATA += scripts/*
CONFIG += insignificant_test # QTBUG-21402
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index cbbd28dc82..e024b75400 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -50,10 +50,6 @@
#include <QtOpenGL>
#endif
-#ifndef SRCDIR
-#define SRCDIR "."
-#endif
-
class tst_Lancelot : public QObject
{
Q_OBJECT
@@ -114,11 +110,8 @@ void tst_Lancelot::initTestCase()
if (!proto.connect(QLatin1String("tst_Lancelot"), &dryRunMode, clientInfo))
QSKIP(qPrintable(proto.errorMessage()));
-#if defined(USE_RUNTIME_DIR)
- scriptsDir = QCoreApplication::applicationDirPath() + "/scripts/";
-#else
- scriptsDir = SRCDIR "/scripts/";
-#endif
+ QString baseDir = QFINDTESTDATA("scripts/text.qps");
+ scriptsDir = baseDir.left(baseDir.lastIndexOf('/')) + '/';
QDir qpsDir(scriptsDir);
QStringList files = qpsDir.entryList(QStringList() << QLatin1String("*.qps"), QDir::Files | QDir::Readable);
if (files.isEmpty()) {
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index cb03611af3..e8c4806794 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -291,8 +291,17 @@ static QList<LoggerSet> allLoggerSets()
void tst_Selftests::initTestCase()
{
+ //Detect the location of the sub programs
+ QString subProgram = QLatin1String("float/float");
+#if defined(Q_OS_WIN)
+ subProgram = QLatin1String("float/float.exe");
+#endif
+ QString testdataDir = QFINDTESTDATA(subProgram);
+ if (testdataDir.lastIndexOf(subProgram) > 0)
+ testdataDir = testdataDir.left(testdataDir.lastIndexOf(subProgram));
+ else
+ testdataDir = QCoreApplication::applicationDirPath();
// chdir to our testdata path and execute helper apps relative to that.
- QString testdataDir = QFileInfo(QFINDTESTDATA("float")).absolutePath();
QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir));
}
diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp
index dbb845ba81..6e1562e2ca 100644
--- a/tests/auto/tools/qmake/tst_qmake.cpp
+++ b/tests/auto/tools/qmake/tst_qmake.cpp
@@ -118,8 +118,13 @@ void tst_qmake::initTestCase()
#else
test_compiler.setBaseCommands( "make", cmd );
#endif
- QString tmpFile = QFINDTESTDATA("testdata");
- base_path = tmpFile.left(tmpFile.lastIndexOf('/'));
+ //Detect the location of the testdata
+ QString subProgram = QLatin1String("testdata/simple_app/main.cpp");
+ base_path = QFINDTESTDATA(subProgram);
+ if (base_path.lastIndexOf(subProgram) > 0)
+ base_path = base_path.left(base_path.lastIndexOf(subProgram));
+ else
+ base_path = QCoreApplication::applicationDirPath();
}
void tst_qmake::cleanupTestCase()