aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-08-06 15:08:28 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-08-06 15:48:26 +0200
commit3871bb116d893c5bd405c32217aceaf8824d9bbc (patch)
tree1f20e5647b54b24bfe9f0c171fb3c70b5e35f4b5 /tests/auto
parentc6ee3922806999e0b22ece745cde88630e1ec67f (diff)
enhance TestBlackbox::changedFiles
It makes a difference whether we start from an initial build with or without the --changed-files option. An initial build without the --changed-files options followed by an incremental build with --changed-files unveils QBS-660. Task-number: QBS-660 Change-Id: Iee8466dd203bed01cf053c8eb78d7b960f20a035 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/blackbox/testdata/changed-files/project.qbs24
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp25
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
3 files changed, 46 insertions, 4 deletions
diff --git a/tests/auto/blackbox/testdata/changed-files/project.qbs b/tests/auto/blackbox/testdata/changed-files/project.qbs
index 7fedd66d5..82411a659 100644
--- a/tests/auto/blackbox/testdata/changed-files/project.qbs
+++ b/tests/auto/blackbox/testdata/changed-files/project.qbs
@@ -1,5 +1,29 @@
import qbs
+import qbs.TextFile
CppApplication {
+ type: ["application", "stuff"]
files: ["file1.cpp", "file2.cpp", "main.cpp"]
+
+ Rule {
+ inputs: ["cpp"]
+ outputFileTags: ["stuff"]
+ outputArtifacts: {
+ return [{
+ filePath: input.completeBaseName + ".stuff",
+ fileTags: ["stuff"]
+ }];
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.description = "creating " + output.fileName
+ cmd.sourceCode = function() {
+ var f = new TextFile(output.filePath, TextFile.WriteOnly);
+ f.write("crazy stuff");
+ f.close();
+ }
+ return cmd;
+ }
+ }
}
+
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 7c5ce29f0..452e7759b 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -384,23 +384,40 @@ void TestBlackbox::changeDependentLib()
QCOMPARE(runQbs(), 0);
}
+void TestBlackbox::changedFiles_data()
+{
+ QTest::addColumn<bool>("useChangedFilesForInitialBuild");
+ QTest::newRow("initial build with changed files") << true;
+ QTest::newRow("initial build without changed files") << false;
+}
+
void TestBlackbox::changedFiles()
{
+ QFETCH(bool, useChangedFilesForInitialBuild);
+
QDir::setCurrent(testDataDir + "/changed-files");
+ rmDirR(buildDir);
const QString changedFile = QDir::cleanPath(QDir::currentPath() + "/file1.cpp");
- QbsRunParameters params(QStringList("--changed-files") << changedFile);
+ QbsRunParameters params1;
+ if (useChangedFilesForInitialBuild)
+ params1 = QbsRunParameters(QStringList("--changed-files") << changedFile);
- // Initial run: Build all files, even though only one of them was marked as changed.
- QCOMPARE(runQbs(params), 0);
+ // Initial run: Build all files, even though only one of them was marked as changed
+ // (if --changed-files was used).
+ QCOMPARE(runQbs(params1), 0);
QCOMPARE(m_qbsStdout.count("compiling"), 3);
+ QCOMPARE(m_qbsStdout.count("creating"), 3);
waitForNewTimestamp();
touch(QDir::currentPath() + "/main.cpp");
// Now only the file marked as changed must be compiled, even though it hasn't really
// changed and another one has.
- QCOMPARE(runQbs(params), 0);
+ QbsRunParameters params2(QStringList("--changed-files") << changedFile);
+ QCOMPARE(runQbs(params2), 0);
QCOMPARE(m_qbsStdout.count("compiling"), 1);
+ QEXPECT_FAIL("initial build without changed files", "QBS-660", Continue);
+ QCOMPARE(m_qbsStdout.count("creating"), 1);
QVERIFY2(m_qbsStdout.contains("file1.cpp"), m_qbsStdout.constData());
}
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 066d46f5b..1ce6003c3 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -104,6 +104,7 @@ private slots:
void build_project_dry_run_data();
void build_project_dry_run();
void changeDependentLib();
+ void changedFiles_data();
void changedFiles();
void dependenciesProperty();
void disabledProduct();