From 8f143c75f0d14e75977443029938ee63a7aeab0f Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 27 Jun 2018 17:45:39 +0200 Subject: tst_qfile: 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: I55078563304959c41e0dd9bb7bb91a6fc51e005a Reviewed-by: Simon Hausmann --- tests/auto/corelib/io/qfile/.gitignore | 8 ++++++-- tests/auto/corelib/io/qfile/stdinprocess/main.cpp | 2 +- .../auto/corelib/io/qfile/stdinprocess/stdinprocess.pro | 12 +++++++++++- tests/auto/corelib/io/qfile/test/test.pro | 11 +++++++++-- tests/auto/corelib/io/qfile/tst_qfile.cpp | 16 ++++++++++------ 5 files changed, 37 insertions(+), 12 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qfile/.gitignore b/tests/auto/corelib/io/qfile/.gitignore index c508239722..615264e4d4 100644 --- a/tests/auto/corelib/io/qfile/.gitignore +++ b/tests/auto/corelib/io/qfile/.gitignore @@ -1,6 +1,10 @@ tst_qfile -stdinprocess/stdinprocess -stdinprocess/stdinprocess.exe +stdinprocess_helper +stdinprocess_helper.exe +debug/stdinprocess_helper +debug/stdinprocess_helper.exe +release/stdinprocess_helper +release/stdinprocess_helper.exe readonlyfile newfile.txt appendfile.txt diff --git a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp index 6ff42c2485..77a1932bd5 100644 --- a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp +++ b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { if (argc < 2) { - printf("usage: stdinprocess >\n"); + printf("usage: stdinprocess_helper >\n"); printf("echos all its input to its output.\n"); return 1; } diff --git a/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro b/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro index 8e463e4cef..4029701943 100644 --- a/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro +++ b/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro @@ -1,8 +1,18 @@ SOURCES += main.cpp QT = core -CONFIG -= app_bundle debug_and_release_target +CONFIG -= app_bundle CONFIG += console +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/stdinprocess_helper + } else { + TARGET = ../../release/stdinprocess_helper + } +} else { + TARGET = ../stdinprocess_helper +} + # This app is testdata for tst_qfile target.path = $$[QT_INSTALL_TESTS]/tst_qfile/$$TARGET INSTALLS += target diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index 1472ddbb83..7b952b0283 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG -= debug_and_release_target QT = core-private core testlib qtHaveModule(network): QT += network else: DEFINES += QT_NO_NETWORK @@ -10,7 +9,15 @@ contains(CONFIG, builtin_testdata) { TESTDATA += ../BLACKLIST -TARGET = ../tst_qfile +debug_and_release { + CONFIG(debug, debug|release) { + TARGET = ../../debug/tst_qfile + } else { + TARGET = ../../release/tst_qfile + } +} else { + TARGET = ../tst_qfile +} SOURCES = ../tst_qfile.cpp INCLUDEPATH += ../../../../../shared/ HEADERS += ../../../../../shared/emulationdetector.h diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index ad00e25e7d..a61b7cc573 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -361,7 +361,7 @@ private: QTemporaryDir m_temporaryDir; const QString m_oldDir; - QString m_stdinProcessDir; + QString m_stdinProcess; QString m_testSourceFile; QString m_testLogFile; QString m_dosFile; @@ -442,8 +442,12 @@ void tst_QFile::initTestCase() { QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString())); #if QT_CONFIG(process) - m_stdinProcessDir = QFINDTESTDATA("stdinprocess"); - QVERIFY(!m_stdinProcessDir.isEmpty()); +#ifndef Q_OS_WIN + m_stdinProcess = QFINDTESTDATA("stdinprocess_helper"); +#else + m_stdinProcess = QFINDTESTDATA("stdinprocess_helper.exe"); +#endif + QVERIFY(!m_stdinProcess.isEmpty()); #endif m_testLogFile = QFINDTESTDATA("testlog.txt"); QVERIFY(!m_testLogFile.isEmpty()); @@ -962,7 +966,7 @@ void tst_QFile::readAllStdin() QProcess process; StdinReaderProcessGuard processGuard(&process); - process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), QStringList(QStringLiteral("all"))); + process.start(m_stdinProcess, QStringList(QStringLiteral("all"))); QVERIFY2(process.waitForStarted(), qPrintable(process.errorString())); for (int i = 0; i < 5; ++i) { QTest::qWait(1000); @@ -992,7 +996,7 @@ void tst_QFile::readLineStdin() for (int i = 0; i < 2; ++i) { QProcess process; StdinReaderProcessGuard processGuard(&process); - process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), + process.start(m_stdinProcess, QStringList() << QStringLiteral("line") << QString::number(i), QIODevice::Text | QIODevice::ReadWrite); QVERIFY2(process.waitForStarted(), qPrintable(process.errorString())); @@ -1025,7 +1029,7 @@ void tst_QFile::readLineStdin_lineByLine() for (int i = 0; i < 2; ++i) { QProcess process; StdinReaderProcessGuard processGuard(&process); - process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), + process.start(m_stdinProcess, QStringList() << QStringLiteral("line") << QString::number(i), QIODevice::Text | QIODevice::ReadWrite); QVERIFY2(process.waitForStarted(), qPrintable(process.errorString())); -- cgit v1.2.3