Merge branch '1.2'
[jansson.git] / test / suites / api / run
1 #!/bin/sh
2 #
3 # Copyright (c) 2009, 2010 Petri Lehtinen <petri@digip.org>
4 #
5 # Jansson is free software; you can redistribute it and/or modify
6 # it under the terms of the MIT license. See LICENSE for details.
7
8 is_test() {
9     case "$test_name" in
10         *.c|*.cpp|check-exports)
11             return 0
12             ;;
13         *)
14             return 1
15             ;;
16     esac
17 }
18
19 run_test() {
20     if [ "$test_name" = "check-exports" ]; then
21         test_log=$test_log $test_path >$test_log/stdout 2>$test_log/stderr
22     else
23         case "$test_name" in
24             *.c)
25                 test_bin=${test_name%.c}
26                 ;;
27             *.cpp)
28                 test_bin=${test_name%.cpp}
29                 ;;
30         esac
31         $test_runner $suite_builddir/$test_bin \
32             >$test_log/stdout \
33             2>$test_log/stderr \
34             || return 1
35         valgrind_check $test_log/stderr || return 1
36     fi
37 }
38
39 show_error() {
40     valgrind_show_error && return
41     cat $test_log/stderr
42 }
43
44 . $top_srcdir/test/scripts/run-tests.sh