aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-08-10 12:53:45 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-10 12:53:45 +0200
commit0135957c349579d28256d05da342ea79b560bc77 (patch)
tree994bf999196955596245bf3abe1eb4cba069aaaf /tests
parent6464a075c5edfafb3a88bfc4097b3d5d9b9cdb28 (diff)
parent349baf79883a96fdd85325a2900997fbf574f9a8 (diff)
Merge 1.12 into master
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
-rw-r--r--tests/auto/blackbox/testdata/module-conditions/module-conditions.qbs21
-rw-r--r--tests/auto/blackbox/testdata/module-conditions/modules/m/m1.qbs6
-rw-r--r--tests/auto/blackbox/testdata/module-conditions/modules/m/m2.qbs6
-rw-r--r--tests/auto/blackbox/testdata/module-conditions/modules/m/m3.qbs6
-rw-r--r--tests/auto/blackbox/testdata/module-conditions/modules/m/m4.qbs6
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp10
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
10 files changed, 118 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 185a90c56..f7e7b82c9 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 9207a7328..ff32c8634 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();
diff --git a/tests/auto/blackbox/testdata/module-conditions/module-conditions.qbs b/tests/auto/blackbox/testdata/module-conditions/module-conditions.qbs
new file mode 100644
index 000000000..dc3768203
--- /dev/null
+++ b/tests/auto/blackbox/testdata/module-conditions/module-conditions.qbs
@@ -0,0 +1,21 @@
+import qbs
+
+Project {
+ Product {
+ name: "p1"
+ qbs.architecture: "a"
+ Depends { name: "m" }
+ }
+ Product {
+ name: "p2"
+ qbs.architecture: "b"
+ Depends { name: "m" }
+ }
+ Product {
+ name: "p3"
+ multiplexByQbsProperties: "architectures"
+ aggregate: false
+ qbs.architectures: ["b", "c", "d"]
+ Depends { name: "m" }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/module-conditions/modules/m/m1.qbs b/tests/auto/blackbox/testdata/module-conditions/modules/m/m1.qbs
new file mode 100644
index 000000000..884350c3f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/module-conditions/modules/m/m1.qbs
@@ -0,0 +1,6 @@
+Module {
+ condition: qbs.architecture === "a"
+ validate: {
+ console.info("loaded m1");
+ }
+}
diff --git a/tests/auto/blackbox/testdata/module-conditions/modules/m/m2.qbs b/tests/auto/blackbox/testdata/module-conditions/modules/m/m2.qbs
new file mode 100644
index 000000000..bcec6f424
--- /dev/null
+++ b/tests/auto/blackbox/testdata/module-conditions/modules/m/m2.qbs
@@ -0,0 +1,6 @@
+Module {
+ condition: qbs.architecture === "b"
+ validate: {
+ console.info("loaded m2");
+ }
+}
diff --git a/tests/auto/blackbox/testdata/module-conditions/modules/m/m3.qbs b/tests/auto/blackbox/testdata/module-conditions/modules/m/m3.qbs
new file mode 100644
index 000000000..5453c617f
--- /dev/null
+++ b/tests/auto/blackbox/testdata/module-conditions/modules/m/m3.qbs
@@ -0,0 +1,6 @@
+Module {
+ condition: qbs.architecture === "c"
+ validate: {
+ console.info("loaded m3");
+ }
+}
diff --git a/tests/auto/blackbox/testdata/module-conditions/modules/m/m4.qbs b/tests/auto/blackbox/testdata/module-conditions/modules/m/m4.qbs
new file mode 100644
index 000000000..a4cb0350d
--- /dev/null
+++ b/tests/auto/blackbox/testdata/module-conditions/modules/m/m4.qbs
@@ -0,0 +1,6 @@
+Module {
+ condition: qbs.architecture === "d"
+ validate: {
+ console.info("loaded m4");
+ }
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index b79e7063c..5855a1799 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -6278,6 +6278,16 @@ void TestBlackbox::missingOverridePrefix()
m_qbsStderr.constData());
}
+void TestBlackbox::moduleConditions()
+{
+ QDir::setCurrent(testDataDir + "/module-conditions");
+ QCOMPARE(runQbs(), 0);
+ QCOMPARE(m_qbsStdout.count("loaded m1"), 1);
+ QCOMPARE(m_qbsStdout.count("loaded m2"), 2);
+ QCOMPARE(m_qbsStdout.count("loaded m3"), 1);
+ QCOMPARE(m_qbsStdout.count("loaded m4"), 1);
+}
+
void TestBlackbox::movedFileDependency()
{
QDir::setCurrent(testDataDir + "/moved-file-dependency");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index f6422d1f2..eb6041c2f 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -178,6 +178,7 @@ private slots:
void missingDependency();
void missingProjectFile();
void missingOverridePrefix();
+ void moduleConditions();
void movedFileDependency();
void multipleChanges();
void multipleConfigurations();