1#!/bin/sh 2# 3# Copyright (c) 2009-2014 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 8is_test() { 9 test -d $test_path 10} 11 12do_run() { 13 variant=$1 14 s=".$1" 15 16 strip=0 17 if [ "$variant" = "strip" ]; then 18 # This test should not be stripped 19 [ -f $test_path/nostrip ] && return 20 strip=1 21 fi 22 23 STRIP=$strip $json_process --env \ 24 <$test_path/input >$test_log/stdout$s 2>$test_log/stderr$s 25 valgrind_check $test_log/stderr$s || return 1 26 27 ref=error 28 [ -f $test_path/error$s ] && ref=error$s 29 30 if ! cmp -s $test_path/$ref $test_log/stderr$s; then 31 echo $variant > $test_log/variant 32 return 1 33 fi 34} 35 36run_test() { 37 do_run normal && do_run strip 38} 39 40show_error() { 41 valgrind_show_error && return 42 43 read variant < $test_log/variant 44 s=".$variant" 45 46 echo "VARIANT: $variant" 47 48 echo "EXPECTED ERROR:" 49 ref=error 50 [ -f $test_path/error$s ] && ref=error$s 51 nl -bn $test_path/$ref 52 53 echo "ACTUAL ERROR:" 54 nl -bn $test_log/stderr$s 55} 56 57. $top_srcdir/test/scripts/run-tests.sh 58