summaryrefslogtreecommitdiff
path: root/tests/auto/blackbox/tst_blackbox.cpp
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/auto/blackbox/tst_blackbox.cpp
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/auto/blackbox/tst_blackbox.cpp')
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp48
1 files changed, 40 insertions, 8 deletions
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");