aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/language
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-05-16 13:59:15 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-05-17 07:42:45 +0000
commit9008034adf19176c399853ddd04e36ea3473e26e (patch)
tree086a32b5410ea716e1badd1d1745909bdb348d3e /tests/auto/language
parenta0d3454e7b8d816f5bb5c76ed2e9d50ff6550485 (diff)
ModuleLoader: Remove unneed loadBaseModule() call
That call was probably conceptually unneeded since d08ce8f643 (because from then on the module instance, which already has a qbs instance, was used to evaluate the condition), and harmful since be8432fac9 (because the loadBaseModule() call then happened on the shared module prototype). This patch also needs to touch the module merger: Because the prototype is now not tainted with qbs properties from the product item anymore, we have to make sure that variant values are not ignored during module merging; otherwise, qbs properties set by the multiplexing procedure could get lost in the merge process. Change-Id: Iae5d47dbe018d330f4c96e919bb0f83c086ae1df Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/language')
-rw-r--r--tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-values.qbs7
-rw-r--r--tests/auto/language/testdata/module-merging-variant-values/modules/m1/m1.qbs6
-rw-r--r--tests/auto/language/testdata/module-merging-variant-values/modules/m2/m2.qbs14
-rw-r--r--tests/auto/language/tst_language.cpp18
-rw-r--r--tests/auto/language/tst_language.h1
5 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-values.qbs b/tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-values.qbs
new file mode 100644
index 000000000..e4bf0ad4f
--- /dev/null
+++ b/tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-values.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+Product {
+ multiplexByQbsProperties: ["architectures"]
+ qbs.architectures: ["a1", "a2"]
+ Depends { name: "m2" }
+}
diff --git a/tests/auto/language/testdata/module-merging-variant-values/modules/m1/m1.qbs b/tests/auto/language/testdata/module-merging-variant-values/modules/m1/m1.qbs
new file mode 100644
index 000000000..6fc9c6b86
--- /dev/null
+++ b/tests/auto/language/testdata/module-merging-variant-values/modules/m1/m1.qbs
@@ -0,0 +1,6 @@
+Module {
+ condition: qbs.architecture === "a1" || qbs.architecture === "a2"
+
+ property string arch
+ qbs.architecture: undefined // We do something like this in GenericGCC.qbs
+}
diff --git a/tests/auto/language/testdata/module-merging-variant-values/modules/m2/m2.qbs b/tests/auto/language/testdata/module-merging-variant-values/modules/m2/m2.qbs
new file mode 100644
index 000000000..8361b91d4
--- /dev/null
+++ b/tests/auto/language/testdata/module-merging-variant-values/modules/m2/m2.qbs
@@ -0,0 +1,14 @@
+Module {
+ Depends { name: "m1" }
+ m1.arch: qbs.architecture
+ property string arch: qbs.architecture
+
+ validate: {
+ if (qbs.architecture !== "a1" && qbs.architecture !== "a2")
+ throw "Unexpected arch " + qbs.architecture;
+ if (arch !== qbs.architecture)
+ throw "Oops: " + arch + "/" + qbs.architecture;
+ if (m1.arch !== qbs.architecture)
+ throw "Oops: " + m1.arch + "/" + qbs.architecture;
+ }
+}
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index ef549da21..f52c6ec9c 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -1489,6 +1489,24 @@ void TestLanguage::jsImportUsedInMultipleScopes()
QVERIFY(!exceptionCaught);
}
+void TestLanguage::moduleMergingVariantValues()
+{
+ bool exceptionCaught = false;
+ try {
+ SetupProjectParameters params = defaultParameters;
+ params.setProjectFilePath
+ (testProject("module-merging-variant-values/module-merging-variant-values.qbs"));
+ params.expandBuildConfiguration();
+ const TopLevelProjectPtr project = loader->loadProject(params);
+ QVERIFY(!!project);
+ QCOMPARE(int(project->products.size()), 2);
+ } catch (const ErrorInfo &e) {
+ exceptionCaught = true;
+ qDebug() << e.toString();
+ }
+ QCOMPARE(exceptionCaught, false);
+}
+
void TestLanguage::modulePrioritizationBySearchPath_data()
{
QTest::addColumn<QStringList>("searchPaths");
diff --git a/tests/auto/language/tst_language.h b/tests/auto/language/tst_language.h
index b125b79a2..aab04ca29 100644
--- a/tests/auto/language/tst_language.h
+++ b/tests/auto/language/tst_language.h
@@ -119,6 +119,7 @@ private slots:
void jsExtensions();
void jsImportUsedInMultipleScopes_data();
void jsImportUsedInMultipleScopes();
+ void moduleMergingVariantValues();
void modulePrioritizationBySearchPath_data();
void modulePrioritizationBySearchPath();
void moduleProperties_data();