summaryrefslogtreecommitdiff
path: root/tests/auto/pkgconfig
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2022-07-31 02:59:08 +0300
committerIvan Komissarov <ABBAPOH@gmail.com>2022-08-05 08:22:45 +0000
commit3e0553e4651197e61c5086d96048b75462bde897 (patch)
treed95e9f080c4d499c8ecc5d0fd2f0fff67f60d5d4 /tests/auto/pkgconfig
parent235bb0a2b96d5c93a15641d152da30ce769f39f9 (diff)
downloadqbs-3e0553e4651197e61c5086d96048b75462bde897.tar.gz
qbspkgconfig: fix handling empty variablesv1.23.1
Variables should be allowed to be set to empty values, only missing variables should produce errors. Fixes: QBS-1702 Change-Id: Ib9aac611a578a3673fb8201099a707e5842fd750 Reviewed-by: Kai Dohmen <psykai1993@googlemail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/pkgconfig')
-rw-r--r--tests/auto/pkgconfig/testdata/empty-variable.json21
-rw-r--r--tests/auto/pkgconfig/testdata/empty-variable.pc13
-rw-r--r--tests/auto/pkgconfig/tst_pkgconfig.cpp2
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/pkgconfig/testdata/empty-variable.json b/tests/auto/pkgconfig/testdata/empty-variable.json
new file mode 100644
index 000000000..b96689979
--- /dev/null
+++ b/tests/auto/pkgconfig/testdata/empty-variable.json
@@ -0,0 +1,21 @@
+{
+ "Name": "Empty Variable test",
+ "Description": "Checks that empty variables are handled correcty",
+ "Version": "1.0.0",
+ "Vars": {
+ "rootprefix": "",
+ "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/empty-variable.pc b/tests/auto/pkgconfig/testdata/empty-variable.pc
new file mode 100644
index 000000000..581382b7e
--- /dev/null
+++ b/tests/auto/pkgconfig/testdata/empty-variable.pc
@@ -0,0 +1,13 @@
+rootprefix=
+prefix=/usr
+exec_prefix=${rootprefix}/${prefix}
+libdir=${exec_prefix}/lib
+includedir=${rootprefix}/${prefix}/include
+
+Name: Empty Variable test
+Description: Checks that empty variables are handled correcty
+Version: 1.0.0
+Requires:
+Libs: -lsimple
+Libs.private: -lm
+Cflags: -I${includedir}
diff --git a/tests/auto/pkgconfig/tst_pkgconfig.cpp b/tests/auto/pkgconfig/tst_pkgconfig.cpp
index ec62e1a7f..220e54e7a 100644
--- a/tests/auto/pkgconfig/tst_pkgconfig.cpp
+++ b/tests/auto/pkgconfig/tst_pkgconfig.cpp
@@ -168,6 +168,8 @@ void TestPkgConfig::pkgConfig_data()
QTest::addColumn<QString>("jsonFileName");
QTest::addColumn<QVariantMap>("optionsMap");
+ QTest::newRow("empty-variable")
+ << QStringLiteral("empty-variable") << QString() << QVariantMap();
QTest::newRow("non-l-required")
<< QStringLiteral("non-l-required") << QString() << QVariantMap();
QTest::newRow("simple")