jansson/test/suites/valid/run
Petri Lehtinen 9699de8600 Fix tests
2024-03-25 20:08:23 +02:00

51 lines
1 KiB
Bash
Executable file

#!/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.
dtoa_enabled() {
grep -q "DTOA_ENABLED 1" $top_builddir/jansson_private_config.h
}
is_test() {
test -d $test_path
}
do_run() {
if [ -f $test_path/skip_unless_dtoa ]; then
dtoa_enabled || return 77
fi
if [ -f $test_path/skip_if_dtoa ]; then
dtoa_enabled && return 77
fi
variant=$1
s=".$1"
strip=""
[ "$variant" = "strip" ] && strip="--strip"
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