aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-08-06 11:48:28 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-08 11:05:28 +0000
commit1e9c7c948c8c8b896434484d047d12efc93a2342 (patch)
tree3250877de9849c56646d66140beffd2394afc6ae /tests
parent66131652f178cd1605b8a2c0ba7023392e13ad5a (diff)
ModuleLoader: Fix edge case in Depends.productTypes
It makes no sense to consider multiplexed variants of the same product. Change-Id: I7ebee091264451dc587156a0c543932059ed9948 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs18
-rw-r--r--tests/auto/api/tst_api.cpp43
-rw-r--r--tests/auto/api/tst_api.h1
3 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs b/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs
new file mode 100644
index 000000000..cfc2769d2
--- /dev/null
+++ b/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs
@@ -0,0 +1,18 @@
+import qbs
+
+Project {
+ Product { name: "dep"; type: "x" }
+ Product {
+ name: "p1"
+ multiplexByQbsProperties: "architectures"
+ qbs.architectures: ["a", "b"]
+ aggregate: true
+ Depends { productTypes: "x" }
+ multiplexedType: "x"
+ }
+ Product {
+ name: "p2"
+ Depends { productTypes: "x" }
+ }
+}
+
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index 282d04722..9e43f0218 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -965,6 +965,49 @@ void TestApi::commandExtraction()
QVERIFY(!command.arguments().empty());
}
+void TestApi::dependencyOnMultiplexedType()
+{
+ qbs::SetupProjectParameters setupParams
+ = defaultSetupParameters("/dependency-on-multiplexed-type");
+ std::unique_ptr<qbs::SetupProjectJob> setupJob(qbs::Project().setupProject(setupParams,
+ m_logSink, 0));
+ waitForFinished(setupJob.get());
+ QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString()));
+ qbs::Project project = setupJob->project();
+ qbs::ProjectData projectData = project.projectData();
+ const QList<qbs::ProductData> allProducts = projectData.allProducts();
+ QCOMPARE(allProducts.size(), 5);
+ int depCount = 0;
+ int p1Count = 0;
+ int p2Count = 0;
+ for (const qbs::ProductData &p : allProducts) {
+ if (p.name() == "dep") {
+ ++depCount;
+ QCOMPARE(p.dependencies().size(), 0);
+ } else if (p.name() == "p1") {
+ ++p1Count;
+ if (p.multiplexConfigurationId().isEmpty()) // aggregate
+ QCOMPARE(p.dependencies().size(), 3);
+ else
+ QCOMPARE(p.dependencies().size(), 1);
+ } else {
+ QVERIFY(p.name() == "p2");
+ ++p2Count;
+
+ // FIXME: This is an odd effect of our current algorithm: We collect the products
+ // matching the requested type and add Depends items with their names ("p1" in
+ // this case). Later, the algorithm checking for compatibility regarding the
+ // multiplexing axes picks the aggregate. However, the aggregate does not have
+ // a matching type... It's not entirely clear what the real expected
+ // result should be here.
+ QCOMPARE(p.dependencies().size(), 2);
+ }
+ }
+ std::unique_ptr<qbs::BuildJob> buildJob(project.buildAllProducts(qbs::BuildOptions()));
+ waitForFinished(buildJob.get());
+ QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString()));
+}
+
void TestApi::changeDependentLib()
{
qbs::ErrorInfo errorInfo = doBuildProject("change-dependent-lib");
diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h
index 26f6655ad..a77b20344 100644
--- a/tests/auto/api/tst_api.h
+++ b/tests/auto/api/tst_api.h
@@ -75,6 +75,7 @@ private slots:
void checkOutputs();
void checkOutputs_data();
void commandExtraction();
+ void dependencyOnMultiplexedType();
void disabledInstallGroup();
void disabledProduct();
void disabledProject();