From 030eddd1730f2cb2b175cb02e3848094ad74d22f Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 28 Jun 2018 08:43:42 +0200 Subject: [PATCH] tst_qapplication: 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: I017b501506c54c4b89773d2b949c097598bc7049 Reviewed-by: Simon Hausmann --- .../desktopsettingsaware.pro | 12 +++++- .../kernel/qapplication/modal/modal.pro | 12 +++++- .../widgets/kernel/qapplication/test/test.pro | 19 +++++++-- .../kernel/qapplication/tst_qapplication.cpp | 39 ++----------------- 4 files changed, 39 insertions(+), 43 deletions(-) diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro index a10ff71b05..442bf33b61 100644 --- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -1,6 +1,14 @@ QT += widgets -CONFIG -= app_bundle debug_and_release_target +CONFIG -= app_bundle -DESTDIR = ./ +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/desktopsettingsaware_helper + } else { + TARGET = ../../release/desktopsettingsaware_helper + } +} else { + TARGET = ../desktopsettingsaware_helper +} SOURCES += main.cpp diff --git a/tests/auto/widgets/kernel/qapplication/modal/modal.pro b/tests/auto/widgets/kernel/qapplication/modal/modal.pro index a34871d2aa..e832d90821 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/modal.pro +++ b/tests/auto/widgets/kernel/qapplication/modal/modal.pro @@ -1,7 +1,15 @@ QT += widgets SOURCES += main.cpp \ base.cpp -DESTDIR = ./ -CONFIG -= app_bundle debug_and_release_target +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/modal_helper + } else { + TARGET = ../../release/modal_helper + } +} else { + TARGET = ../modal_helper +} +CONFIG -= app_bundle HEADERS += base.h diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro index 832cfe7ebf..93e80dd123 100644 --- a/tests/auto/widgets/kernel/qapplication/test/test.pro +++ b/tests/auto/widgets/kernel/qapplication/test/test.pro @@ -1,11 +1,9 @@ CONFIG += testcase -CONFIG -= debug_and_release_target QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += ../tst_qapplication.cpp -TARGET = ../tst_qapplication builtin_testdata: DEFINES += BUILTIN_TESTDATA @@ -14,7 +12,20 @@ TESTDATA = ../test/test.pro ../tmp/README ../modal !winrt { SUBPROGRAMS = desktopsettingsaware modal win32:SUBPROGRAMS += wincmdline - - for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}" } +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/tst_qapplication + !winrt: TEST_HELPER_INSTALLS = ../debug/helper + for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../debug/$${file}" + } else { + TARGET = ../../release/tst_qapplication + !winrt: TEST_HELPER_INSTALLS = ../release/helper + for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../release/$${file}" + } +} else { + TARGET = ../tst_qapplication + !winrt: TEST_HELPER_INSTALLS = ../helper + for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}" +} diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 1d94be7f83..67e46ad1b3 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -96,7 +96,6 @@ public: tst_QApplication(); private slots: - void initTestCase(); void cleanup(); void sendEventsOnProcessEvents(); // this must be the first test void staticSetup(); @@ -187,15 +186,6 @@ public: } }; -void tst_QApplication::initTestCase() -{ -#if QT_CONFIG(process) - // chdir to our testdata path and execute helper apps relative to that. - const QString testdataDir = QFileInfo(QFINDTESTDATA("desktopsettingsaware")).absolutePath(); - QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir)); -#endif -} - void tst_QApplication::sendEventsOnProcessEvents() { int argc = 0; @@ -1452,20 +1442,10 @@ void tst_QApplication::testDeleteLaterProcessEvents() void tst_QApplication::desktopSettingsAware() { #if QT_CONFIG(process) - QString path; - { - // We need an application object for QFINDTESTDATA to work - // properly in all cases. - int argc = 0; - QCoreApplication app(argc, 0); - path = QFINDTESTDATA("desktopsettingsaware/"); - } - QVERIFY2(!path.isEmpty(), "Cannot locate desktopsettingsaware helper application"); - path += "desktopsettingsaware"; QProcess testProcess; - testProcess.start(path); + testProcess.start("desktopsettingsaware_helper"); QVERIFY2(testProcess.waitForStarted(), - qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString()))); + qPrintable(QString::fromLatin1("Cannot start 'desktopsettingsaware_helper': %1").arg(testProcess.errorString()))); QVERIFY(testProcess.waitForFinished(10000)); QCOMPARE(int(testProcess.state()), int(QProcess::NotRunning)); QVERIFY(int(testProcess.error()) != int(QProcess::Crashed)); @@ -2133,23 +2113,12 @@ void tst_QApplication::touchEventPropagation() void tst_QApplication::qtbug_12673() { - QString path; - { - // We need an application object for QFINDTESTDATA to work - // properly in all cases. - int argc = 0; - QCoreApplication app(argc, 0); - path = QFINDTESTDATA("modal/"); - } - QVERIFY2(!path.isEmpty(), "Cannot locate modal helper application"); - path += "modal"; - #if QT_CONFIG(process) QProcess testProcess; QStringList arguments; - testProcess.start(path, arguments); + testProcess.start("modal_helper", arguments); QVERIFY2(testProcess.waitForStarted(), - qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, testProcess.errorString()))); + qPrintable(QString::fromLatin1("Cannot start 'modal_helper': %1").arg(testProcess.errorString()))); QVERIFY(testProcess.waitForFinished(20000)); QCOMPARE(testProcess.exitStatus(), QProcess::NormalExit); #else