File: run-tests.sh

package info (click to toggle)
jansson 2.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,696 kB
  • sloc: sh: 11,408; ansic: 5,526; makefile: 100; python: 49
file content (89 lines) | stat: -rw-r--r-- 2,067 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org>
#
# Jansson is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.

json_process=$bindir/json_process

suite_name=$1
suite_srcdir=$suites_srcdir/$suite_name
suite_builddir=$suites_builddir/$suite_name
suite_log=$logdir/$suite_name


[ -z "$VERBOSE" ] && VERBOSE=0
[ -z "$STOP" ] && STOP=0

. $scriptdir/valgrind.sh

rm -rf $suite_log
mkdir -p $suite_log

for test_path in $suite_srcdir/*; do
    test_name=$(basename $test_path)
    test_builddir=$suite_builddir/$test_name
    test_log=$suite_log/$test_name

    [ "$test_name" = "run" ] && continue
    is_test || continue

    rm -rf $test_log
    mkdir -p $test_log
    if [ $VERBOSE -eq 1 ]; then
        printf '%s... ' "$test_name"
    fi

    run_test
    case $? in
        0)
            # Success
            if [ $VERBOSE -eq 1 ]; then
                printf 'ok\n'
            else
                printf '.'
            fi
            rm -rf $test_log
            ;;

        77)
            # Skip
            if [ $VERBOSE -eq 1 ]; then
                printf 'skipped\n'
            else
                printf 'S'
            fi
            rm -rf $test_log
            ;;

        *)
            # Failure
            if [ $VERBOSE -eq 1 ]; then
                printf 'FAILED\n'
            else
                printf 'F'
            fi

            [ $STOP -eq 1 ] && break
            ;;
    esac
done

if [ $VERBOSE -eq 0 ]; then
    printf '\n'
fi

if [ -n "$(ls -A $suite_log)" ]; then
    for test_log in $suite_log/*; do
        test_name=$(basename $test_log)
        test_path=$suite_srcdir/$test_name
        echo "================================================================="
        echo "$suite_name/$test_name"
        echo "================================================================="
        show_error
        echo
    done
    echo "================================================================="
    exit 1
else
    rm -rf $suite_log
fi