aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2016-05-04 14:09:26 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2016-05-04 12:26:15 +0000
commite2b5a900a2aa5f7772b928a8634da07ebafa88af (patch)
tree128eaf6162a8e84b0e9d28e19e4394c56267e375
parent11c2b638fbc3ae5ea682c97ec009e81adb2f6c95 (diff)
Fix wrong assumption about transformer output timestamps.
It is true that all outputs of a transformer get the same timestamp after it has run successfully, but a new output being added afterwards will have no timestamp at all, so we cannot rely on that as part of the up-to-date check. Task-number: QBS-945 Change-Id: I5568ec9854fca46c1ca9fbd5cc95c9b1e3351c05 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r--src/lib/corelib/buildgraph/executor.cpp9
-rw-r--r--tests/auto/blackbox/testdata/new-output-artifact/input.txt0
-rw-r--r--tests/auto/blackbox/testdata/new-output-artifact/new-output-artifact.qbs37
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp12
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
5 files changed, 52 insertions, 7 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp
index 150133c04..be5a93302 100644
--- a/src/lib/corelib/buildgraph/executor.cpp
+++ b/src/lib/corelib/buildgraph/executor.cpp
@@ -392,13 +392,8 @@ bool Executor::mustExecuteTransformer(const TransformerPtr &transformer) const
hasAlwaysUpdatedArtifacts = true;
else if (!m_buildOptions.forceTimestampCheck())
continue;
- const bool upToDate = isUpToDate(artifact);
-
- // The invariant is that all output artifacts of a transformer have the same
- // "virtual" timestamp. However, if the user requested that on-disk timestamps be evaluated,
- // they can differ and the oldest output file of the transformer decides.
- if (!upToDate || !m_buildOptions.forceTimestampCheck())
- return !upToDate;
+ if (!isUpToDate(artifact))
+ return true;
}
// If all artifacts in a transformer have "alwaysUpdated" set to false, that transformer
diff --git a/tests/auto/blackbox/testdata/new-output-artifact/input.txt b/tests/auto/blackbox/testdata/new-output-artifact/input.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/blackbox/testdata/new-output-artifact/input.txt
diff --git a/tests/auto/blackbox/testdata/new-output-artifact/new-output-artifact.qbs b/tests/auto/blackbox/testdata/new-output-artifact/new-output-artifact.qbs
new file mode 100644
index 000000000..10e0e4305
--- /dev/null
+++ b/tests/auto/blackbox/testdata/new-output-artifact/new-output-artifact.qbs
@@ -0,0 +1,37 @@
+import qbs
+import qbs.TextFile
+
+Product {
+ name: "theProduct"
+ type: ["output"]
+ property int artifactCount: 99
+ Group {
+ files: ["input.txt"]
+ fileTags: ["input"]
+ }
+ Group {
+ fileTagsFilter: product.type
+ qbs.install: true
+ }
+ Rule {
+ inputs: ["input"]
+ outputFileTags: ["output"]
+ outputArtifacts: {
+ var list = [];
+ for (var i = 0; i < product.artifactCount; ++i)
+ list.push({ filePath: "output_" + i + ".out", fileTags: ["output"]});
+ return list;
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.silent = true;
+ cmd.sourceCode = function() {
+ for (var i = 0; i < outputs["output"].length; ++i) {
+ var f = new TextFile(outputs["output"][i].filePath, TextFile.WriteOnly);
+ f.close();
+ }
+ }
+ return [cmd];
+ }
+ }
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 8fe5f4922..8eed518be 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -2613,6 +2613,18 @@ void TestBlackbox::nestedProperties()
QVERIFY2(m_qbsStdout.contains("value in higherlevel"), m_qbsStdout.constData());
}
+void TestBlackbox::newOutputArtifact()
+{
+ QDir::setCurrent(testDataDir + "/new-output-artifact");
+ QCOMPARE(runQbs(), 0);
+ QVERIFY(regularFileExists(relativeBuildDir() + "/install-root/output_98.out"));
+ const QString the100thArtifact = relativeBuildDir() + "/install-root/output_99.out";
+ QVERIFY(!regularFileExists(the100thArtifact));
+ QbsRunParameters params(QStringList() << "theProduct.artifactCount:100");
+ QCOMPARE(runQbs(params), 0);
+ QVERIFY(regularFileExists(the100thArtifact));
+}
+
void TestBlackbox::nonBrokenFilesInBrokenProduct()
{
QDir::setCurrent(testDataDir + "/non-broken-files-in-broken-product");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index e1f9456ca..048c4987b 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -162,6 +162,7 @@ private slots:
void mixedBuildVariants();
void multipleChanges();
void nestedProperties();
+ void newOutputArtifact();
void nodejs();
void nonBrokenFilesInBrokenProduct();
void nonDefaultProduct();