summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2010-06-16 16:49:52 -0700
committerDan Nicholson <dbn.lists@gmail.com>2010-06-16 16:49:52 -0700
commita465eacaf681ea34abc3eb9ffac0718df07f63ff (patch)
tree5729224cecd5e647e3bae05e7aa43ef800ed45eb
parent68763c08def48db755345a7a5f6640458c3b28ad (diff)
Add test to exercise broken command option handling
The ancient bundled popt mishandles some cases of option parsing. http://lists.freedesktop.org/archives/pkg-config/2010-March/000508.html Add a test program to exercise it. This should encourage people to use an external popt until we have a better fix.
-rw-r--r--check/Makefile.am3
-rwxr-xr-xcheck/check-cmd-options33
2 files changed, 35 insertions, 1 deletions
diff --git a/check/Makefile.am b/check/Makefile.am
index 9c9d6a8..29ec729 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -1,7 +1,8 @@
TESTS = check-cflags check-libs check-define-variable \
check-libs-private check-requires-private check-includedir \
- check-conflicts check-missing check-idirafter check-whitespace
+ check-conflicts check-missing check-idirafter check-whitespace \
+ check-cmd-options
EXTRA_DIST = $(TESTS) common simple.pc requires-test.pc public-dep.pc \
private-dep.pc includedir.pc missing-requires-private.pc \
diff --git a/check/check-cmd-options b/check/check-cmd-options
new file mode 100755
index 0000000..cd22f17
--- /dev/null
+++ b/check/check-cmd-options
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+# Make sure we're POSIX
+if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
+ PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
+fi
+
+set -e
+
+. ${srcdir}/common
+
+# all of these should fail, but when '=' or ' ' aren't used consistently
+# between the two options, broken popt sets the version to compare to be
+# "a=b"
+ARGS="--define-variable=a=b --atleast-pkgconfig-version=999.999"
+EXPECT_RETURN=1
+RESULT=""
+run_test
+
+ARGS="--define-variable=a=b --atleast-pkgconfig-version 999.999"
+EXPECT_RETURN=1
+RESULT=""
+run_test
+
+ARGS="--define-variable a=b --atleast-pkgconfig-version 999.999"
+EXPECT_RETURN=1
+RESULT=""
+run_test
+
+ARGS="--define-variable a=b --atleast-pkgconfig-version=999.999"
+EXPECT_RETURN=1
+RESULT=""
+run_test