diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2013-12-06 11:33:44 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-12-10 10:09:43 +0100 |
commit | 4acda4b49226ec7303b0e70a5a30751aa040134f (patch) | |
tree | 84a221ee2d885bb6c21b696df6525feec28ac9e0 /tests | |
parent | 78486a837723f37dfd1e443812dc68b768b9e1ce (diff) |
Observe access to project properties in prepare scripts and commands.
And use the stored information in change tracking.
Change-Id: I7f9be7798a1d93acc3694a25c7ba0fc92cdc66b0
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/blackbox/testdata/propertyChanges/project.qbs | 4 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 25 |
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/auto/blackbox/testdata/propertyChanges/project.qbs b/tests/auto/blackbox/testdata/propertyChanges/project.qbs index 9d35d0caa..0cba4f630 100644 --- a/tests/auto/blackbox/testdata/propertyChanges/project.qbs +++ b/tests/auto/blackbox/testdata/propertyChanges/project.qbs @@ -3,6 +3,7 @@ import qbs.TextFile Project { property var projectDefines: ["blubb2"] + property string fileContentSuffix: "suffix 1" CppApplication { name: qbs.enableDebugCode ? "product 1.debug" : "product 1.release" cpp.defines: ["blubb1"] @@ -48,7 +49,8 @@ Project { cmd.sourceCode = function() { file = new TextFile(output.fileName, TextFile.WriteOnly); file.truncate(); - file.write(product.fileContentPrefix + "contents 1"); + file.write(product.fileContentPrefix + "contents 1" + + project.fileContentSuffix); file.close(); } return cmd; diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 0351c03b5..23c86a926 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -1100,7 +1100,7 @@ void TestBlackbox::propertyChanges() QVERIFY(m_qbsStdout.contains("Making output from input")); QFile generatedFile(buildDir + QLatin1String("/generated.txt")); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); - QCOMPARE(generatedFile.readAll(), QByteArray("prefix 1contents 1")); + QCOMPARE(generatedFile.readAll(), QByteArray("prefix 1contents 1suffix 1")); generatedFile.close(); // Incremental build with no changes. @@ -1239,7 +1239,7 @@ void TestBlackbox::propertyChanges() QVERIFY(m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("Making output from input")); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); - QCOMPARE(generatedFile.readAll(), QByteArray("prefix 1contents 2")); + QCOMPARE(generatedFile.readAll(), QByteArray("prefix 1contents 2suffix 1")); generatedFile.close(); // Incremental build, product property used in JavaScript command changed. @@ -1258,7 +1258,26 @@ void TestBlackbox::propertyChanges() QVERIFY(m_qbsStdout.contains("generated.txt")); QVERIFY(!m_qbsStdout.contains("Making output from input")); QVERIFY(generatedFile.open(QIODevice::ReadOnly)); - QCOMPARE(generatedFile.readAll(), QByteArray("prefix 2contents 2")); + QCOMPARE(generatedFile.readAll(), QByteArray("prefix 2contents 2suffix 1")); + generatedFile.close(); + + // Incremental build, project property used in JavaScript command changed. + waitForNewTimestamp(); + QVERIFY(projectFile.open(QIODevice::ReadWrite)); + contents = projectFile.readAll(); + contents.replace("suffix 1", "suffix 2"); + projectFile.resize(0); + projectFile.write(contents); + projectFile.close(); + QCOMPARE(runQbs(params), 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("compiling lib.cpp")); + QVERIFY(m_qbsStdout.contains("generated.txt")); + QVERIFY(!m_qbsStdout.contains("Making output from input")); + QVERIFY(generatedFile.open(QIODevice::ReadOnly)); + QCOMPARE(generatedFile.readAll(), QByteArray("prefix 2contents 2suffix 2")); generatedFile.close(); // Incremental build, prepare script of a rule in a module changed. |