diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2012-09-28 11:41:15 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-30 05:02:24 (GMT) |
commit | 3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1 (patch) | |
tree | 9cacee6fdb7be5b66cb1642b03486d93d8e3c41d /tests/auto/quuid | |
parent | 5267c575d60b9f1f0415e8affbd38c28c4cd3873 (diff) | |
download | Qt-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/quuid')
-rw-r--r-- | tests/auto/quuid/test/test.pro | 2 | ||||
-rw-r--r-- | tests/auto/quuid/tst_quuid.cpp | 42 |
2 files changed, 30 insertions, 14 deletions
diff --git a/tests/auto/quuid/test/test.pro b/tests/auto/quuid/test/test.pro index 271b88f..06ae3bd 100644 --- a/tests/auto/quuid/test/test.pro +++ b/tests/auto/quuid/test/test.pro @@ -27,5 +27,3 @@ symbian { DEPLOYMENT += binDep } - -win32:CONFIG+=insignificant_test # QTQAINFRA-428 diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp index 55b75a9..4190ea6 100644 --- a/tests/auto/quuid/tst_quuid.cpp +++ b/tests/auto/quuid/tst_quuid.cpp @@ -60,6 +60,7 @@ public: tst_QUuid(); private slots: + void initTestCase(); void fromChar(); void toString(); void fromString(); @@ -97,6 +98,19 @@ tst_QUuid::tst_QUuid() uuidB = QUuid(0x1ab6e93a ,0xb1cb ,0x4a87 ,0xba ,0x47 ,0xec ,0x7e ,0x99 ,0x03 ,0x9a ,0x7b); } +void tst_QUuid::initTestCase() +{ +#ifdef Q_OS_WIN + // cd up to be able to locate the binary of the sub-process. + 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_QUuid::fromChar() { QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")); @@ -294,29 +308,33 @@ void tst_QUuid::threadUniqueness() qDeleteAll(threads); } +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_QUuid::processUniqueness() { QProcess process; - QString processOneOutput; - QString processTwoOutput; - // Start it once #ifdef Q_OS_MAC - process.start("testProcessUniqueness/testProcessUniqueness.app"); + const QString binary = "testProcessUniqueness/testProcessUniqueness.app"; #else - process.start("testProcessUniqueness/testProcessUniqueness"); + const QString binary = "testProcessUniqueness/testProcessUniqueness"; #endif + process.start(binary); + QVERIFY2(process.waitForStarted(), msgCannotStartProcess(binary, process.errorString()).constData()); QVERIFY(process.waitForFinished()); - processOneOutput = process.readAllStandardOutput(); + const QByteArray processOneOutput = process.readAllStandardOutput(); // Start it twice -#ifdef Q_OS_MAC - process.start("testProcessUniqueness/testProcessUniqueness.app"); -#else - process.start("testProcessUniqueness/testProcessUniqueness"); -#endif + process.start(binary); + QVERIFY2(process.waitForStarted(), msgCannotStartProcess(binary, process.errorString()).constData()); QVERIFY(process.waitForFinished()); - processTwoOutput = process.readAllStandardOutput(); + const QByteArray processTwoOutput = process.readAllStandardOutput(); // They should be *different*! QVERIFY(processOneOutput != processTwoOutput); |