summaryrefslogtreecommitdiffstats
path: root/tests/auto/selftests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2012-09-28 11:41:15 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-30 05:02:24 (GMT)
commit3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1 (patch)
tree9cacee6fdb7be5b66cb1642b03486d93d8e3c41d /tests/auto/selftests
parent5267c575d60b9f1f0415e8affbd38c28c4cd3873 (diff)
downloadQt-3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1.zip
Qt-3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1.tar.gz
Qt-3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1.tar.bz2
Fix autotests that no longer find executables on Windows.
The tests are now run from the 'debug', 'release' subdirectories on Windows by 'make check'. Go up one directory so that the relative paths are correct. Non-network tests. Change-Id: I8d0f806ff6708c3111a39c861ed46b21881acc7b Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Diffstat (limited to 'tests/auto/selftests')
-rw-r--r--tests/auto/selftests/test/test.pro3
-rw-r--r--tests/auto/selftests/tst_selftests.cpp26
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/auto/selftests/test/test.pro b/tests/auto/selftests/test/test.pro
index facb26a..d57cbf4 100644
--- a/tests/auto/selftests/test/test.pro
+++ b/tests/auto/selftests/test/test.pro
@@ -12,6 +12,3 @@ win32 {
}
RESOURCES += ../selftests.qrc
-
-
-win32:CONFIG+=insignificant_test # QTQAINFRA-428
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index e0c56b3..8bb48c2 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -49,6 +49,7 @@ class tst_Selftests: public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
void runSubTest_data();
void runSubTest();
void cleanupTestCase();
@@ -181,6 +182,19 @@ static QList<Logger> allLoggers()
;
}
+void tst_Selftests::initTestCase()
+{
+#ifdef Q_OS_WIN
+ // cd up to be able to locate the binaries of the sub-processes.
+ QDir workingDirectory = QDir::current();
+ if (workingDirectory.absolutePath().endsWith(QLatin1String("/debug"), Qt::CaseInsensitive)
+ || workingDirectory.absolutePath().endsWith(QLatin1String("/release"), Qt::CaseInsensitive)) {
+ QVERIFY(workingDirectory.cdUp());
+ QVERIFY(QDir::setCurrent(workingDirectory.absolutePath()));
+ }
+#endif
+}
+
void tst_Selftests::runSubTest_data()
{
QTest::addColumn<QString>("subdir");
@@ -323,6 +337,14 @@ void tst_Selftests::runSubTest_data()
}
}
+static inline QByteArray msgCannotStartProcess(const QString &binary, const QString &why)
+{
+ return QString::fromLatin1("Cannot start '%1' from '%2': %3")
+ .arg(QDir::toNativeSeparators(binary),
+ QDir::toNativeSeparators(QDir::currentPath()),
+ why).toLocal8Bit();
+}
+
void tst_Selftests::doRunSubTest(QString const& subdir, QString const& logger, QStringList const& arguments )
{
// For the plain text logger, we'll read straight from standard output.
@@ -338,7 +360,9 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QString const& logger, Q
QProcess proc;
proc.setEnvironment(QStringList(""));
- proc.start(subdir + "/" + subdir, QStringList() << arguments << extraArguments);
+ const QString binary = subdir + QLatin1Char('/') + subdir;
+ proc.start(binary, QStringList() << arguments << extraArguments);
+ QVERIFY2(proc.waitForStarted(), msgCannotStartProcess(binary, proc.errorString()));
QVERIFY2(proc.waitForFinished(), qPrintable(proc.errorString()));
QByteArray out;