diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2013-08-15 13:18:40 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-08-19 11:10:06 +0200 |
commit | 68ee1563d1d99d05b1ce8e74263fdbbc32d27c21 (patch) | |
tree | e23a7fc9c7d0273bd6c4c149f6f8da45d2ce0b5f /tests | |
parent | cfcf54a97112a7f50de96bab8161fce5e0502a99 (diff) | |
download | qbs-68ee1563d1d99d05b1ce8e74263fdbbc32d27c21.tar.gz |
Even better handling of property changes when restoring a build graph.
In detail:
- Fix the build config comparison function so that it not only
checks whether keys present in both maps are the same, but also whether
there are additional keys in one of the maps.
- Do not abort loading a restored build graph when the comparison
fails; instead, handle that condition the same way we handle changes in
build system files, environment variables etc; that is, re-resolve the
project and check whether the build data needs to be set up from
scratch for any products.
- Take overridden properties into account when comparing the
old and new property maps. This has no effect on the command line
client at the moment, because it does its own merging, but
other API clients will benefit.
A particularly nice "side effect" of this patch is that changing
properties on the command line now works as expected with regards to
change tracking.
Task-number: QBS-374
Change-Id: I55583fb7a2ae78b80de225b09aa559229d851339
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/blackbox/testdata/propertyChanges/project.qbs | 2 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 49 |
2 files changed, 39 insertions, 12 deletions
diff --git a/tests/auto/blackbox/testdata/propertyChanges/project.qbs b/tests/auto/blackbox/testdata/propertyChanges/project.qbs index 045c96f22..13c568ec5 100644 --- a/tests/auto/blackbox/testdata/propertyChanges/project.qbs +++ b/tests/auto/blackbox/testdata/propertyChanges/project.qbs @@ -4,7 +4,7 @@ import qbs.TextFile Project { property var projectDefines: ["blubb2"] CppApplication { - name: "product 1" + name: qbs.enableDebugCode ? "product 1.debug" : "product 1.release" cpp.defines: ["blubb1"] files: "source1.cpp" } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index c45581f7c..8e012b1da 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -984,6 +984,7 @@ void TestBlackbox::propertyChanges() QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(m_qbsStdout.contains("linking product 1.debug")); QVERIFY(m_qbsStdout.contains("generated.txt")); QFile generatedFile(buildDir + QLatin1String("/generated.txt")); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); @@ -995,6 +996,7 @@ void TestBlackbox::propertyChanges() QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(!m_qbsStdout.contains("linking")); QVERIFY(!m_qbsStdout.contains("generated.txt")); // Incremental build with no changes, but updated project file timestamp. @@ -1006,6 +1008,7 @@ void TestBlackbox::propertyChanges() QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(!m_qbsStdout.contains("linking")); QVERIFY(!m_qbsStdout.contains("generated.txt")); // Incremental build, input property changed for first product @@ -1018,8 +1021,9 @@ void TestBlackbox::propertyChanges() projectFile.close(); QCOMPARE(runQbs(), 0); QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); - QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); - QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(m_qbsStdout.contains("linking product 1.debug")); + QVERIFY(!m_qbsStdout.contains("linking product 2")); + QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("generated.txt")); // Incremental build, input property changed via project for second product. @@ -1031,26 +1035,49 @@ void TestBlackbox::propertyChanges() projectFile.write(contents); projectFile.close(); QCOMPARE(runQbs(), 0); - QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); + QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); - QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("generated.txt")); // Incremental build, input property changed via command line for second product. - waitForNewTimestamp(); QCOMPARE(runQbs(QbsRunParameters(QLatin1String("project.projectDefines:blubb002"))), 0); - QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); - QEXPECT_FAIL(0, "Command-line overrides not taking part in property tracking atm", Continue); + QVERIFY(!m_qbsStdout.contains("linking product 1")); QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); - QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(!m_qbsStdout.contains("linking product 3")); + QVERIFY(!m_qbsStdout.contains("generated.txt")); + QCOMPARE(runQbs(), 0); + QVERIFY(!m_qbsStdout.contains("linking product 1")); + QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); + QVERIFY(!m_qbsStdout.contains("linking product 3")); QVERIFY(!m_qbsStdout.contains("generated.txt")); // Incremental build, input property changed via environment for third product. QbsRunParameters params; params.environment.insert("QBS_BLACKBOX_DEFINE", "newvalue"); QCOMPARE(runQbs(params), 0); - QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); - QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); + QVERIFY(!m_qbsStdout.contains("linking product 1")); + QVERIFY(!m_qbsStdout.contains("linking product 2")); + QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(!m_qbsStdout.contains("generated.txt")); + params.environment.clear(); + QCOMPARE(runQbs(params), 0); + QVERIFY(!m_qbsStdout.contains("linking product 1")); + QVERIFY(!m_qbsStdout.contains("linking product 2")); + QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(!m_qbsStdout.contains("generated.txt")); + + // Incremental build, module property changed via command line. + QCOMPARE(runQbs(QbsRunParameters(QLatin1String("qbs.enableDebugCode:false"))), 0); + QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); + QVERIFY(m_qbsStdout.contains("linking product 1.release")); + QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); + QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); + QVERIFY(!m_qbsStdout.contains("generated.txt")); + QCOMPARE(runQbs(), 0); + QVERIFY(m_qbsStdout.contains("compiling source1.cpp")); + QVERIFY(m_qbsStdout.contains("linking product 1.debug")); + QVERIFY(m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(m_qbsStdout.contains("compiling source3.cpp")); QVERIFY(!m_qbsStdout.contains("generated.txt")); @@ -1062,7 +1089,7 @@ void TestBlackbox::propertyChanges() projectFile.resize(0); projectFile.write(contents); projectFile.close(); - QCOMPARE(runQbs(params), 0); + QCOMPARE(runQbs(), 0); QVERIFY(!m_qbsStdout.contains("compiling source1.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source2.cpp")); QVERIFY(!m_qbsStdout.contains("compiling source3.cpp")); |