From 63f78e41dc75656efef9531c438df6356534162d Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 28 Jun 2018 08:21:53 +0200 Subject: tst_qthreadstorage: Fix execution for WinRT Not putting executables into debug/release subdirectories leads to the WinRT AppxManifest being overwritten by the wrong configuration. When Qt is configured with -release for example, it was possible that the debug manifest (Manifest files are always created next to the target) is written last and thus contains debug VCLibs as a dependency. Additionally the test was changed in that way, that the resulting file system structure (having helper and test application in a "top level" debug and release folder) is the same structure as in tst_qobject. Change-Id: I53d5238ff36706eb9c6f8eb04b954ec595ca30de Reviewed-by: Simon Hausmann --- .../qthreadstorage/crashonexit/crashonexit.pro | 10 +++++++++- .../corelib/thread/qthreadstorage/test/test.pro | 15 ++++++++++++--- .../thread/qthreadstorage/tst_qthreadstorage.cpp | 22 +--------------------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro index 94a0a01e94..d5c09ebc84 100644 --- a/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro +++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro @@ -1,5 +1,13 @@ SOURCES += crashOnExit.cpp -DESTDIR = ./ +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/crashOnExit_helper + } else { + TARGET = ../../release/crashOnExit_helper + } +} else { + TARGET = ../crashOnExit_helper +} QT = core CONFIG -= app_bundle CONFIG += console diff --git a/tests/auto/corelib/thread/qthreadstorage/test/test.pro b/tests/auto/corelib/thread/qthreadstorage/test/test.pro index 1a1fede186..79ac2e5405 100644 --- a/tests/auto/corelib/thread/qthreadstorage/test/test.pro +++ b/tests/auto/corelib/thread/qthreadstorage/test/test.pro @@ -1,9 +1,18 @@ CONFIG += testcase -TARGET = ../tst_qthreadstorage -CONFIG -= debug_and_release_target +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/tst_qthreadstorage + !winrt: TEST_HELPER_INSTALLS = ../../debug/crashonexit_helper + } else { + TARGET = ../../release/tst_qthreadstorage + !winrt: TEST_HELPER_INSTALLS = ../../release/crashonexit_helper + } +} else { + TARGET = ../tst_qthreadstorage + !winrt: TEST_HELPER_INSTALLS = ../crashonexit_helper +} CONFIG += console QT = core testlib SOURCES = ../tst_qthreadstorage.cpp -!winrt: TEST_HELPER_INSTALLS = ../crashonexit/crashonexit diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 403e28b07b..ef5d3452d5 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -48,7 +48,6 @@ class tst_QThreadStorage : public QObject { Q_OBJECT private slots: - void initTestCase(); void hasLocalData(); void localData(); void localData_const(); @@ -60,9 +59,6 @@ private slots: void leakInDestructor(); void resetInDestructor(); void valueBased(); - -private: - QString m_crashOnExit; }; class Pointer @@ -74,22 +70,6 @@ public: }; int Pointer::count = 0; -void tst_QThreadStorage::initTestCase() -{ -#if QT_CONFIG(process) - const QString crashOnExitDir = QFINDTESTDATA("crashonexit"); - QVERIFY2(!crashOnExitDir.isEmpty(), - qPrintable(QString::fromLatin1("Could not find 'crashonexit' starting from '%1'") - .arg(QDir::toNativeSeparators(QDir::currentPath())))); - m_crashOnExit = crashOnExitDir + QStringLiteral("/crashonexit"); -#ifdef Q_OS_WIN - m_crashOnExit += QStringLiteral(".exe"); -#endif - QVERIFY2(QFileInfo(m_crashOnExit).isExecutable(), - qPrintable(QDir::toNativeSeparators(m_crashOnExit) + QStringLiteral(" does not exist or is not executable."))); -#endif -} - void tst_QThreadStorage::hasLocalData() { QThreadStorage pointers; @@ -329,7 +309,7 @@ void tst_QThreadStorage::crashOnExit() QSKIP("No qprocess support", SkipAll); #else QString errorMessage; - QVERIFY2(runCrashOnExit(m_crashOnExit, &errorMessage), + QVERIFY2(runCrashOnExit("crashOnExit_helper", &errorMessage), qPrintable(errorMessage)); #endif } -- cgit v1.2.3