2012-05-03 06:50:57 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Tests for pkg-config compliance.
|
|
|
|
# * Copyright (c) 2012 Michał Górny <mgorny@gentoo.org>.
|
|
|
|
|
|
|
|
done=0
|
|
|
|
failed=0
|
|
|
|
|
|
|
|
run_test() {
|
|
|
|
local res t_ret 2>/dev/null || true
|
2012-07-25 22:47:09 +00:00
|
|
|
local cmdline 2>/dev/null || true
|
2012-05-03 06:50:57 +00:00
|
|
|
|
2012-07-25 22:47:09 +00:00
|
|
|
cmdline="${1}"
|
|
|
|
|
|
|
|
eval res="\$(${1})" 2>/dev/null
|
2012-05-03 06:50:57 +00:00
|
|
|
|
|
|
|
t_ret=0
|
|
|
|
while [ ${#} -gt 1 ]; do
|
|
|
|
shift
|
|
|
|
|
|
|
|
case "${res}" in
|
2012-08-25 23:43:37 +00:00
|
|
|
*"${1}"*)
|
2012-05-03 06:50:57 +00:00
|
|
|
;;
|
|
|
|
*)
|
2012-07-25 22:47:09 +00:00
|
|
|
echo
|
|
|
|
echo "***********************"
|
|
|
|
echo "!!! Test $done failed."
|
|
|
|
echo "!!! $ ${cmdline}"
|
|
|
|
echo "!!! ${res}"
|
|
|
|
echo "!!! expected '${1}' in output"
|
|
|
|
echo "***********************"
|
2012-05-03 06:50:57 +00:00
|
|
|
t_ret=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ${t_ret} -eq 0 ]; then
|
2015-11-01 16:31:07 +00:00
|
|
|
printf "."
|
2012-05-03 06:50:57 +00:00
|
|
|
else
|
|
|
|
failed=$(( failed + 1 ))
|
|
|
|
fi
|
|
|
|
done=$(( done + 1 ))
|
|
|
|
}
|
|
|
|
|
2015-11-01 16:31:47 +00:00
|
|
|
selfdir="@abs_srcdir@"
|
2012-05-03 06:50:57 +00:00
|
|
|
|
2012-09-14 20:50:27 +00:00
|
|
|
PATH_SEP=":"
|
2012-09-14 21:04:20 +00:00
|
|
|
SYSROOT_DIR="${selfdir}/test"
|
2012-09-14 20:50:27 +00:00
|
|
|
if [ "$(uname -o)" = "Msys" ]; then
|
|
|
|
PATH_SEP=";"
|
|
|
|
fi
|
|
|
|
|
2012-05-03 06:50:57 +00:00
|
|
|
# 1) overall 'is it working?' test
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1}; echo \$?" \
|
2012-09-14 19:46:52 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs foo" \
|
2012-05-03 06:50:57 +00:00
|
|
|
'-lfoo'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs foo" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lfoo' '-I/test/include/foo' '-fPIC'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo > 1.2'" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lfoo' '-I/test/include/foo' '-fPIC'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo > 1.2 bar >= 1.3'" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lfoo' '-I/test/include/foo' '-fPIC'
|
2016-05-28 08:35:11 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo > 1.2,bar >= 1.3'" \
|
|
|
|
'-lbar' '-I/test/include/foo' '-fPIC'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo' '>' '1.2'" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lfoo' '-I/test/include/foo' '-fPIC'
|
2016-05-28 08:42:41 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo' '!=' '1.3.0'" \
|
|
|
|
'-lfoo' '-I/test/include/foo' '-fPIC'
|
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags --libs 'foo' '!=' '1.2.3'; echo \$?" \
|
|
|
|
'1'
|
2013-02-25 14:50:11 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists nonexistant; echo \$?" \
|
|
|
|
'1'
|
2013-03-15 21:50:30 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} nonexistant; echo \$?" \
|
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2'; echo \$?" \
|
2012-05-03 06:50:57 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo > 1.2.3'; echo \$?" \
|
2012-05-03 06:50:57 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo' '>' '1.2'; echo \$?" \
|
2012-05-06 02:18:40 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --uninstalled 'foo'; echo \$?" \
|
2012-05-06 04:09:34 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --uninstalled 'omg'; echo \$?" \
|
2012-05-06 04:09:34 +00:00
|
|
|
'0'
|
2012-07-20 21:28:50 +00:00
|
|
|
run_test "${1} --modversion ${selfdir}/lib1/foo.pc" \
|
2012-05-06 05:12:00 +00:00
|
|
|
'1.2.3'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'foo >= '; echo \$?" \
|
2012-07-21 00:55:06 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'tilde <= 1.0.0'; echo \$?" \
|
2012-07-30 10:01:07 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'tilde = 1.0.0~rc1'; echo \$?" \
|
2012-07-24 01:53:20 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists 'tilde >= 1.0.0'; echo \$?" \
|
2012-07-30 10:01:07 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists '' 'foo'; echo \$?" \
|
2012-07-25 15:18:09 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs intermediary-1 intermediary-2" \
|
2012-08-09 21:43:20 +00:00
|
|
|
'-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz'
|
2013-02-24 12:42:03 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs circular-1" \
|
|
|
|
'-lcircular-1 -lcircular-2 -lcircular-3'
|
2013-02-24 14:14:23 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs circular-3" \
|
|
|
|
'-lcircular-3 -lcircular-1 -lcircular-2'
|
2013-03-15 23:11:43 +00:00
|
|
|
run_test "${1} --libs ${selfdir}/lib1/circular-3.pc" \
|
|
|
|
'-lcircular-1 -lcircular-2 -lcircular-3'
|
2013-02-24 12:58:51 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs static-archive-libs" \
|
|
|
|
'/libfoo.a -pthread'
|
2012-05-03 06:50:57 +00:00
|
|
|
|
2012-05-03 07:04:48 +00:00
|
|
|
# 2) tests for PKG_CONFIG_PATH order
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1${PATH_SEP}${selfdir}/lib2' ${1} --libs foo" \
|
2012-05-03 07:04:48 +00:00
|
|
|
'-lfoo'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1${PATH_SEP}${selfdir}/lib2' ${1} --libs bar" \
|
2012-05-03 07:04:48 +00:00
|
|
|
'-lbar'
|
|
|
|
|
2012-05-03 07:15:32 +00:00
|
|
|
# 3) tests for 'Requires' and 'Requires.private'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs bar" \
|
2012-05-03 07:15:32 +00:00
|
|
|
'-lfoo' '-lbar'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs --cflags baz" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lbaz' '-fPIC' '-I/test/include/foo'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs baz" \
|
2012-05-03 19:44:44 +00:00
|
|
|
'-lfoo' '-lbaz' '-lzee'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs argv-parse-2" \
|
2012-07-25 22:07:34 +00:00
|
|
|
'-pthread '
|
2013-08-14 05:36:43 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --cflags baz" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-fPIC' '-I/test/include/foo' '-DFOO_STATIC'
|
2013-08-23 02:41:59 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs-only-l private-libs-duplication" \
|
2015-05-22 03:17:55 +00:00
|
|
|
'-lprivate -lfoo -lbaz -lzee -lbar -lfoo'
|
2015-05-22 03:03:02 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --static --libs static-libs" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lbar -lbar-private -L/test/lib -lfoo'
|
2012-05-03 07:15:32 +00:00
|
|
|
|
2012-05-05 17:43:53 +00:00
|
|
|
# 4) tests for parser bugs
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs dos-lineendings" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-L/test/lib/dos-lineendings -ldos-lineendings'
|
2014-07-31 14:15:31 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags no-trailing-newline" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-I/test/include/no-trailing-newline'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs argv-parse" \
|
2012-05-05 17:43:53 +00:00
|
|
|
'-llib-2 -lpthread'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists -foo; echo \$?" \
|
2012-07-20 22:18:35 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs argv-parse-3" \
|
2012-07-30 06:31:14 +00:00
|
|
|
'-llib-1'
|
2013-02-24 13:04:15 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs tilde-quoting" \
|
|
|
|
'-L~'
|
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags tilde-quoting" \
|
|
|
|
'-I~'
|
2014-07-02 04:30:59 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs paren-quoting" \
|
|
|
|
'-L$(libdir)'
|
2012-05-04 03:08:55 +00:00
|
|
|
|
2012-05-05 21:55:27 +00:00
|
|
|
# 5) tests for other regressions
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=includedir foo" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'/test/include'
|
2013-08-24 05:19:41 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs-only-L --keep-system-libs cflags-libs-only" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-L/test/local/lib'
|
2014-09-14 03:37:00 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs cflags-libs-only" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-L/test/local/lib -lfoo'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs-only-L --libs-only-l cflags-libs-only" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-L/test/local/lib -lfoo'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags-only-I --cflags-only-other cflags-libs-only" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-I/test/local/include'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs incomplete; echo $?" \
|
2012-09-02 22:34:44 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags incomplete" \
|
2012-09-05 12:00:15 +00:00
|
|
|
' '
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs incomplete" \
|
2012-09-05 12:00:15 +00:00
|
|
|
' '
|
2012-05-05 21:55:27 +00:00
|
|
|
|
2012-05-06 02:59:24 +00:00
|
|
|
# 6) tests for builtins
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --modversion pkg-config" \
|
2015-09-03 08:30:43 +00:00
|
|
|
'@PACKAGE_VERSION@'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=prefix foo" \
|
2012-05-07 04:30:37 +00:00
|
|
|
'/test'
|
2015-07-20 08:10:27 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --define-variable=prefix=/test2 --variable=prefix foo" \
|
|
|
|
'/test2'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=pcfiledir foo" \
|
2012-07-21 19:44:38 +00:00
|
|
|
"${selfdir}/lib1"
|
2012-05-06 02:59:24 +00:00
|
|
|
|
2012-05-07 08:44:59 +00:00
|
|
|
# 7) tests for env modifiers
|
2012-09-14 21:04:20 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='${SYSROOT_DIR}' ${1} --cflags baz" \
|
2015-07-20 08:10:27 +00:00
|
|
|
"-I${SYSROOT_DIR}/test/include/foo"
|
2013-02-24 14:57:53 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='${SYSROOT_DIR}' ${1} --variable=prefix baz" \
|
2015-07-20 08:10:27 +00:00
|
|
|
"${SYSROOT_DIR}/test"
|
2013-02-24 14:57:53 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='${SYSROOT_DIR}' ${1} --variable=includedir baz" \
|
2015-07-20 08:10:27 +00:00
|
|
|
"${SYSROOT_DIR}/test/include"
|
2012-05-07 08:44:59 +00:00
|
|
|
|
2012-05-12 01:32:32 +00:00
|
|
|
# 8) tests for 'Conflicts'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs conflicts; echo \$?" \
|
2012-07-30 07:46:03 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --ignore-conflicts --libs conflicts; echo \$?" \
|
2012-05-12 01:32:32 +00:00
|
|
|
'-lconflicts' '0'
|
|
|
|
|
2012-07-02 02:28:38 +00:00
|
|
|
# 9) tests for --atleast-version (with and without trailing space)
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 1.0 foo; echo \$?" \
|
2012-07-02 02:24:53 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 2.0 foo; echo \$?" \
|
2012-07-02 02:24:53 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.0 foo; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.2.3 foo; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 1.0 foo; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 2.0 foo; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'0'
|
|
|
|
|
2012-07-02 02:28:38 +00:00
|
|
|
# tests for issue #20
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 1.0 'foo '; echo \$?" \
|
2012-07-02 02:28:38 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --atleast-version 2.0 'foo '; echo \$?" \
|
2012-07-02 02:28:38 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.0 'foo '; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exact-version 1.2.3 'foo '; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'0'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 1.0 'foo '; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'1'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --max-version 2.0 'foo '; echo \$?" \
|
2012-07-02 03:03:07 +00:00
|
|
|
'0'
|
2012-07-02 02:24:53 +00:00
|
|
|
|
2012-08-12 10:32:31 +00:00
|
|
|
# test missing requires
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags missing-require; echo \$?" \
|
2012-08-12 10:32:31 +00:00
|
|
|
'1'
|
|
|
|
|
2015-02-02 16:29:39 +00:00
|
|
|
# test the multiline description field
|
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --list-all | grep -q 'multiline description'; echo \$?" \
|
|
|
|
'0'
|
|
|
|
|
2012-08-14 09:12:01 +00:00
|
|
|
# test quoted #35
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags quotes" \
|
2012-08-14 09:12:01 +00:00
|
|
|
"-DQUOTED=\\\"bla\\\""
|
|
|
|
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs nolib; echo \$?" \
|
2012-08-20 20:47:10 +00:00
|
|
|
'0'
|
|
|
|
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs nocflag; echo \$?" \
|
2012-08-20 20:47:10 +00:00
|
|
|
'0'
|
|
|
|
|
2012-08-26 00:09:33 +00:00
|
|
|
# test 36 - running against file in CWD with no path
|
|
|
|
# File moved to CWD to allow arbitrary path to pkgconf and keep pc file in CWD
|
|
|
|
run_test "cp ${selfdir}/lib1/foo.pc . && ${1} --libs foo.pc; rm -f foo.pc" \
|
|
|
|
'-lfoo'
|
|
|
|
|
2013-03-15 22:12:06 +00:00
|
|
|
# test 47 - framework flags
|
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-1" \
|
2015-07-20 08:10:27 +00:00
|
|
|
"-F/test/lib -framework framework-1"
|
2013-03-15 22:12:06 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-2" \
|
2016-05-19 22:04:47 +00:00
|
|
|
"-F/test/lib -framework framework-2 -F/test/lib -framework framework-1"
|
2013-12-27 11:20:02 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs framework-1 framework-2" \
|
2016-05-19 22:04:47 +00:00
|
|
|
"-F/test/lib -framework framework-1 -F/test/lib -framework framework-2"
|
2013-03-15 22:12:06 +00:00
|
|
|
|
2016-05-19 21:47:11 +00:00
|
|
|
# test 87 - -isystem munging
|
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags isystem" \
|
|
|
|
"-isystem /opt/bad/include -isystem /opt/bad2/include"
|
|
|
|
|
2013-03-16 01:18:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists --print-errors 'foo > 0.6.0 foo < 0.8.0'; echo \$?" \
|
2013-03-16 01:10:39 +00:00
|
|
|
'1'
|
|
|
|
|
2013-03-20 13:51:15 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists --print-errors 'nonexisting foo <= 3'; echo \$?" \
|
2013-03-17 22:15:33 +00:00
|
|
|
'1'
|
|
|
|
|
2016-05-19 22:37:27 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --exists --print-errors 'depgraph-break'; echo \$?" \
|
|
|
|
'1'
|
|
|
|
|
2013-04-09 12:39:27 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib2' ${1} ${selfdir}/lib3/bar.pc --cflags" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-fPIC -I/test/include/foo'
|
2013-03-20 13:51:15 +00:00
|
|
|
|
2014-02-10 23:50:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=foo case-sensitivity" \
|
|
|
|
"3"
|
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=Foo case-sensitivity" \
|
|
|
|
"4"
|
|
|
|
|
2015-04-20 14:19:33 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs comments-in-fields" \
|
|
|
|
"-lfoo"
|
|
|
|
|
2015-04-23 19:45:26 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs comments" \
|
|
|
|
"-lfoo"
|
|
|
|
|
2014-07-09 06:23:51 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='/sysroot' ${1} --libs sysroot-dir" \
|
|
|
|
'-L/sysroot/lib -lfoo'
|
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='/sysroot2' ${1} --libs sysroot-dir" \
|
|
|
|
'-L/sysroot2/sysroot/lib -lfoo'
|
2015-07-19 20:49:36 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs prefix-foo1" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-L/test/bar/lib -lfoo1'
|
2015-07-19 20:49:36 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs prefix-foo1 prefix-foo2" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-L/test/bar/lib -lfoo1 -lfoo2'
|
2015-07-19 21:00:35 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags prefix-foo1 prefix-foo2" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-I/test/bar/include/foo -DBAR -fPIC -DFOO'
|
2015-12-07 22:29:27 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --variable=typelibdir --define-variable='libdir=\${libdir}' typelibdir" \
|
|
|
|
"\${libdir}/typelibdir"
|
2014-07-09 06:23:51 +00:00
|
|
|
|
2016-08-24 16:21:40 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --print-provides foo" \
|
|
|
|
"foo = 1.2.3"
|
|
|
|
|
2016-08-24 23:12:26 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='/test' ${1} --cflags isystem" \
|
|
|
|
"-isystem /test/opt/bad/include"
|
|
|
|
|
2016-08-25 00:00:10 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' PKG_CONFIG_SYSROOT_DIR='/test' ${1} --cflags cflags-whitespace" \
|
|
|
|
"-I /test/opt/bad/include"
|
|
|
|
|
2012-07-20 18:35:33 +00:00
|
|
|
# 10) tests for internal getopt implementation with options at the end
|
2012-07-25 22:56:10 +00:00
|
|
|
if [ "x@STRICT_MODE@" = "xno" ]; then
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} foo --libs" \
|
2012-07-20 21:33:48 +00:00
|
|
|
'-lfoo'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} foo --cflags --libs" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lfoo' '-I/test/include/foo' '-fPIC'
|
2012-09-14 20:56:45 +00:00
|
|
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --cflags foo --libs" \
|
2015-07-20 08:10:27 +00:00
|
|
|
'-lfoo' '-I/test/include/foo' '-fPIC'
|
2012-07-20 21:33:48 +00:00
|
|
|
fi
|
2012-07-20 18:35:33 +00:00
|
|
|
|
2013-02-24 15:08:06 +00:00
|
|
|
run_test "${1} --blah; echo \$?" \
|
|
|
|
'1'
|
|
|
|
|
2012-07-25 22:47:09 +00:00
|
|
|
echo
|
|
|
|
|
2012-05-03 06:50:57 +00:00
|
|
|
if [ ${failed} -gt 0 ]; then
|
|
|
|
echo "${failed} of ${done} tests failed. See output for details." >&2
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "${done} tests done. All succeeded." >&2
|
|
|
|
exit 0
|
|
|
|
fi
|