summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2021-09-27 20:33:09 +0300
committerIvan Komissarov <ABBAPOH@gmail.com>2021-11-02 22:53:14 +0000
commitef289e693d438316e460c9cb8282a068cd7ea2a1 (patch)
tree451872176b2cb2306ffa97f128b5943f218dc9ca /tests
parent03d1dd0112f308c048dd3939e47573c1a74aa37a (diff)
downloadqbs-ef289e693d438316e460c9cb8282a068cd7ea2a1.tar.gz
Allow protobuf to have runtime from providers
Change-Id: I2d951f691c601de9b2d06d1a580b818283eabac5 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs1
-rw-r--r--tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs1
-rw-r--r--tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.qbs1
-rw-r--r--tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs1
-rw-r--r--tests/auto/blackbox/testdata/protobuf/create-proto-library.qbs1
-rw-r--r--tests/auto/blackbox/testdata/protobuf/import.qbs1
-rw-r--r--tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs1
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp48
8 files changed, 47 insertions, 8 deletions
diff --git a/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs b/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs
index 4e46da210..1ecbd0394 100644
--- a/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs
+++ b/tests/auto/blackbox/testdata/grpc/grpc_cpp.qbs
@@ -18,6 +18,7 @@ CppApplication {
property bool hasDependencies: {
console.info("has grpc: " + protobuf.cpp.present);
+ console.info("has modules: " + grpcpp.present);
return protobuf.cpp.present;
}
diff --git a/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs b/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs
index ac97f6bd5..8e8735b69 100644
--- a/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs
+++ b/tests/auto/blackbox/testdata/protobuf/addressbook_cpp.qbs
@@ -15,6 +15,7 @@ CppApplication {
Depends { name: "protobuf.cpp"; required: false }
property bool hasProtobuf: {
console.info("has protobuf: " + protobuf.cpp.present);
+ console.info("has modules: " + protobuflib.present);
return protobuf.cpp.present;
}
diff --git a/tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.qbs b/tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.qbs
index 92243d31f..61a44fc0f 100644
--- a/tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.qbs
+++ b/tests/auto/blackbox/testdata/protobuf/addressbook_nanopb.qbs
@@ -15,6 +15,7 @@ CppApplication {
Depends { name: "protobuf.nanopb"; required: false }
property bool hasProtobuf: {
console.info("has protobuf: " + protobuf.nanopb.present);
+ console.info("has modules: false");
return protobuf.nanopb.present;
}
protobuf.nanopb.importPaths: product.sourceDirectory
diff --git a/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs b/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs
index 448a9284a..95b03d7d7 100644
--- a/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs
+++ b/tests/auto/blackbox/testdata/protobuf/addressbook_objc.qbs
@@ -12,6 +12,7 @@ CppApplication {
Depends { name: "protobuf.objc"; required: false }
property bool hasProtobuf: {
console.info("has protobuf: " + protobuf.objc.present);
+ console.info("has modules: false");
return protobuf.objc.present;
}
diff --git a/tests/auto/blackbox/testdata/protobuf/create-proto-library.qbs b/tests/auto/blackbox/testdata/protobuf/create-proto-library.qbs
index d888937f1..9938fcdd4 100644
--- a/tests/auto/blackbox/testdata/protobuf/create-proto-library.qbs
+++ b/tests/auto/blackbox/testdata/protobuf/create-proto-library.qbs
@@ -17,6 +17,7 @@ Project {
Depends { name: "protobuf.cpp"; required: false }
property bool hasProtobuf: {
console.info("has protobuf: " + protobuf.cpp.present);
+ console.info("has modules: " + protobuflib.present);
return protobuf.cpp.present;
}
diff --git a/tests/auto/blackbox/testdata/protobuf/import.qbs b/tests/auto/blackbox/testdata/protobuf/import.qbs
index 4d7e1b5c9..d7ae5e1a2 100644
--- a/tests/auto/blackbox/testdata/protobuf/import.qbs
+++ b/tests/auto/blackbox/testdata/protobuf/import.qbs
@@ -16,6 +16,7 @@ CppApplication {
Depends { name: "protobuf.cpp"; required: false }
property bool hasProtobuf: {
console.info("has protobuf: " + protobuf.cpp.present);
+ console.info("has modules: " + protobuflib.present);
return protobuf.cpp.present;
}
diff --git a/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs b/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs
index 4914ea484..80a9d9a88 100644
--- a/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs
+++ b/tests/auto/blackbox/testdata/protobuf/needs-import-dir.qbs
@@ -17,6 +17,7 @@ CppApplication {
Depends { name: "protobuf.cpp"; required: false }
property bool hasProtobuf: {
console.info("has protobuf: " + protobuf.cpp.present);
+ console.info("has modules: " + protobuflib.present);
return protobuf.cpp.present;
}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index c64976e36..437a8f70a 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -5803,18 +5803,24 @@ void TestBlackbox::protobuf_data()
{
QTest::addColumn<QString>("projectFile");
QTest::addColumn<QStringList>("properties");
+ QTest::addColumn<bool>("hasModules");
QTest::addColumn<bool>("successExpected");
- QTest::newRow("cpp") << QString("addressbook_cpp.qbs") << QStringList() << true;
- QTest::newRow("objc") << QString("addressbook_objc.qbs") << QStringList() << true;
- QTest::newRow("nanopb") << QString("addressbook_nanopb.qbs") << QStringList() << true;
- QTest::newRow("import") << QString("import.qbs") << QStringList() << true;
+ QTest::newRow("cpp") << QString("addressbook_cpp.qbs") << QStringList() << false << true;
+ QTest::newRow("cpp-pkgconfig")
+ << QString("addressbook_cpp.qbs")
+ << QStringList("project.qbsModuleProviders:qbspkgconfig")
+ << true
+ << true;
+ QTest::newRow("objc") << QString("addressbook_objc.qbs") << QStringList() << false << true;
+ QTest::newRow("nanopb") << QString("addressbook_nanopb.qbs") << QStringList() << false << true;
+ QTest::newRow("import") << QString("import.qbs") << QStringList() << false << true;
QTest::newRow("missing import dir") << QString("needs-import-dir.qbs")
- << QStringList() << false;
+ << QStringList() << false << false;
QTest::newRow("provided import dir")
<< QString("needs-import-dir.qbs")
- << QStringList("products.app.theImportDir:subdir") << true;
+ << QStringList("products.app.theImportDir:subdir") << false << true;
QTest::newRow("create proto library")
- << QString("create-proto-library.qbs") << QStringList() << true;
+ << QString("create-proto-library.qbs") << QStringList() << false << true;
}
void TestBlackbox::protobuf()
@@ -5822,6 +5828,7 @@ void TestBlackbox::protobuf()
QDir::setCurrent(testDataDir + "/protobuf");
QFETCH(QString, projectFile);
QFETCH(QStringList, properties);
+ QFETCH(bool, hasModules);
QFETCH(bool, successExpected);
rmDirR(relativeBuildDir());
QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile} << properties);
@@ -5833,6 +5840,10 @@ void TestBlackbox::protobuf()
QVERIFY2(withProtobuf || withoutProtobuf, m_qbsStdout.constData());
if (withoutProtobuf)
QSKIP("protobuf module not present");
+ const bool hasMods = m_qbsStdout.contains("has modules: true");
+ const bool dontHaveMods = m_qbsStdout.contains("has modules: false");
+ QVERIFY2(hasMods == !dontHaveMods, m_qbsStdout.constData());
+ QCOMPARE(hasMods, hasModules);
QbsRunParameters runParams("run");
runParams.expectFailure = !successExpected;
QCOMPARE(runQbs(runParams) == 0, successExpected);
@@ -8355,21 +8366,42 @@ void TestBlackbox::groupsInModules()
void TestBlackbox::grpc_data()
{
QTest::addColumn<QString>("projectFile");
- QTest::newRow("cpp") << QString("grpc_cpp.qbs");
+ QTest::addColumn<QStringList>("arguments");
+ QTest::addColumn<bool>("hasModules");
+
+ QTest::newRow("cpp") << QString("grpc_cpp.qbs") << QStringList() << false;
+
+ QStringList pkgConfigArgs("project.qbsModuleProviders:qbspkgconfig");
+ // on macOS, openSSL is hidden from pkg-config by default
+ if (qbs::Internal::HostOsInfo::isMacosHost()) {
+ pkgConfigArgs
+ << "moduleProviders.qbspkgconfig.extraPaths:/usr/local/opt/openssl@1.1/lib/pkgconfig";
+ }
+ QTest::newRow("cpp-pkgconfig") << QString("grpc_cpp.qbs") << pkgConfigArgs << true;
}
void TestBlackbox::grpc()
{
QDir::setCurrent(testDataDir + "/grpc");
QFETCH(QString, projectFile);
+ QFETCH(QStringList, arguments);
+ QFETCH(bool, hasModules);
+
rmDirR(relativeBuildDir());
QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile});
+ resolveParams.arguments << arguments;
QCOMPARE(runQbs(resolveParams), 0);
const bool withGrpc = m_qbsStdout.contains("has grpc: true");
const bool withoutGrpc = m_qbsStdout.contains("has grpc: false");
QVERIFY2(withGrpc || withoutGrpc, m_qbsStdout.constData());
if (withoutGrpc)
QSKIP("grpc module not present");
+
+ const bool hasMods = m_qbsStdout.contains("has modules: true");
+ const bool dontHaveMods = m_qbsStdout.contains("has modules: false");
+ QVERIFY2(hasMods == !dontHaveMods, m_qbsStdout.constData());
+ QCOMPARE(hasMods, hasModules);
+
if (m_qbsStdout.contains("targetPlatform differs from hostPlatform"))
QSKIP("Cannot run binaries in cross-compiled build");