diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2021-10-26 13:22:27 +0300 |
---|---|---|
committer | Ivan Komissarov <abbapoh@gmail.com> | 2021-10-26 13:22:27 +0300 |
commit | e811681b9024b42fe6d064f2e2e37392f6093b86 (patch) | |
tree | b27724cb432036c4f119309dc7d27381a26872c7 /tests | |
parent | 05c46fbeb5256eb0935b49d1d05197a448e49830 (diff) | |
parent | 24044d6da5d3f3725adc134fdb7e71fe398381ff (diff) | |
download | qbs-e811681b9024b42fe6d064f2e2e37392f6093b86.tar.gz |
Merge branch '1.21' into master
Change-Id: I3417bbe182c23f8e6a9704b008eb8a5618e4d175
Diffstat (limited to 'tests')
18 files changed, 306 insertions, 28 deletions
diff --git a/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml b/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml index 542794825..c8237c639 100644 --- a/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml +++ b/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml @@ -16,7 +16,6 @@ <!-- Application arguments --> <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> <meta-data android:name="android.app.repository" android:value="default"/> <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> @@ -31,8 +30,6 @@ <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> <!-- Messages maps --> diff --git a/tests/auto/blackbox/testdata/capnproto/capnproto_cpp_pkgconfig.qbs b/tests/auto/blackbox/testdata/capnproto/capnproto_cpp_pkgconfig.qbs new file mode 100644 index 000000000..58c7d568d --- /dev/null +++ b/tests/auto/blackbox/testdata/capnproto/capnproto_cpp_pkgconfig.qbs @@ -0,0 +1,17 @@ +CppApplication { + Depends { name: "capnproto.cpp"; required: false } + condition: { + var result = qbs.targetPlatform === qbs.hostPlatform; + if (!result) + console.info("targetPlatform differs from hostPlatform"); + if (!capnproto.cpp.present) + console.info("capnproto is not present"); + return result && capnproto.cpp.present; + } + cpp.minimumMacosVersion: "10.8" + files: [ + "capnproto_cpp.cpp", + "foo.capnp" + ] + qbsModuleProviders: "qbspkgconfig" +}
\ No newline at end of file diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc new file mode 100644 index 000000000..077a05893 --- /dev/null +++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libdir/libA.pc @@ -0,0 +1,6 @@ +Name: libA +Description: just a test +Version: 0.0.1 + +Cflags: -DTHE_MAGIC_DEFINE -I/usr/local/include +Libs: -L/usr/local/lib -llibA diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libA.cpp b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libA.cpp new file mode 100644 index 000000000..0c5274415 --- /dev/null +++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libA.cpp @@ -0,0 +1,14 @@ +#include "libA.h" + +#include <iostream> + +void foo() +{ + std::cout << "hello from foo: "; +#ifdef MYLIB_FRAMEWORK + std::cout << "bundled: yes"; +#else + std::cout << "bundled: no"; +#endif + std::cout << std::endl; +} diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libA.h b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libA.h new file mode 100644 index 000000000..ddaaf1609 --- /dev/null +++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libA.h @@ -0,0 +1,21 @@ +#pragma once + +#if defined(_WIN32) || defined(WIN32) +# define DECL_EXPORT __declspec(dllexport) +# define DECL_IMPORT __declspec(dllimport) +#else +# define DECL_EXPORT __attribute__((visibility("default"))) +# define DECL_IMPORT __attribute__((visibility("default"))) +# endif + +#if defined(LIBA_STATIC_LIBRARY) +# define LIBA_EXPORT +#else +# if defined(MYLIB_LIBRARY) +# define LIBA_EXPORT DECL_EXPORT +# else +# define LIBA_EXPORT DECL_IMPORT +# endif +#endif + +LIBA_EXPORT void foo(); diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs new file mode 100644 index 000000000..9d482415b --- /dev/null +++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/libs/libs.qbs @@ -0,0 +1,29 @@ +import qbs.FileInfo + +Project { + property bool isBundle: false + + DynamicLibrary { + Depends { name: "cpp" } + Depends { name: "bundle" } + name: "libA" + bundle.isBundle: project.isBundle + bundle.publicHeaders: ["libA.h"] + files: "libA.cpp" + cpp.defines: { + var result = []; + if (project.isBundle) + result.push("MYLIB_FRAMEWORK"); + return result; + } + qbs.installPrefix: "" + install: true + installImportLib: true + installDir: "lib" + Group { + files: ["libA.h"] + qbs.install: !project.isBundle + qbs.installDir: FileInfo.joinPaths("include", product.name) + } + } +} diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/main.cpp b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/main.cpp new file mode 100644 index 000000000..5fa0f7eed --- /dev/null +++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/main.cpp @@ -0,0 +1,11 @@ +#include <libA/libA.h> + +#ifndef THE_MAGIC_DEFINE +#error "missing the magic define" +#endif + +int main() +{ + foo(); + return 0; +} diff --git a/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/qbspkgconfig-module-provider.qbs b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/qbspkgconfig-module-provider.qbs new file mode 100644 index 000000000..d2b3654ae --- /dev/null +++ b/tests/auto/blackbox/testdata/qbspkgconfig-module-provider/qbspkgconfig-module-provider.qbs @@ -0,0 +1,6 @@ +CppApplication { + name: "p" + Depends { name: "libA" } + files: "main.cpp" + qbsModuleProviders: "qbspkgconfig" +} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 3cacd67e9..41f307632 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -811,6 +811,7 @@ void TestBlackbox::capnproto_data() QTest::addColumn<QString>("projectFile"); QTest::newRow("cpp") << QStringLiteral("capnproto_cpp.qbs"); + QTest::newRow("cpp-pkgconfig") << QStringLiteral("capnproto_cpp_pkgconfig.qbs"); QTest::newRow("greeter cpp (grpc)") << QStringLiteral("greeter_cpp.qbs"); QTest::newRow("relative import") << QStringLiteral("capnproto_relative_import.qbs"); QTest::newRow("absolute import") << QStringLiteral("capnproto_absolute_import.qbs"); @@ -6144,6 +6145,28 @@ void TestBlackbox::qbsModuleProvidersCompatibility_data() QTest::newRow("named") << QStringList("project.qbsModuleProviders:named_provider") << "from_named_provider"; } +void TestBlackbox::qbspkgconfigModuleProvider() +{ + QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider/libs"); + + const auto commonParams = QbsRunParameters(QStringLiteral("install"), { + QStringLiteral("qbs.installPrefix:/usr/local"), + QStringLiteral("--install-root"), + QStringLiteral("install-root") + }); + auto dynamicParams = commonParams; + dynamicParams.arguments << "config:library" << "projects.libs.isBundle:false"; + QCOMPARE(runQbs(dynamicParams), 0); + + QDir::setCurrent(testDataDir + "/qbspkgconfig-module-provider"); + + QbsRunParameters params; + params.arguments + << "moduleProviders.qbspkgconfig.libDirs:libdir" + << "moduleProviders.qbspkgconfig.sysroot:" + QDir::currentPath() + "/libs/install-root"; + QCOMPARE(runQbs(params), 0); +} + static QJsonObject getNextSessionPacket(QProcess &session, QByteArray &data) { int totalSize = -1; diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 8728f2b10..2f443f681 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -265,6 +265,7 @@ private slots: void qbsModuleProvidersCliOverride_data(); void qbsModuleProvidersCompatibility(); void qbsModuleProvidersCompatibility_data(); + void qbspkgconfigModuleProvider(); void qbsSession(); void qbsVersion(); void qtBug51237(); diff --git a/tests/auto/blackbox/tst_blackboxandroid.cpp b/tests/auto/blackbox/tst_blackboxandroid.cpp index 0d66f60bb..684291eb1 100644 --- a/tests/auto/blackbox/tst_blackboxandroid.cpp +++ b/tests/auto/blackbox/tst_blackboxandroid.cpp @@ -524,7 +524,6 @@ void TestBlackboxAndroid::android_data() "modules.qbs.architecture:" + archsStringList.first(), aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild << enableD8; - auto qmlAppExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { @@ -614,7 +613,7 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); - if (version >= qbs::Version(6, 0)) + if (version >= qbs::Version(6, 0)) { expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6OpenGL_${ARCH}.so", "lib/${ARCH}/libQt6QuickControls2Impl_${ARCH}.so", @@ -627,8 +626,6 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libqml_QtQml_Models_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick_Window_quickwindow_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick_tooling_quicktooling_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_${ARCH}.so", @@ -649,6 +646,29 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libqml_QtQuick_Timeline_qtquicktimelineplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Layouts_qquicklayoutsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_qtquick2plugin_${ARCH}.so"}, generateAab); + if (version >= qbs::Version(6, 2)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libqml_QtQuick_Window_quickwindowplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_tooling_quicktoolingplugin_${ARCH}.so", + "lib/${ARCH}/libQt6QmlLocalStorage_${ARCH}.so", + "lib/${ARCH}/libQt6QmlXmlListModel_${ARCH}.so", + "lib/${ARCH}/libQt6QuickDialogs2QuickImpl_${ARCH}.so", + "lib/${ARCH}/libQt6QuickDialogs2Utils_${ARCH}.so", + "lib/${ARCH}/libQt6QuickDialogs2_${ARCH}.so", + "lib/${ARCH}/libQt6QuickLayouts_${ARCH}.so", + "lib/${ARCH}/libQt6QuickTimeline_${ARCH}.so", + "lib/${ARCH}/libplugins_networkinformation_qandroidnetworkinformation_${ARCH}.so", + "lib/${ARCH}/libplugins_tls_qcertonlybackend_${ARCH}.so", + "lib/${ARCH}/libplugins_tls_qopensslbackend_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_XmlListModel_qmlxmllistmodelplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Dialogs_qtquickdialogsplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Dialogs_quickimpl_qtquickdialogs2quickimplplugin_${ARCH}.so"}, + generateAab); + else + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libqml_QtQuick_Window_quickwindow_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_tooling_quicktooling_${ARCH}.so"}, generateAab); + } } if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; @@ -658,7 +678,6 @@ void TestBlackboxAndroid::android_data() expectedFile << "res/layout/splash.xml"; return expectedFile; }; - auto qmlAppCustomMetaDataExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { @@ -750,7 +769,7 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); - if (version >= qbs::Version(6, 0)) + if (version >= qbs::Version(6, 0)) { expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt6OpenGL_${ARCH}.so", "lib/${ARCH}/libQt6QuickControls2Impl_${ARCH}.so", @@ -763,8 +782,6 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libqml_QtQml_Models_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick_Window_quickwindow_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick_tooling_quicktooling_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_${ARCH}.so", @@ -785,6 +802,29 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libqml_QtQuick_Timeline_qtquicktimelineplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_Layouts_qquicklayoutsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQuick_qtquick2plugin_${ARCH}.so"}, generateAab); + if (version >= qbs::Version(6, 2)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libqml_QtQuick_Window_quickwindowplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_tooling_quicktoolingplugin_${ARCH}.so", + "lib/${ARCH}/libQt6QmlLocalStorage_${ARCH}.so", + "lib/${ARCH}/libQt6QmlXmlListModel_${ARCH}.so", + "lib/${ARCH}/libQt6QuickDialogs2QuickImpl_${ARCH}.so", + "lib/${ARCH}/libQt6QuickDialogs2Utils_${ARCH}.so", + "lib/${ARCH}/libQt6QuickDialogs2_${ARCH}.so", + "lib/${ARCH}/libQt6QuickLayouts_${ARCH}.so", + "lib/${ARCH}/libQt6QuickTimeline_${ARCH}.so", + "lib/${ARCH}/libplugins_networkinformation_qandroidnetworkinformation_${ARCH}.so", + "lib/${ARCH}/libplugins_tls_qcertonlybackend_${ARCH}.so", + "lib/${ARCH}/libplugins_tls_qopensslbackend_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_XmlListModel_qmlxmllistmodelplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Dialogs_qtquickdialogsplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Dialogs_quickimpl_qtquickdialogs2quickimplplugin_${ARCH}.so"}, + generateAab); + else + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libqml_QtQuick_Window_quickwindow_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_tooling_quicktooling_${ARCH}.so"}, generateAab); + } } if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; @@ -817,7 +857,6 @@ void TestBlackboxAndroid::android_data() << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild << enableD8; - enableAapt2 = true; QTest::newRow("qml app aapt2") << "qml-app" << QStringList("qmlapp") diff --git a/tests/auto/pkgconfig/testdata/base.name.json b/tests/auto/pkgconfig/testdata/base.name.json new file mode 100644 index 000000000..a10e905ac --- /dev/null +++ b/tests/auto/pkgconfig/testdata/base.name.json @@ -0,0 +1,20 @@ +{ + "Name": "Base Name test", + "Description": "Checks correct baseName detection", + "Version": "1.0.0", + "Vars": { + "prefix": "/usr", + "exec_prefix": "/usr", + "libdir": "/usr/lib", + "includedir": "/usr/include" + }, + "Libs": [ + {"Type": "LibraryName", "Value": "simple"} + ], + "LibsPrivate": [ + {"Type": "LibraryName", "Value": "m"} + ], + "Cflags": [ + {"Type": "IncludePath", "Value": "/usr/include"} + ] +} diff --git a/tests/auto/pkgconfig/testdata/base.name.pc b/tests/auto/pkgconfig/testdata/base.name.pc new file mode 100644 index 000000000..2bb3e275e --- /dev/null +++ b/tests/auto/pkgconfig/testdata/base.name.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Base Name test +Description: Checks correct baseName detection +Version: 1.0.0 +Requires: +Libs: -lsimple +Libs.private: -lm +Cflags: -I${includedir} diff --git a/tests/auto/pkgconfig/testdata/private-dep.pc b/tests/auto/pkgconfig/testdata/private-dep.pc new file mode 100644 index 000000000..cb401391d --- /dev/null +++ b/tests/auto/pkgconfig/testdata/private-dep.pc @@ -0,0 +1,6 @@ +Name: Requires test package +Description: Dummy pkgconfig test package for testing Requires/Requires.private +Version: 1.0.0 +Libs: -L/private-dep/lib -lprivate-dep +Cflags: -I/private-dep/include + diff --git a/tests/auto/pkgconfig/testdata/public-dep.pc b/tests/auto/pkgconfig/testdata/public-dep.pc new file mode 100644 index 000000000..e450e46f1 --- /dev/null +++ b/tests/auto/pkgconfig/testdata/public-dep.pc @@ -0,0 +1,6 @@ +Name: Requires test package +Description: Dummy pkgconfig test package for testing Requires/Requires.private +Version: 1.0.0 +Requires.private: +Libs: -L/public-dep/lib -lpublic-dep +Cflags: -I/public-dep/include diff --git a/tests/auto/pkgconfig/testdata/requires-test-merged-static.json b/tests/auto/pkgconfig/testdata/requires-test-merged-static.json new file mode 100644 index 000000000..2c43b2d40 --- /dev/null +++ b/tests/auto/pkgconfig/testdata/requires-test-merged-static.json @@ -0,0 +1,22 @@ +{ + "Name": "Requires test package", + "Description": "Dummy pkgconfig test package for testing Requires/Requires.private", + "Version": "1.0.0", + "Libs": [ + {"Type": "LibraryPath", "Value": "/public-dep/lib"}, + {"Type": "LibraryName", "Value": "public-dep"}, + {"Type": "LibraryPath", "Value": "/private-dep/lib"}, + {"Type": "LibraryName", "Value": "private-dep"}, + {"Type": "LibraryPath", "Value": "/requires-test/lib"}, + {"Type": "LibraryName", "Value": "requires-test"} + ], + "Cflags": [ + {"Type": "IncludePath", "Value": "/public-dep/include"}, + {"Type": "IncludePath", "Value": "/private-dep/include"}, + {"Type": "IncludePath", "Value": "/requires-test/include"} + ], + "Requires": [ + ], + "RequiresPrivate": [ + ] +} diff --git a/tests/auto/pkgconfig/testdata/requires-test-merged.json b/tests/auto/pkgconfig/testdata/requires-test-merged.json new file mode 100644 index 000000000..88114ba30 --- /dev/null +++ b/tests/auto/pkgconfig/testdata/requires-test-merged.json @@ -0,0 +1,19 @@ +{ + "Name": "Requires test package", + "Description": "Dummy pkgconfig test package for testing Requires/Requires.private", + "Version": "1.0.0", + "Libs": [ + {"Type": "LibraryPath", "Value": "/public-dep/lib"}, + {"Type": "LibraryName", "Value": "public-dep"}, + {"Type": "LibraryPath", "Value": "/requires-test/lib"}, + {"Type": "LibraryName", "Value": "requires-test"} + ], + "Cflags": [ + {"Type": "IncludePath", "Value": "/public-dep/include"}, + {"Type": "IncludePath", "Value": "/requires-test/include"} + ], + "Requires": [ + ], + "RequiresPrivate": [ + ] +} diff --git a/tests/auto/pkgconfig/tst_pkgconfig.cpp b/tests/auto/pkgconfig/tst_pkgconfig.cpp index b05dd4923..542984378 100644 --- a/tests/auto/pkgconfig/tst_pkgconfig.cpp +++ b/tests/auto/pkgconfig/tst_pkgconfig.cpp @@ -60,22 +60,32 @@ void TestPkgConfig::initTestCase() void TestPkgConfig::pkgConfig() { - QFETCH(QString, fileName); + QFETCH(QString, pcFileName); + QFETCH(QString, jsonFileName); QFETCH(QVariantMap, optionsMap); - Options options = qbs::Internal::PkgConfigJs::convertOptions(QProcessEnvironment::systemEnvironment(), optionsMap); - options.searchPaths.push_back(m_workingDataDir.toStdString()); + if (jsonFileName.isEmpty()) + jsonFileName = pcFileName; + + if (!optionsMap.contains("mergeDependencies")) + optionsMap["mergeDependencies"] = false; + + Options options = qbs::Internal::PkgConfigJs::convertOptions( + QProcessEnvironment::systemEnvironment(), optionsMap); + options.libDirs.push_back(m_workingDataDir.toStdString()); PkgConfig pkgConfig(std::move(options)); - QFile jsonFile(m_workingDataDir + "/" + fileName + ".json"); + QFile jsonFile(m_workingDataDir + "/" + jsonFileName + ".json"); QVERIFY(jsonFile.open(QIODevice::ReadOnly)); QJsonParseError error{}; const auto json = QJsonDocument::fromJson(jsonFile.readAll(), &error).toVariant().toMap(); QCOMPARE(error.error, QJsonParseError::NoError); - const auto &package = pkgConfig.getPackage(fileName.toStdString()); - QCOMPARE(QString::fromStdString(package.baseFileName), fileName); + const auto &packageOr = pkgConfig.getPackage(pcFileName.toStdString()); + QVERIFY(packageOr.isValid()); + const auto &package = packageOr.asPackage(); + QCOMPARE(QString::fromStdString(package.baseFileName), pcFileName); QCOMPARE(QString::fromStdString(package.name), json.value("Name").toString()); QCOMPARE(QString::fromStdString(package.description), json.value("Description").toString()); QCOMPARE(QString::fromStdString(package.version), json.value("Version").toString()); @@ -153,19 +163,38 @@ void TestPkgConfig::pkgConfig() void TestPkgConfig::pkgConfig_data() { - QTest::addColumn<QString>("fileName"); + QTest::addColumn<QString>("pcFileName"); + QTest::addColumn<QString>("jsonFileName"); QTest::addColumn<QVariantMap>("optionsMap"); - QTest::newRow("non-l-required") << QStringLiteral("non-l-required") << QVariantMap(); - QTest::newRow("simple") << QStringLiteral("simple") << QVariantMap(); - QTest::newRow("requires-test") << QStringLiteral("requires-test") << QVariantMap(); - QTest::newRow("special-flags") << QStringLiteral("special-flags") << QVariantMap(); - QTest::newRow("system") << QStringLiteral("system") << QVariantMap(); + QTest::newRow("non-l-required") + << QStringLiteral("non-l-required") << QString() << QVariantMap(); + QTest::newRow("simple") + << QStringLiteral("simple") << QString() << QVariantMap(); + QTest::newRow("requires-test") + << QStringLiteral("requires-test") << QString() << QVariantMap(); + QTest::newRow("requires-test-merged") + << QStringLiteral("requires-test") + << QStringLiteral("requires-test-merged") + << QVariantMap({{"mergeDependencies", true}}); + QTest::newRow("requires-test-merged-static") + << QStringLiteral("requires-test") + << QStringLiteral("requires-test-merged-static") + << QVariantMap({{"mergeDependencies", true}, {"staticMode", true}}); + QTest::newRow("special-flags") + << QStringLiteral("special-flags") << QString() << QVariantMap(); + QTest::newRow("system") + << QStringLiteral("system") << QString() << QVariantMap(); QTest::newRow("sysroot") - << QStringLiteral("sysroot") << QVariantMap({{"sysroot", "/newroot"}}); - QTest::newRow("tilde") << QStringLiteral("tilde") << QVariantMap(); - QTest::newRow("variables") << QStringLiteral("variables") << QVariantMap(); - QTest::newRow("whitespace") << QStringLiteral("whitespace") << QVariantMap(); + << QStringLiteral("sysroot") << QString() << QVariantMap({{"sysroot", "/newroot"}}); + QTest::newRow("tilde") + << QStringLiteral("tilde") << QString() << QVariantMap(); + QTest::newRow("variables") + << QStringLiteral("variables") << QString() << QVariantMap(); + QTest::newRow("whitespace") + << QStringLiteral("whitespace") << QString() << QVariantMap(); + QTest::newRow("base.name") + << QStringLiteral("base.name") << QString() << QVariantMap(); } void TestPkgConfig::benchSystem() |