summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-12-13 17:08:45 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-15 21:04:27 +0100
commit92667d14a48cb8d32290d2845eb5519645109fdc (patch)
tree70c7fbb6f50cb492b1726459da4989223e2093e7 /tests/auto/testlib
parent81d55783bb7649dd6fe71c01a18b64911fcea837 (diff)
QTestlib-Selftest: Add initTestCase() setting the directory.
Required for launching the sub-processes. The test worked only when launched locally, not from 'make check'. Change-Id: I42c9202a7726c3135f94445fb336b2b8241535a4 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/testlib')
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index f3b47389e6..ea47678248 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -40,14 +40,18 @@
****************************************************************************/
#include <QtCore>
-#include <QtTest/QtTest>
#include <QtCore/QXmlStreamReader>
+#include <QtCore/QFileInfo>
+#include <QtCore/QDir>
+#include <QtTest/QtTest>
+
#include <private/cycle_p.h>
class tst_Selftests: public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
void runSubTest_data();
void runSubTest();
void cleanup();
@@ -285,6 +289,13 @@ static QList<LoggerSet> allLoggerSets()
;
}
+void tst_Selftests::initTestCase()
+{
+ // 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));
+}
+
void tst_Selftests::runSubTest_data()
{
QTest::addColumn<QString>("subdir");
@@ -443,7 +454,9 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
QProcess proc;
static const QProcessEnvironment environment = processEnvironment();
proc.setProcessEnvironment(environment);
- proc.start(subdir + QLatin1Char('/') + subdir, arguments);
+ const QString path = subdir + QLatin1Char('/') + subdir;
+ proc.start(path, arguments);
+ QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString())));
QVERIFY2(proc.waitForFinished(), qPrintable(proc.errorString()));
QList<QByteArray> actualOutputs;