diff options
Diffstat (limited to 'contrib/bc/tests/stdin.sh')
-rwxr-xr-x | contrib/bc/tests/stdin.sh | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/contrib/bc/tests/stdin.sh b/contrib/bc/tests/stdin.sh index f66019d5ae65..581a6df52d73 100755 --- a/contrib/bc/tests/stdin.sh +++ b/contrib/bc/tests/stdin.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -33,6 +33,8 @@ script="$0" testdir=$(dirname "$script") +. "$testdir/../functions.sh" + if [ "$#" -lt 1 ]; then printf 'usage: %s dir [exe [args...]]\n' "$0" printf 'valid dirs are:\n' @@ -52,7 +54,12 @@ else exe="$testdir/../bin/$d" fi -out="$testdir/../.log_${d}_test.txt" +out="$testdir/${d}_outputs/stdin_results.txt" +outdir=$(dirname "$out") + +if [ ! -d "$outdir" ]; then + mkdir -p "$outdir" +fi if [ "$d" = "bc" ]; then options="-ilq" @@ -62,20 +69,22 @@ fi rm -f "$out" +set +e + printf 'Running %s stdin tests...' "$d" cat "$testdir/$d/stdin.txt" | "$exe" "$@" "$options" > "$out" 2> /dev/null -diff "$testdir/$d/stdin_results.txt" "$out" +checktest "$d" "$?" "stdin" "$testdir/$d/stdin_results.txt" "$out" if [ "$d" = "bc" ]; then cat "$testdir/$d/stdin1.txt" | "$exe" "$@" "$options" > "$out" 2> /dev/null - diff "$testdir/$d/stdin1_results.txt" "$out" + checktest "$d" "$?" "stdin" "$testdir/$d/stdin1_results.txt" "$out" cat "$testdir/$d/stdin2.txt" | "$exe" "$@" "$options" > "$out" 2> /dev/null - diff "$testdir/$d/stdin2_results.txt" "$out" + checktest "$d" "$?" "stdin" "$testdir/$d/stdin2_results.txt" "$out" fi -rm -f "$out1" +rm -f "$out" -printf 'pass\n' +exec printf 'pass\n' |