diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-08-31 17:39:43 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-09-03 09:53:13 +0000 |
commit | f57ca14b2c2eeac1f7fedd863dc503be4638bee2 (patch) | |
tree | 6ccc4a935d4e38eaeac6a29360f45ed3b4eae843 | |
parent | 106a2b5877a26a4cd7a1c9e9542e0dc392cb2437 (diff) |
Executor: Fix invalid assertion
An artifact whose alwaysUpdated property is false does not need to exist
and is therefore not required to have a valid timestamp.
Change-Id: I642349c49a53e6e45d6b09d1acc87f4c9a0edae9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | changelogs/changes-1.12.1.md | 1 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/executor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/not-always-updated/not-always-updated.qbs | 31 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 7 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
5 files changed, 41 insertions, 1 deletions
diff --git a/changelogs/changes-1.12.1.md b/changelogs/changes-1.12.1.md index e4edeb136..d9f105941 100644 --- a/changelogs/changes-1.12.1.md +++ b/changelogs/changes-1.12.1.md @@ -5,3 +5,4 @@ * Fixed possible crash when scanning qrc files (QBS-1375). * Fixed spurious re-building of .pc and .qbs module files. * Fixed possible crash on storing a build graph after re-resolving. +* Fixed possible assertion on input artifacts with alwaysUpdated == false. diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index d2c245c8a..42e3eee8c 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -397,7 +397,7 @@ bool Executor::isUpToDate(Artifact *artifact) const } for (Artifact *childArtifact : filterByType<Artifact>(artifact->children)) { - QBS_CHECK(childArtifact->timestamp().isValid()); + QBS_CHECK(!childArtifact->alwaysUpdated || childArtifact->timestamp().isValid()); qCDebug(lcUpToDateCheck) << "child timestamp" << childArtifact->timestamp().toString() << childArtifact->filePath(); diff --git a/tests/auto/blackbox/testdata/not-always-updated/not-always-updated.qbs b/tests/auto/blackbox/testdata/not-always-updated/not-always-updated.qbs new file mode 100644 index 000000000..8d6c1f5da --- /dev/null +++ b/tests/auto/blackbox/testdata/not-always-updated/not-always-updated.qbs @@ -0,0 +1,31 @@ +import qbs.TextFile + +Product { + type: "p" + Rule { + multiplex: true + Artifact { filePath: "dummy.txt"; fileTags: "t1"; alwaysUpdated: false } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "creating dummy"; + cmd.sourceCode = function() {}; + return cmd; + } + } + Rule { + inputs: "t1" + Artifact { filePath: "o.txt"; fileTags: "p" } + prepare: { + var cmd = new JavaScriptCommand; + cmd.description = "creating final"; + cmd.sourceCode = function() { + var f = new TextFile(output.filePath, TextFile.WriteOnly); + f.close(); + }; + return cmd; + } + } +} + + + diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 8068aee48..0a846ede7 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -4337,6 +4337,13 @@ void TestBlackbox::nonDefaultProduct() QVERIFY2(QFile::exists(nonDefaultAppExe), qPrintable(nonDefaultAppExe)); } +void TestBlackbox::notAlwaysUpdated() +{ + QDir::setCurrent(testDataDir + "/not-always-updated"); + QCOMPARE(runQbs(), 0); + QCOMPARE(runQbs(), 0); +} + static void switchProfileContents(qbs::Profile &p, qbs::Settings *s, bool on) { const QString scalarKey = "leaf.scalarProp"; diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 0dcfc5b31..58cc8f6fb 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -183,6 +183,7 @@ private slots: void nodejs(); void nonBrokenFilesInBrokenProduct(); void nonDefaultProduct(); + void notAlwaysUpdated(); void nsis(); void nsisDependencies(); void outOfDateMarking(); |