diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-08-11 16:30:34 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-08-14 09:10:59 +0000 |
commit | fe79dab20ef733216aa9fa724acd4c12017ceb52 (patch) | |
tree | 75ec7b1bb750d19b71eb6ef3f2d244679ff89382 /tests/auto/blackbox/tst_blackboxqt.cpp | |
parent | 86a00a13dcf2b107b2aca66b565e0d6151f6bd07 (diff) | |
download | qbs-fe79dab20ef733216aa9fa724acd4c12017ceb52.tar.gz |
Fix edge case in change tracking
If we have a moc'able header file whose moc output is included by the
cpp file, then it is an error not to list that header in the project
file, because moc will not run on it and the included moc_cpp file won't
be present, causing a compiler error. However, if the header was
originally listed in the project file and removed from it after
building, then the next attempt to build would still succeed, because
the generated artifact would only be removed from disk at the end of the
build process.
Fix this by amending the code that checks for removed child artifacts to
remove them from disk immediately, making sure a rebuild will not
accidentally succeed.
Change-Id: I4f69560cc899dbc61938acc1c697aa93407dc03c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/tst_blackboxqt.cpp')
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 71f384b7a..14086401e 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -256,6 +256,31 @@ void TestBlackboxQt::qtScxml() m_qbsStdout.constData()); } +void TestBlackboxQt::removeMocHeaderFromFileList() +{ + QDir::setCurrent(testDataDir + "/remove-moc-header-from-file-list"); + QCOMPARE(runQbs(), 0); + WAIT_FOR_NEW_TIMESTAMP(); + QFile projectFile("remove-moc-header-from-file-list.qbs"); + QVERIFY2(projectFile.open(QIODevice::ReadWrite), qPrintable(projectFile.errorString())); + QByteArray content = projectFile.readAll(); + content.replace("\"file.h\"", "// \"file.h\""); + projectFile.resize(0); + projectFile.write(content); + projectFile.close(); + QbsRunParameters params; + params.expectFailure = true; + QVERIFY(runQbs(params) != 0); + WAIT_FOR_NEW_TIMESTAMP(); + QVERIFY2(projectFile.open(QIODevice::ReadWrite), qPrintable(projectFile.errorString())); + content = projectFile.readAll(); + content.replace("// \"file.h\"", "\"file.h\""); + projectFile.resize(0); + projectFile.write(content); + projectFile.close(); + QCOMPARE(runQbs(), 0); +} + void TestBlackboxQt::staticQtPluginLinking() { |