forked from ariadne/pkgconf
tests: quote safety
parent
1f373a2654
commit
fa0b2f9fc2
120
tests/run.sh.in
120
tests/run.sh.in
|
@ -49,145 +49,145 @@ if [ "$(uname -o)" = "Msys" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 1) overall 'is it working?' test
|
# 1) overall 'is it working?' test
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1}; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1}; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs foo" \
|
||||||
'-lfoo'
|
'-lfoo'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags --libs foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs foo" \
|
||||||
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags --libs 'foo > 1.2'" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo > 1.2'" \
|
||||||
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags --libs 'foo > 1.2 bar >= 1.3'" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo > 1.2 bar >= 1.3'" \
|
||||||
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags --libs 'foo' '>' '1.2'" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo' '>' '1.2'" \
|
||||||
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists 'foo > 1.2'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2'; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists 'foo > 1.2.3'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2.3'; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists 'foo' '>' '1.2'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo' '>' '1.2'; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --uninstalled 'foo'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --uninstalled 'foo'; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --uninstalled 'omg'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --uninstalled 'omg'; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "${1} --modversion ${selfdir}/lib1/foo.pc" \
|
run_test "${1} --modversion ${selfdir}/lib1/foo.pc" \
|
||||||
'1.2.3'
|
'1.2.3'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists 'foo >= '; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo >= '; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists 'tilde <= 1.0.0'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'tilde <= 1.0.0'; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists 'tilde = 1.0.0~rc1'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'tilde = 1.0.0~rc1'; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists 'tilde >= 1.0.0'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'tilde >= 1.0.0'; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists '' 'foo'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists '' 'foo'; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs intermediary-1 intermediary-2" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs intermediary-1 intermediary-2" \
|
||||||
'-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz'
|
'-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz'
|
||||||
|
|
||||||
# 2) tests for PKG_CONFIG_PATH order
|
# 2) tests for PKG_CONFIG_PATH order
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1${PATH_SEP}${selfdir}/lib2 ${1} --libs foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1${PATH_SEP}${selfdir}/lib2' ${1} --libs foo" \
|
||||||
'-lfoo'
|
'-lfoo'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib2${PATH_SEP}${selfdir}/lib1 ${1} --libs foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1${PATH_SEP}${selfdir}/lib2' ${1} --libs bar" \
|
||||||
'-lbar'
|
'-lbar'
|
||||||
|
|
||||||
# 3) tests for 'Requires' and 'Requires.private'
|
# 3) tests for 'Requires' and 'Requires.private'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs bar" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs bar" \
|
||||||
'-lfoo' '-lbar'
|
'-lfoo' '-lbar'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs --cflags baz" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs --cflags baz" \
|
||||||
'-lbaz' '-fPIC' '-I/usr/include/foo'
|
'-lbaz' '-fPIC' '-I/usr/include/foo'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --static --libs baz" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs baz" \
|
||||||
'-lfoo' '-lbaz' '-lzee'
|
'-lfoo' '-lbaz' '-lzee'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --static --libs argv-parse-2" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs argv-parse-2" \
|
||||||
'-pthread '
|
'-pthread '
|
||||||
|
|
||||||
# 4) tests for parser bugs
|
# 4) tests for parser bugs
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs dos-lineendings" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs dos-lineendings" \
|
||||||
'-L/usr/lib/dos-lineendings -ldos-lineendings'
|
'-L/usr/lib/dos-lineendings -ldos-lineendings'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs argv-parse" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs argv-parse" \
|
||||||
'-llib-2 -lpthread'
|
'-llib-2 -lpthread'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exists -foo; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists -foo; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs argv-parse-3" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs argv-parse-3" \
|
||||||
'-llib-1'
|
'-llib-1'
|
||||||
|
|
||||||
# 5) tests for other regressions
|
# 5) tests for other regressions
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --variable=includedir foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=includedir foo" \
|
||||||
'/usr/include'
|
'/usr/include'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs-only-L cflags-libs-only" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs-only-L cflags-libs-only" \
|
||||||
'-L/usr/local/lib'
|
'-L/usr/local/lib'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs-only-L --libs-only-l cflags-libs-only" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs-only-L --libs-only-l cflags-libs-only" \
|
||||||
'-lfoo'
|
'-lfoo'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags-only-I --cflags-only-other cflags-libs-only" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags-only-I --cflags-only-other cflags-libs-only" \
|
||||||
'-I/usr/local/include'
|
'-I/usr/local/include'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs incomplete; echo $?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs incomplete; echo $?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags incomplete" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags incomplete" \
|
||||||
' '
|
' '
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs incomplete" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs incomplete" \
|
||||||
' '
|
' '
|
||||||
|
|
||||||
# 6) tests for builtins
|
# 6) tests for builtins
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --modversion pkg-config" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --modversion pkg-config" \
|
||||||
'0.27'
|
'0.27'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --variable=prefix foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=prefix foo" \
|
||||||
'/usr'
|
'/usr'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --define-variable=prefix=/test --variable=prefix foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --define-variable=prefix=/test --variable=prefix foo" \
|
||||||
'/test'
|
'/test'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --variable=pcfiledir foo" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=pcfiledir foo" \
|
||||||
"${selfdir}/lib1"
|
"${selfdir}/lib1"
|
||||||
|
|
||||||
# 7) tests for env modifiers
|
# 7) tests for env modifiers
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 PKG_CONFIG_SYSROOT_DIR=/test ${1} --cflags baz" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='/test' ${1} --cflags baz" \
|
||||||
'-I/test/usr/include/foo'
|
'-I/test/usr/include/foo'
|
||||||
|
|
||||||
# 8) tests for 'Conflicts'
|
# 8) tests for 'Conflicts'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs conflicts; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs conflicts; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --ignore-conflicts --libs conflicts; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --ignore-conflicts --libs conflicts; echo \$?" \
|
||||||
'-lconflicts' '0'
|
'-lconflicts' '0'
|
||||||
|
|
||||||
# 9) tests for --atleast-version (with and without trailing space)
|
# 9) tests for --atleast-version (with and without trailing space)
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --atleast-version 1.0 foo; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 1.0 foo; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --atleast-version 2.0 foo; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 2.0 foo; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exact-version 1.0 foo; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.0 foo; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exact-version 1.2.3 foo; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.2.3 foo; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 1.0 foo; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 1.0 foo; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 2.0 foo; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 2.0 foo; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
|
|
||||||
# tests for issue #20
|
# tests for issue #20
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --atleast-version 1.0 'foo '; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 1.0 'foo '; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --atleast-version 2.0 'foo '; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 2.0 'foo '; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exact-version 1.0 'foo '; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.0 'foo '; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --exact-version 1.2.3 'foo '; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.2.3 'foo '; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 1.0 'foo '; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 1.0 'foo '; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --max-version 2.0 'foo '; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 2.0 'foo '; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
|
|
||||||
# test missing requires
|
# test missing requires
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags missing-require; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags missing-require; echo \$?" \
|
||||||
'1'
|
'1'
|
||||||
|
|
||||||
# test quoted #35
|
# test quoted #35
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags quotes" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags quotes" \
|
||||||
"-DQUOTED=\\\"bla\\\""
|
"-DQUOTED=\\\"bla\\\""
|
||||||
|
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs nolib; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs nolib; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
|
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs nocflag; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs nocflag; echo \$?" \
|
||||||
'0'
|
'0'
|
||||||
|
|
||||||
# test 36 - running against file in CWD with no path
|
# test 36 - running against file in CWD with no path
|
||||||
|
@ -197,11 +197,11 @@ run_test "cp ${selfdir}/lib1/foo.pc . && ${1} --libs foo.pc; rm -f foo.pc" \
|
||||||
|
|
||||||
# 10) tests for internal getopt implementation with options at the end
|
# 10) tests for internal getopt implementation with options at the end
|
||||||
if [ "x@STRICT_MODE@" = "xno" ]; then
|
if [ "x@STRICT_MODE@" = "xno" ]; then
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} foo --libs" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} foo --libs" \
|
||||||
'-lfoo'
|
'-lfoo'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} foo --cflags --libs" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} foo --cflags --libs" \
|
||||||
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||||
run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --cflags foo --libs" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags foo --libs" \
|
||||||
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
'-lfoo' '-I/usr/include/foo' '-fPIC'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue