summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlocalsocket
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/qlocalsocket
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/qlocalsocket')
-rw-r--r--tests/auto/qlocalsocket/test/test.pro2
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp36
2 files changed, 21 insertions, 17 deletions
diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro
index 58b36ef..b7e0786 100644
--- a/tests/auto/qlocalsocket/test/test.pro
+++ b/tests/auto/qlocalsocket/test/test.pro
@@ -47,5 +47,3 @@ wince*|symbian {
requires(contains(QT_CONFIG,script))
}
-
-win32:CONFIG+=insignificant_test # QTQAINFRA-428
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index c6ac854..0d23186 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -45,6 +45,7 @@
#include <qtextstream.h>
#include <QtNetwork/qlocalsocket.h>
#include <QtNetwork/qlocalserver.h>
+#include <QtCore/QDir>
#include "../../shared/util.h"
#ifdef Q_OS_SYMBIAN
@@ -64,11 +65,8 @@ class tst_QLocalSocket : public QObject
{
Q_OBJECT
-public:
- tst_QLocalSocket();
- virtual ~tst_QLocalSocket();
-
public Q_SLOTS:
+ void initTestCase();
void init();
void cleanup();
@@ -122,20 +120,28 @@ private slots:
private:
void unlink(QString serverName);
#endif
+
+private:
+ QString m_lackey;
};
-tst_QLocalSocket::tst_QLocalSocket()
+void tst_QLocalSocket::initTestCase()
{
- if (!QFile::exists("lackey/lackey"
+ QDir workingDirectory = QDir::current();
+ QString lackey = QLatin1String("lackey/lackey");
+ // Windows: cd up to be able to locate the binary of the sub-process.
#ifdef Q_OS_WIN
- ".exe"
+ lackey.append(QLatin1String(".exe"));
+ if (workingDirectory.absolutePath().endsWith(QLatin1String("/debug"), Qt::CaseInsensitive)
+ || workingDirectory.absolutePath().endsWith(QLatin1String("/release"), Qt::CaseInsensitive)) {
+ QVERIFY(workingDirectory.cdUp());
+ QVERIFY(QDir::setCurrent(workingDirectory.absolutePath()));
+ }
#endif
- ))
- qWarning() << "lackey executable doesn't exists!";
-}
-
-tst_QLocalSocket::~tst_QLocalSocket()
-{
+ m_lackey = workingDirectory.absoluteFilePath(lackey);
+ QVERIFY2(QFileInfo(m_lackey).exists(),
+ qPrintable(QString::fromLatin1("Lackey executable '%1' does not exist!")
+ .arg(QDir::toNativeSeparators(m_lackey))));
}
void tst_QLocalSocket::init()
@@ -806,7 +812,7 @@ void tst_QLocalSocket::processConnection()
serverArguments << "-qws";
#endif
QList<QProcess*> consumers;
- producer.start("lackey/lackey", serverArguments);
+ producer.start(m_lackey, serverArguments);
QVERIFY(producer.waitForStarted(-1));
QTest::qWait(2000);
for (int i = 0; i < processes; ++i) {
@@ -817,7 +823,7 @@ void tst_QLocalSocket::processConnection()
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
consumers.append(p);
- p->start("lackey/lackey", arguments);
+ p->start(m_lackey, arguments);
}
while (!consumers.isEmpty()) {