aboutsummaryrefslogtreecommitdiff
path: root/contrib/bc/tests/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bc/tests/test.sh')
-rwxr-xr-xcontrib/bc/tests/test.sh32
1 files changed, 20 insertions, 12 deletions
diff --git a/contrib/bc/tests/test.sh b/contrib/bc/tests/test.sh
index 20f95413597b..c6c4cc250ba3 100755
--- a/contrib/bc/tests/test.sh
+++ b/contrib/bc/tests/test.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 2 ]; then
printf 'usage: %s dir test [generate_tests] [time_tests] [exe [args...]]\n' "$0"
printf 'valid dirs are:\n'
@@ -71,7 +73,17 @@ else
exe="$testdir/../bin/$d"
fi
-out="$testdir/../.log_${d}_test.txt"
+out="$testdir/${d}_outputs/${t}_results.txt"
+outdir=$(dirname "$out")
+
+if [ ! -d "$outdir" ]; then
+ mkdir -p "$outdir"
+fi
+
+unset BC_ENV_ARGS
+unset BC_LINE_LENGTH
+unset DC_ENV_ARGS
+unset DC_LINE_LENGTH
if [ "$d" = "bc" ]; then
options="-lq"
@@ -83,14 +95,6 @@ else
halt="q"
fi
-if [ "${exe#*toybox}" != "$exe" -o "${exe#*busybox}" != "$exe" ]; then
- if [ "$t" = "print2" -o "$t" = "misc4" ]; then
- base=$(basename "$exe")
- printf 'Skipping %s test for %s...\n' "$t" "$base"
- exit 0
- fi
-fi
-
if [ ! -f "$name" ]; then
if [ "$generate_tests" -eq 0 ]; then
@@ -115,18 +119,22 @@ fi
export $var=string
+set +e
+
printf 'Running %s %s...' "$d" "$t"
if [ "$time_tests" -ne 0 ]; then
printf '\n'
printf '%s\n' "$halt" | /usr/bin/time -p "$exe" "$@" $options "$name" > "$out"
+ err="$?"
printf '\n'
else
printf '%s\n' "$halt" | "$exe" "$@" $options "$name" > "$out"
+ err="$?"
fi
-diff "$results" "$out"
+checktest "$d" "$err" "$t" "$results" "$out"
rm -f "$out"
-printf 'pass\n'
+exec printf 'pass\n'