aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-03-06 18:17:04 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2018-03-09 08:54:18 +0000
commitabfc4c1b37d18515c8da0678a665886d7cb69af5 (patch)
treeb171d79fbd3980010683778761ab60ddf3ac881a /tests
parent4bbcab71534cedb0076d5a1b5899ee8530a01f81 (diff)
Fix exports from multiplexed products
While we did set up the dependencies between multiplexed products correctly, the *module* (i.e. Export item) that we pulled in was always the same one and corresponded to the wrong product variant in most cases. Change-Id: If42cf7e946689259c7433d81fd35d8798919eb15 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/language/testdata/multiplexed-exports.qbs20
-rw-r--r--tests/auto/language/tst_language.cpp39
-rw-r--r--tests/auto/language/tst_language.h1
3 files changed, 59 insertions, 1 deletions
diff --git a/tests/auto/language/testdata/multiplexed-exports.qbs b/tests/auto/language/testdata/multiplexed-exports.qbs
new file mode 100644
index 000000000..923ddc2ab
--- /dev/null
+++ b/tests/auto/language/testdata/multiplexed-exports.qbs
@@ -0,0 +1,20 @@
+import qbs
+
+Project {
+ Product {
+ name: "dep"
+ multiplexByQbsProperties: ["buildVariants"]
+ qbs.buildVariants: ["debug", "release"]
+ property string includeDir: qbs.buildVariant === "debug" ? "/d" : "/r"
+ Export {
+ Depends { name: "cpp" }
+ cpp.includePaths: product.includeDir
+ }
+ }
+ Product {
+ name: "p"
+ Depends { name: "dep" }
+ multiplexByQbsProperties: ["buildVariants"]
+ qbs.buildVariants: ["debug", "release"]
+ }
+}
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index f1e21cc26..bfbb0c525 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -68,6 +68,7 @@
#include <QtCore/qprocess.h>
#include <algorithm>
+#include <set>
#include <utility>
#include <vector>
@@ -832,7 +833,7 @@ void TestLanguage::erroneousFiles_data()
<< "original-in-product-property.qbs"
":4:21.*The special value 'original' can only be used with module properties.";
QTest::newRow("mismatching-multiplex-dependency")
- << "mismatching-multiplex-dependency.qbs:9:5 Dependency from product "
+ << "mismatching-multiplex-dependency.qbs:9:5.*Dependency from product "
"'b \\{\"architecture\":\"mips\"\\}' to product 'a \\{\"architecture\":\"mips\"\\}'"
" not fulfilled.";
}
@@ -1887,6 +1888,42 @@ void TestLanguage::modules()
QCOMPARE(product->productProperties.value("foo").toString(), expectedProductProperty);
}
+void TestLanguage::multiplexedExports()
+{
+ bool exceptionCaught = false;
+ try {
+ SetupProjectParameters params = defaultParameters;
+ params.setProjectFilePath(testProject("multiplexed-exports.qbs"));
+ const TopLevelProjectPtr project = loader->loadProject(params);
+ QVERIFY(!!project);
+ const auto products = project->allProducts();
+ QCOMPARE(products.size(), 4);
+ std::set<ResolvedProductPtr> pVariants;
+ for (const auto &product : products) {
+ if (product->name != "p")
+ continue;
+ static const auto buildVariant = [](const ResolvedProductConstPtr &p) {
+ return p->moduleProperties->qbsPropertyValue("buildVariant").toString();
+ };
+ static const auto cppIncludePaths = [](const ResolvedProductConstPtr &p) {
+ return p->moduleProperties->moduleProperty("cpp", "includePaths").toStringList();
+ };
+ if (buildVariant(product) == "debug") {
+ pVariants.insert(product);
+ QCOMPARE(cppIncludePaths(product), QStringList("/d"));
+ } else if (buildVariant(product) == "release") {
+ pVariants.insert(product);
+ QCOMPARE(cppIncludePaths(product), QStringList("/r"));
+ }
+ }
+ QCOMPARE(int(pVariants.size()), 2);
+ } catch (const ErrorInfo &e) {
+ exceptionCaught = true;
+ qDebug() << e.toString();
+ }
+ QCOMPARE(exceptionCaught, false);
+}
+
void TestLanguage::multiplexingByProfile()
{
QFETCH(QString, projectFileName);
diff --git a/tests/auto/language/tst_language.h b/tests/auto/language/tst_language.h
index edbebef5e..c80152f28 100644
--- a/tests/auto/language/tst_language.h
+++ b/tests/auto/language/tst_language.h
@@ -126,6 +126,7 @@ private slots:
void moduleScope();
void modules_data();
void modules();
+ void multiplexedExports();
void multiplexingByProfile();
void multiplexingByProfile_data();
void nonApplicableModulePropertyInProfile();