diff options
| author | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-10-14 11:34:42 +0200 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-10-14 17:03:17 +0200 |
| commit | c939d3bb79619229626ccd02ea7deabe5debf060 (patch) | |
| tree | cd69e3f8b699665aad9d7d2e80323f2ab08a6924 /tests | |
| parent | 3343f681c71f821aa9460f184c30e5ecf3781776 (diff) | |
| download | qbs-c939d3bb79619229626ccd02ea7deabe5debf060.tar.gz | |
detect cycles in rule dependencies
This fixes a stack overflow that occurred when having cycles in rule
dependencies.
Task-number: QBS-396
Change-Id: I1907ef66d74340c090b09be72d2352892baca986
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auto/blackbox/testdata/ruleCycle/happy.grass | 1 | ||||
| -rw-r--r-- | tests/auto/blackbox/testdata/ruleCycle/ruleCycle.qbs | 45 | ||||
| -rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 9 | ||||
| -rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
4 files changed, 56 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/ruleCycle/happy.grass b/tests/auto/blackbox/testdata/ruleCycle/happy.grass new file mode 100644 index 000000000..8cf7f02e3 --- /dev/null +++ b/tests/auto/blackbox/testdata/ruleCycle/happy.grass @@ -0,0 +1 @@ +happy! happy! joy! joy! diff --git a/tests/auto/blackbox/testdata/ruleCycle/ruleCycle.qbs b/tests/auto/blackbox/testdata/ruleCycle/ruleCycle.qbs new file mode 100644 index 000000000..34d052e0a --- /dev/null +++ b/tests/auto/blackbox/testdata/ruleCycle/ruleCycle.qbs @@ -0,0 +1,45 @@ +import qbs 1.0 + +Project { + Product { + name: "the cycle of life" + type: "cow" + Group { + files: ["happy.grass"] + fileTags: ["grass"] + } + Rule { + inputs: ["grass"] + Artifact { + fileName: input.completeBaseName + ".cow" + fileTags: ["cow"] + } + prepare: { print("The cow feeds on grass."); } + } + Rule { + inputs: ["cow"] + Artifact { + fileName: input.completeBaseName + ".cow_pat" + fileTags: ["cow_pat"] + } + prepare: { print("The cow pat falls out of the cow."); } + } + Rule { + inputs: ["cow_pat"] + Artifact { + fileName: input.completeBaseName + ".fertilizer" + fileTags: ["fertilizer"] + } + prepare: { print("The cow pat is used as fertilizer."); } + } + Rule { + inputs: ["fertilizer"] + Artifact { + fileName: input.completeBaseName + ".grass" + fileTags: ["grass"] + } + prepare: { print("The fertilizer lets the grass grow."); } + } + } +} + diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 84a5ad696..a78b68711 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -927,6 +927,15 @@ void TestBlackbox::ruleConditions() QVERIFY(!QFileInfo(buildDir + "/unzorted.foo.narf.zort").exists()); } +void TestBlackbox::ruleCycle() +{ + QDir::setCurrent(testDataDir + "/ruleCycle"); + QbsRunParameters params; + params.expectFailure = true; + QVERIFY(runQbs(params) != 0); + QVERIFY(m_qbsStderr.contains("Cycle detected in rule dependencies")); +} + void TestBlackbox::trackAddQObjectHeader() { QDir::setCurrent(testDataDir + "/missingqobjectheader"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 124ed204f..6d4770d34 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -129,6 +129,7 @@ private slots: void recursiveRenaming(); void recursiveWildcards(); void ruleConditions(); + void ruleCycle(); void trackAddQObjectHeader(); void trackRemoveQObjectHeader(); void overrideProjectProperties(); |
