pkg-config/check/check-missing
Dan Nicholson 305913a6b1 Handle POSIX shell for tests in configure and Makefile
Although the trick of finding a POSIX shell in the system PATH works
fine most of the time, it has some drawbacks.

* The commands must be copied into every test script.
* The scripts are always forced to re-execute themselves.
* There's no guarantee the sh found in `getconf PATH` is a POSIX shell
  and there's no way to override it.

Move the handling of this shell to configure where we can detect it
once. This gives preference to bash and ksh since they're typically
POSIX compatible. It also uses the current PATH with the getconf PATH at
the end which should allow things to work on platforms where getconf
might not be available like mingw/msys.

By specifying the shell in TESTS_ENVIRONMENT, automake will run each
script with this shell and we can drop the re-exec dance.
2012-08-19 08:03:00 -07:00

89 lines
2.3 KiB
Bash
Executable file

#! /bin/sh
set -e
. ${srcdir}/common
# non-existent package; call should fail and cause no output
EXPECT_RETURN=1
RESULT=""
ARGS="--exists pkg-non-existent"
run_test
# existing package, but with missing Requires
EXPECT_RETURN=1
RESULT=""
ARGS="--exists missing-requires"
run_test
# tests below are on an existing package, but with missing Requires.private;
# when pkg-config outputs error, the actual error text isn't checked
# package exists, but should fail since deps can't be resolved
ARGS="--exists missing-requires-private"
EXPECT_RETURN=1
RESULT=""
run_test
# get Libs
ARGS="--libs missing-requires-private"
if [ "$list_indirect_deps" = "yes" ]; then
EXPECT_RETURN=1
RESULT='Package pkg-non-existent-private-dep was not found in the pkg-config search path.
Perhaps you should add the directory containing `pkg-non-existent-private-dep.pc'\''
to the PKG_CONFIG_PATH environment variable
Package '\''pkg-non-existent-private-dep'\'', required by '\''Missing Requires.private test package'\'', not found'
else
EXPECT_RETURN=0
RESULT="-L/missing-requires-private/lib -lmissing-requires-private"
fi
run_test
# Libs.private should fail (verbosely, but the output isn't verified)
ARGS="--silence-errors --static --libs missing-requires-private"
EXPECT_RETURN=1
RESULT=""
run_test
# Cflags.private should fail (verbosely, but the output isn't verified)
ARGS="--silence-errors --static --cflags missing-requires-private"
EXPECT_RETURN=1
RESULT=""
run_test
# Cflags should fail (verbosely, but the output isn't verified)
ARGS="--silence-errors --cflags missing-requires-private"
EXPECT_RETURN=1
RESULT=""
run_test
# get includedir var
ARGS="--variable includedir missing-requires-private"
EXPECT_RETURN=0
RESULT="/usr/include/somedir"
run_test
# tests below are on an existing package, but with missing Requires; when
# pkg-config outputs error, the actual error text isn't checked
# package exists
ARGS="missing-requires"
EXPECT_RETURN=0
RESULT=""
run_test
# Libs should fail
ARGS="--silence-errors --libs missing-requires"
EXPECT_RETURN=1
RESULT=""
run_test
# Cflags should fail
ARGS="--silence-errors --cflags missing-requires"
EXPECT_RETURN=1
RESULT=""
run_test
# get includedir var
ARGS="--variable includedir missing-requires"
EXPECT_RETURN=0
RESULT="/usr/include/somedir"
run_test