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 <simon.hausmann@qt.io>
This commit is contained in:
Oliver Wolff 2018-06-28 08:21:53 +02:00
parent 8f143c75f0
commit 63f78e41dc
3 changed files with 22 additions and 25 deletions

View File

@ -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

View File

@ -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

View File

@ -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<Pointer *> 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
}