X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=test%2Fsuites%2Finvalid%2Frun;h=f8394d7f1ca30c4f923446d9492f405193cd1d60;hb=5df7b7939794abc9e8a826919d84d27385a6679d;hp=1c6130d91782e79a3b835292d6111815e6e4620b;hpb=6637b976edd508cc9413ce954fe4275eab8c2c69;p=jansson.git diff --git a/test/suites/invalid/run b/test/suites/invalid/run index 1c6130d..f8394d7 100755 --- a/test/suites/invalid/run +++ b/test/suites/invalid/run @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2009 Petri Lehtinen +# Copyright (c) 2009-2011 Petri Lehtinen # # Jansson is free software; you can redistribute it and/or modify # it under the terms of the MIT license. See LICENSE for details. @@ -9,19 +9,49 @@ is_test() { test -d $test_path } +do_run() { + variant=$1 + s=".$1" + + strip=0 + if [ "$variant" = "strip" ]; then + # This test should not be stripped + [ -f $test_path/nostrip ] && return + strip=1 + fi + + STRIP=$strip $json_process \ + <$test_path/input >$test_log/stdout$s 2>$test_log/stderr$s + valgrind_check $test_log/stderr$s || return 1 + + ref=error + [ -f $test_path/error$s ] && ref=error$s + + if ! cmp -s $test_path/$ref $test_log/stderr$s; then + echo $variant > $test_log/variant + return 1 + fi +} + run_test() { - $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr - valgrind_check $test_log/stderr || return 1 - cmp -s $test_path/error $test_log/stderr + do_run normal && do_run strip } show_error() { valgrind_show_error && return + read variant < $test_log/variant + s=".$variant" + + echo "VARIANT: $variant" + echo "EXPECTED ERROR:" - nl -bn $test_path/error + ref=error + [ -f $test_path/error$s ] && ref=error$s + nl -bn $test_path/$ref + echo "ACTUAL ERROR:" - nl -bn $test_log/stderr + nl -bn $test_log/stderr$s } . $top_srcdir/test/scripts/run-tests.sh