diff options
author | Richard Weickelt <richard@weickelt.de> | 2019-12-28 14:48:35 +0100 |
---|---|---|
committer | Richard Weickelt <richard@weickelt.de> | 2020-01-29 19:13:12 +0000 |
commit | 139ea745c07b7f2157a1d79e4c824c8b0db0ed08 (patch) | |
tree | c196a879b5af7d5665bd249f59c06c1e958583c3 /tests | |
parent | f4a8824164820c428ca9c686337f462a4a9ff43d (diff) |
Allow relaxed matching of multiplexed dependencies
If a multiplexed product depends on another multiplexed product, Qbs previously
forced all multiplexed properties to match exactly. Only if Depends.profiles was
specified, the comparison was limited to the qbs.profile property and all other
properties were ignored.
While strict matching is usually the natural choice, there are corner cases
where it limits the applicability of Qbs. For example when multiplexing product
A over buildVariant, but product B over buildVariant and architecture. In such
cases a relaxed matching would be desirable, where only the common properties of
A and B are considered. As long as there is only a single resulting dependency,
the dependency is unambiguous and safe.
Task-number: QBS-1515
Change-Id: I4ae6b413229bf1577311b4198d0596447e650816
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/api/testdata/multiplexing/multiplexing.qbs | 7 | ||||
-rw-r--r-- | tests/auto/api/tst_api.cpp | 25 | ||||
-rw-r--r-- | tests/auto/language/testdata/erroneous/ambiguous-multiplex-dependency.qbs | 14 | ||||
-rw-r--r-- | tests/auto/language/tst_language.cpp | 11 |
4 files changed, 54 insertions, 3 deletions
diff --git a/tests/auto/api/testdata/multiplexing/multiplexing.qbs b/tests/auto/api/testdata/multiplexing/multiplexing.qbs index 243c73d46..75958ed60 100644 --- a/tests/auto/api/testdata/multiplexing/multiplexing.qbs +++ b/tests/auto/api/testdata/multiplexing/multiplexing.qbs @@ -74,6 +74,13 @@ Project { qbs.architectures: ["TRS-80", "C64"] qbs.buildVariants: ["debug", "release"] } + Product { + name: "multiplex-without-aggregator-4-depends-2" + multiplexByQbsProperties: ["architectures", "buildVariants"] + qbs.architectures: ["TRS-80", "C64"] + qbs.buildVariants: ["debug", "release"] + Depends { name: "multiplex-without-aggregator-2" } + } } Product { diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 5f2645a14..3c3666489 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -1961,6 +1961,31 @@ void TestApi::multiplexing() QVERIFY(product.dependencies().empty()); selector.clear(); + selector.name = "multiplex-without-aggregator-4-depends-2"; + selector.qbsProperties["architecture"] = "C64"; + selector.qbsProperties["buildVariant"] = "debug"; + product = takeMatchingProduct(products, selector); + QVERIFY(product.isValid()); + QVERIFY(product.isMultiplexed()); + QCOMPARE(product.dependencies().size(), 1); + selector.qbsProperties["buildVariant"] = "release"; + product = takeMatchingProduct(products, selector); + QVERIFY(product.isValid()); + QVERIFY(product.isMultiplexed()); + QCOMPARE(product.dependencies().size(), 1); + selector.qbsProperties["architecture"] = "TRS-80"; + selector.qbsProperties["buildVariant"] = "debug"; + product = takeMatchingProduct(products, selector); + QVERIFY(product.isValid()); + QVERIFY(product.isMultiplexed()); + QCOMPARE(product.dependencies().size(), 1); + selector.qbsProperties["buildVariant"] = "release"; + product = takeMatchingProduct(products, selector); + QVERIFY(product.isValid()); + QVERIFY(product.isMultiplexed()); + QCOMPARE(product.dependencies().size(), 1); + + selector.clear(); selector.name = "multiplex-with-aggregator-2"; selector.qbsProperties["architecture"] = "C64"; product = takeMatchingProduct(products, selector); diff --git a/tests/auto/language/testdata/erroneous/ambiguous-multiplex-dependency.qbs b/tests/auto/language/testdata/erroneous/ambiguous-multiplex-dependency.qbs new file mode 100644 index 000000000..6f60b1faf --- /dev/null +++ b/tests/auto/language/testdata/erroneous/ambiguous-multiplex-dependency.qbs @@ -0,0 +1,14 @@ +Project { + Product { + name: "a" + multiplexByQbsProperties: ["architectures", "buildVariants"] + qbs.architectures: ["x86", "arm"] + qbs.buildVariants: ["debug", "release"] + } + Product { + name: "b" + Depends { name: "a" } + multiplexByQbsProperties: ["architectures"] + qbs.architectures: ["x86", "arm"] + } +} diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp index c4b8dc6a0..cc87fb750 100644 --- a/tests/auto/language/tst_language.cpp +++ b/tests/auto/language/tst_language.cpp @@ -925,9 +925,14 @@ void TestLanguage::erroneousFiles_data() << "original-in-export-item3.qbs:6:9.*Item 'x.y' is not declared. Did you forget " "to add a Depends item"; QTest::newRow("mismatching-multiplex-dependency") - << "mismatching-multiplex-dependency.qbs:7:5.*Dependency from product " - "'b \\{\"architecture\":\"mips\"\\}' to product 'a \\{\"architecture\":\"mips\"\\}'" - " not fulfilled."; + << "mismatching-multiplex-dependency.qbs:9:9.*Dependency from product " + "'b \\{\"architecture\":\"mips\"\\}' to product 'a'" + " not fulfilled. There are no eligible multiplex candidates."; + QTest::newRow("ambiguous-multiplex-dependency") + << "ambiguous-multiplex-dependency.qbs:10:9.*Dependency from product 'b " + "\\{\"architecture\":\"x86\"\\}' to product 'a' is ambiguous. Eligible multiplex " + "candidates: a \\{\"architecture\":\"x86\",\"buildVariant\":\"debug\"\\}, " + "a \\{\"architecture\":\"x86\",\"buildVariant\":\"release\"\\}."; QTest::newRow("dependency-profile-mismatch") << "dependency-profile-mismatch.qbs:10:5.*Product 'main' depends on 'dep', " "which does not exist for the requested profile 'profile47'."; |