aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRichard Weickelt <richard@weickelt.de>2019-10-28 19:12:49 +0100
committerRichard Weickelt <richard@weickelt.de>2019-12-19 10:57:47 +0000
commitac110221332cdae2b7716f886178af27f16d98a3 (patch)
tree734773bcf7509b14f293edcc1b84d638c42c73df /tests
parent5fb118545c7b0ad6493e6083cb61335c32c2741e (diff)
Fix wrong behavior of Depends.profiles
When Depends.profiles contained a non-existing profile, Qbs just crashed. When Depends.profiles was set, but the dependency had an aggregator, the aggregator was always selected. This behavior was wrong. When Depends.profiles is set, it must take precedence and the aggregator must be ignored. Fixes: QBS-1513 Fixes: QBS-1514 Change-Id: I214afe0e2921b773ea1c224732c5c5430e7af063 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/testdata/dependency-profile-mismatch/dependency-profile-mismatch.qbs12
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp16
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
-rw-r--r--tests/auto/language/testdata/erroneous/dependency-profile-mismatch-2.qbs17
-rw-r--r--tests/auto/language/testdata/erroneous/dependency-profile-mismatch.qbs14
-rw-r--r--tests/auto/language/tst_language.cpp6
6 files changed, 37 insertions, 29 deletions
diff --git a/tests/auto/blackbox/testdata/dependency-profile-mismatch/dependency-profile-mismatch.qbs b/tests/auto/blackbox/testdata/dependency-profile-mismatch/dependency-profile-mismatch.qbs
deleted file mode 100644
index 8a6f733c0..000000000
--- a/tests/auto/blackbox/testdata/dependency-profile-mismatch/dependency-profile-mismatch.qbs
+++ /dev/null
@@ -1,12 +0,0 @@
-Project {
- property string mainProfile
- property string depProfile
- Product {
- name: "dep"
- qbs.profiles: [project.depProfile]
- }
- Product {
- name: "main"
- Depends { name: "dep"; profiles: [project.mainProfile]; }
- }
-}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index faada314f..66b4f8675 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -942,22 +942,6 @@ void TestBlackbox::dependenciesProperty()
QCOMPARE(product2_cpp_defines.first().toString(), QLatin1String("DIGEDAG"));
}
-void TestBlackbox::dependencyProfileMismatch()
-{
- QDir::setCurrent(testDataDir + "/dependency-profile-mismatch");
- const SettingsPtr s = settings();
- qbs::Internal::TemporaryProfile depProfile("qbs_autotests_profileMismatch", s.get());
- depProfile.p.setValue("qbs.architecture", "x86"); // Profiles must not be empty...
- s->sync();
- QbsRunParameters params(QStringList() << ("project.mainProfile:" + profileName())
- << ("project.depProfile:" + depProfile.p.name()));
- params.expectFailure = true;
- QVERIFY2(runQbs(params) != 0, m_qbsStderr.constData());
- QVERIFY2(m_qbsStderr.contains(profileName().toLocal8Bit())
- && m_qbsStderr.contains("', which does not exist"),
- m_qbsStderr.constData());
-}
-
void TestBlackbox::deprecatedProperty()
{
QDir::setCurrent(testDataDir + "/deprecated-property");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 4e2755724..f9a3d5c7c 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -85,7 +85,6 @@ private slots:
void cxxLanguageVersion_data();
void cpuFeatures();
void dependenciesProperty();
- void dependencyProfileMismatch();
void deprecatedProperty();
void disappearedProfile();
void discardUnusedData();
diff --git a/tests/auto/language/testdata/erroneous/dependency-profile-mismatch-2.qbs b/tests/auto/language/testdata/erroneous/dependency-profile-mismatch-2.qbs
new file mode 100644
index 000000000..d76907a35
--- /dev/null
+++ b/tests/auto/language/testdata/erroneous/dependency-profile-mismatch-2.qbs
@@ -0,0 +1,17 @@
+Project {
+ Profile {
+ name: "profile1"
+ }
+ Profile {
+ name: "profile2"
+ }
+
+ Product {
+ name: "dep"
+ qbs.profiles: ["profile1", "profile2"]
+ }
+ Product {
+ name: "main"
+ Depends { name: "dep"; profiles: ["profile47"]; }
+ }
+}
diff --git a/tests/auto/language/testdata/erroneous/dependency-profile-mismatch.qbs b/tests/auto/language/testdata/erroneous/dependency-profile-mismatch.qbs
new file mode 100644
index 000000000..e014fa9b1
--- /dev/null
+++ b/tests/auto/language/testdata/erroneous/dependency-profile-mismatch.qbs
@@ -0,0 +1,14 @@
+Project {
+ Profile {
+ name: "profile1"
+ }
+
+ Product {
+ name: "dep"
+ qbs.profiles: ["profile1"]
+ }
+ Product {
+ name: "main"
+ Depends { name: "dep"; profiles: ["profile47"]; }
+ }
+}
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index 4bf81ca65..ac6055e8c 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -928,6 +928,12 @@ void TestLanguage::erroneousFiles_data()
<< "mismatching-multiplex-dependency.qbs:7:5.*Dependency from product "
"'b \\{\"architecture\":\"mips\"\\}' to product 'a \\{\"architecture\":\"mips\"\\}'"
" not fulfilled.";
+ QTest::newRow("dependency-profile-mismatch")
+ << "dependency-profile-mismatch.qbs:10:5.*Product 'main' depends on 'dep', "
+ "which does not exist for the requested profile 'profile47'.";
+ 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:3:1.*Duplicate entry 'x86' in qbs.architectures.";
QTest::newRow("duplicate-multiplex-value2")