From 3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Sep 2012 13:41:15 +0200 Subject: 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 --- tests/auto/qlocalsocket/test/test.pro | 2 -- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 36 ++++++++++++++++------------ 2 files changed, 21 insertions(+), 17 deletions(-) (limited to 'tests/auto/qlocalsocket') diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro index 58b36efe4b..b7e0786f5f 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 c6ac8547e5..0d23186b68 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #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 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()) { -- cgit v1.2.3