test/suites/api: Detect tests correctly

The C++ test case didn't work correctly in VPATH builds or with
VALGRIND=1.
This commit is contained in:
Petri Lehtinen 2010-02-02 20:37:00 +02:00
parent b495b96547
commit 5b1a666cf1

View File

@ -6,16 +6,29 @@
# it under the terms of the MIT license. See LICENSE for details. # it under the terms of the MIT license. See LICENSE for details.
is_test() { is_test() {
[ "${test_name%.c}" != "$test_name" ] && return 0 case "$test_name" in
[ -x $test_path -a ! -f $test_path.c ] && return 0 *.c|*.cpp|check-exports)
return 0
;;
*)
return 1 return 1
;;
esac
} }
run_test() { run_test() {
if [ -x $test_path ]; then if [ "$test_name" = "check-exports" ]; then
test_log=$test_log $test_path >$test_log/stdout 2>$test_log/stderr test_log=$test_log $test_path >$test_log/stdout 2>$test_log/stderr
else else
$test_runner $suite_builddir/${test_name%.c} \ case "$test_name" in
*.c)
test_bin=${test_name%.c}
;;
*.cpp)
test_bin=${test_name%.cpp}
;;
esac
$test_runner $suite_builddir/$test_bin \
>$test_log/stdout \ >$test_log/stdout \
2>$test_log/stderr \ 2>$test_log/stderr \
|| return 1 || return 1