summaryrefslogtreecommitdiff
path: root/tests/auto/blackbox/tst_blackboxqt.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-07-10 15:58:51 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-07-16 09:01:46 +0000
commit4a0f385213148875859689c193f15f372f90802d (patch)
tree0c08d82081bcce1d13f9cb5477b671177a688d65 /tests/auto/blackbox/tst_blackboxqt.cpp
parentfacd941064fbdad2a89ddc557e6540a2869a962f (diff)
downloadqbs-4a0f385213148875859689c193f15f372f90802d.tar.gz
RuleNode: Fix calculation of changed inputs
The old code had a number of problems: - It partially overlapped with the calculation of compatible inputs. - It was wrong in that it failed to consider inputs from dependencies. - It was wrong in that it assumed that after rule application, input artifacts always have parent artifacts to later compare timestamps with. This is not the case for e.g. a generated cpp file without a Q_OBJECT macro on which moc is run: No transformer is created in such a case, because the outputArtifacts array is empty. The last problem was glossed over by the fact that we held a global list of "changed source artifacts" in the executor, so such changes were spotted when they happened in source artifacts. However, that code was also rather dubious in itself because the criterion for "changed" was that the timestamp was newer than it was on the last run of the executor, so I don't think it was completely safe when doing partial builds. We solve these problems by remembering when we last applied the rule. An input artifact is considered "changed" if it has been modified after that. Change-Id: Ib1bafd9e1078122776626155c4f2cc11ad622191 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.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp
index 3ab2c601c..07c583bf1 100644
--- a/tests/auto/blackbox/tst_blackboxqt.cpp
+++ b/tests/auto/blackbox/tst_blackboxqt.cpp
@@ -64,6 +64,17 @@ void TestBlackboxQt::validateTestProfile()
"in the global search paths."));
}
+void TestBlackboxQt::addQObjectMacroToGeneratedCppFile()
+{
+ QDir::setCurrent(testDataDir + "/add-qobject-macro-to-generated-cpp-file");
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(!m_qbsStdout.contains("moc"), m_qbsStdout.constData());
+ WAIT_FOR_NEW_TIMESTAMP();
+ REPLACE_IN_FILE("object.cpp.in", "// ", "");
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(m_qbsStdout.contains("moc"), m_qbsStdout.constData());
+}
+
void TestBlackboxQt::autoQrc()
{
QDir::setCurrent(testDataDir + "/auto-qrc");