tst_qobject: Fix execution in debug&release shadow builds

The previous approach of having the signalbug helper in a subdirectory did
not work for shadow builds, as QFINDTESTDATA would not find that dir. By
putting both test and helper into the same directory, the helper will be
found in the test's current working directory.

The second problem was that not putting executables into debug/release
subdirectories might have lead 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.

Change-Id: Ia39315432860405642542449296c16dd2ae9fa9f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Oliver Wolff 2018-05-24 10:32:27 +02:00
parent 680038e2c1
commit 4d7137c4a0
4 changed files with 39 additions and 16 deletions

View File

@ -1,3 +1,7 @@
tst_qobject
signalbug/signalbug
signalbug/signalbug.exe
signalbug_helper
signalbug_helper.exe
debug/signalbug_helper
release/signalbug_helper
debug/signalbug_helper.exe
release/signalbug_helper.exe

View File

@ -1,6 +1,15 @@
CONFIG -= app_bundle debug_and_release
CONFIG -= app_bundle
CONFIG += console
DESTDIR = ./
debug_and_release {
CONFIG(debug, debug|release) {
TARGET = ../../debug/signalbug_helper
} else {
TARGET = ../../release/signalbug_helper
}
} else {
TARGET = ../signalbug_helper
}
QT = core
HEADERS += signalbug.h

View File

@ -1,10 +1,29 @@
CONFIG += testcase console
TARGET = ../tst_qobject
debug_and_release {
CONFIG(debug, debug|release) {
TARGET = ../../debug/tst_qobject
} else {
TARGET = ../../release/tst_qobject
}
} else {
TARGET = ../tst_qobject
}
QT = core-private network testlib
SOURCES = ../tst_qobject.cpp
# Force C++17 if available (needed due to P0012R1)
contains(QT_CONFIG, c++1z): CONFIG += c++1z
!winrt: TEST_HELPER_INSTALLS = ../signalbug/signalbug
!winrt {
debug_and_release {
CONFIG(debug, debug|release) {
TEST_HELPER_INSTALLS = ../debug/signalbug_helper
} else {
TEST_HELPER_INSTALLS = ../release/signalbug_helper
}
} else {
TEST_HELPER_INSTALLS = ../signalbug_helper
}
}
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0

View File

@ -55,7 +55,6 @@ class tst_QObject : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void disconnect();
void connectSlotsByName();
void connectSignalsToSignalsWithDefaultArguments();
@ -283,14 +282,6 @@ static void playWithObjects()
}
}
void tst_QObject::initTestCase()
{
#if QT_CONFIG(process)
const QString testDataDir = QFileInfo(QFINDTESTDATA("signalbug")).absolutePath();
QVERIFY2(QDir::setCurrent(testDataDir), qPrintable("Could not chdir to " + testDataDir));
#endif
}
void tst_QObject::disconnect()
{
SenderObject *s = new SenderObject;
@ -3015,7 +3006,7 @@ void tst_QObject::recursiveSignalEmission()
#else
QProcess proc;
// signalbug helper app should always be next to this test binary
const QString path = QStringLiteral("signalbug/signalbug");
const QString path = QStringLiteral("signalbug_helper");
proc.start(path);
QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString())));
QVERIFY(proc.waitForFinished());