diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2014-01-10 14:19:21 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-01-10 14:27:44 +0100 |
commit | 921cbe22c4d3e82b484aa225f42292d867fd6e7e (patch) | |
tree | a45857370f25d18dcefedc1d21630f5bbb81f98b /tests/auto/blackbox | |
parent | e31b4a2bcc214e33cdc91a1aad52b95904a03091 (diff) | |
download | qbs-921cbe22c4d3e82b484aa225f42292d867fd6e7e.tar.gz |
Fix corner case in "up to date" check.
Currently, the timestamps of target artifacts (and only these) are
always retrieved from disk before checking whether artifacts are up to
date. This can lead to problems, for instance in the following scenario:
- The transformer creating the target artifact has another output
artifact, i.e. the target artifact has a non-target sibling.
- The sibling is created in a different command that runs after the
one creating the target artifact.
- While the command creating the target artifact is in progress, a
different, unrelated command running at the same time fails.
As a result, the executor will wait until the in-flight commands have
finished and then cancel the build, not running any commands still
queued for execution. This means that the target artifact will have a
different on-disk timestamps than its sibling.
On the next build, this newer timestamp will be retrieved. Since the
current code assumes that all sibling artifacts have the same timestamp,
it only checks one random output artifact. If that happens to be the
target artifact, the up-to-date check will report that the transformer
does not need to be re-run, even though one artifact is not up to date.
This patch fixes the two closely related subtle bugs that can lead to
this behavior:
1) Get rid of the "convenvience functionality" that always checks
the timestamp of target artifacts as a service to users that do not know
that they are not supposed to manually touch files in the build
directory. This behavior has been obsolete since the introduction of the
"--check-timestamps" option.
2) If the "--check-timestamps" option has been given, our invariant
about all output artifacts of a transformer having the same timestamp is
not guaranteed to hold, as they come from an outside source. Therefore,
in this case we must check the timestamps of all output artifacts, not
just one.
Change-Id: I482fe6060c0dee5fef74a9236a787dc7d40f3b24
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests/auto/blackbox')
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 481838c70..9b1b31520 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -252,7 +252,8 @@ void TestBlackbox::build_project() QVERIFY2(QFile::exists(productFileName), qPrintable(productFileName)); QVERIFY(QFile::exists(buildGraphPath)); QVERIFY2(QFile::remove(productFileName), qPrintable(productFileName)); - QCOMPARE(runQbs(), 0); + waitForNewTimestamp(); + QCOMPARE(runQbs(QbsRunParameters("--check-timestamps")), 0); QVERIFY2(QFile::exists(productFileName), qPrintable(productFileName)); QVERIFY(QFile::exists(buildGraphPath)); } |