aboutsummaryrefslogtreecommitdiff
path: root/test/suites/invalid/run
blob: ee1ee1aa0ea6ae8e749d5a7edbca8083ab635934 (plain)
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
#!/bin/sh
#
# Copyright (c) 2009-2016 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.

is_test() {
    test -d $test_path
}

do_run() {
    variant=$1
    s=".$1"

    strip=""
    if [ "$variant" = "strip" ]; then
        # This test should not be stripped
        [ -f $test_path/nostrip ] && return
        strip="--strip"
    fi

    if ! $json_process $strip $test_path >$test_log/stdout$s 2>$test_log/stderr$s; then
        echo $variant >$test_log/variant
        return 1
    fi
    valgrind_check $test_log/stderr$s || return 1
}

run_test() {
    do_run normal && do_run strip
}

show_error() {
    valgrind_show_error && return

    read variant < $test_log/variant
    s=".$variant"

    echo "VARIANT: $variant"
    cat $test_log/stderr$s
}

. $top_srcdir/test/scripts/run-tests.sh