34 lines
666 B
Bash
Executable File
34 lines
666 B
Bash
Executable File
set -e
|
|
if [ -n "$V" ]; then
|
|
set -x
|
|
fi
|
|
DIFF=${DIFF-diff}
|
|
TEST_SHELL=${TEST_SHELL-gash}
|
|
|
|
t="$1"
|
|
s=tests/$(basename "$t" .sh)
|
|
|
|
# This is a hack to make sure we can build from an external directory.
|
|
# We move into the source directory, and then send all of our output
|
|
# back to the build directory.
|
|
export TEST_TMP=$(pwd)
|
|
b=$(pwd)/$s
|
|
cd $(dirname "$t")/..
|
|
|
|
set +e
|
|
timeout 10 $TEST_SHELL -e "$s".sh -s --long file0 file1 > "$b".1 2> "$b".2
|
|
r=$?
|
|
set -e
|
|
if [ -f "$s".exit ]; then
|
|
e=$(cat "$s".exit)
|
|
else
|
|
e=0
|
|
fi
|
|
[ $r = $e ] || exit 1
|
|
if [ -f "$s".stdout ]; then
|
|
$DIFF -u "$s".stdout $b.1
|
|
fi
|
|
if [ -f "$s".stderr ]; then
|
|
$DIFF -u "$s".stderr "$b".2
|
|
fi
|