summaryrefslogtreecommitdiff
path: root/tests/auto/language/tst_language.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-05-16 10:47:26 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-05-16 11:07:25 +0000
commit5c1973d4b74e0823b4f4fedc896ac342520ae852 (patch)
treeea85859dcc6182add6df35e1ed9319aa5ec6b652 /tests/auto/language/tst_language.cpp
parentce626e5e919cabb32a7fa1be35025837196b8204 (diff)
downloadqbs-5c1973d4b74e0823b4f4fedc896ac342520ae852.tar.gz
Loader: Do not error out when encountering duplicate multiplex values
In qbs, values of list properties specified in a project file are merged with those from the profile. As of fb52fed84a1510a7de0172e643d6fd66a780e2e8, this is also true for the special multiplexing properties ("qbs.architectures", "qbs.buildVariants" etc). This means it can now happen that we end up with duplicate entries in these lists implicitly. Therefore, it no longer makes sense to throw an error when such duplicates are encountered, as they were not necessarily specified verbatim. Instead, we simply ignore the duplicate value and carry on normally. Change-Id: Ie4fed2081bebd2b0dd62aa873cafed769b308e97 Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'tests/auto/language/tst_language.cpp')
-rw-r--r--tests/auto/language/tst_language.cpp41
1 files changed, 36 insertions, 5 deletions
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index eda7bf566..c97b83cc1 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -626,6 +626,42 @@ void TestLanguage::dottedNames()
}
}
+void TestLanguage::duplicateMultiplexValues_data()
+{
+ QTest::addColumn<bool>("dummy");
+ QTest::newRow("duplicate-multiplex-value") << true;
+ QTest::newRow("duplicate-multiplex-value2") << true;
+}
+
+void TestLanguage::duplicateMultiplexValues()
+{
+ bool exceptionCaught = false;
+ try {
+ SetupProjectParameters params = defaultParameters;
+ const QString filePath = testDataDir() + QLatin1Char('/')
+ + QString::fromLocal8Bit(QTest::currentDataTag()) + QLatin1String(".qbs");
+ params.setProjectFilePath(filePath);
+ TopLevelProjectPtr project = m_resolver->resolve(params);
+ QVERIFY(project);
+ const std::vector<ResolvedProductPtr> products = project->allProducts();
+ QCOMPARE(products.size(), 2);
+ bool x86 = false;
+ bool arm = false;
+ for (const ResolvedProductPtr &p : products) {
+ if (p->moduleProperties->moduleProperty("qbs", "architecture").toString() == "x86")
+ x86 = true;
+ else if (p->moduleProperties->moduleProperty("qbs", "architecture").toString() == "arm")
+ arm = true;
+ }
+ QVERIFY(x86);
+ QVERIFY(arm);
+ } catch (const ErrorInfo &e) {
+ exceptionCaught = true;
+ qDebug() << e.toString();
+ }
+ QVERIFY(!exceptionCaught);
+}
+
void TestLanguage::emptyJsFile()
{
bool exceptionCaught = false;
@@ -937,11 +973,6 @@ void TestLanguage::erroneousFiles_data()
QTest::newRow("dependency-profile-mismatch-2")
<< "dependency-profile-mismatch-2.qbs:15:9 Dependency from product 'main' to "
"product 'dep' not fulfilled. There are no eligible multiplex candidates.";
- QTest::newRow("duplicate-multiplex-value")
- << "duplicate-multiplex-value.qbs:1:1.*Duplicate entry 'x86' in qbs.architectures.";
- QTest::newRow("duplicate-multiplex-value2")
- << "duplicate-multiplex-value2.qbs:1:1.*Duplicate entry 'architecture' in "
- "Product.multiplexByQbsProperties.";
QTest::newRow("invalid-references")
<< "invalid-references.qbs:2:17.*Cannot open '.*nosuchproject.qbs'";
QTest::newRow("missing-js-file")