Changed these tests to use QFINDTESTDATA macro to detect location of testdata.
Checking for a specific file contained in the testdata so as not to be confused by empty directories
created during configure.
Change-Id: Iac2ac6304b6b9ac79e00886025b93ec0af5a8507
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
include($$PWD/../../../baselineserver/shared/qbaselinetest.pri)
-!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\"
-linux-g++-maemo:DEFINES += USE_RUNTIME_DIR
+TESTDATA += scripts/*
CONFIG += insignificant_test # QTBUG-21402
#include <QtOpenGL>
#endif
-#ifndef SRCDIR
-#define SRCDIR "."
-#endif
-
class tst_Lancelot : public QObject
{
Q_OBJECT
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()) {
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));
}
#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()