forked from cory/tildefriends
Merge branches/quickjs to trunk. This is the way.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3621 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
46
deps/xopt/test/test-case.sh
vendored
Executable file
46
deps/xopt/test/test-case.sh
vendored
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# To be used with CMake builds located in <xopt>/build/
|
||||
#
|
||||
|
||||
set -uo pipefail
|
||||
exec >&2
|
||||
|
||||
casebin="$1"
|
||||
caseout="$2"
|
||||
shift 2
|
||||
|
||||
function die {
|
||||
echo -e "error: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ -z "$casebin" ]; then
|
||||
die 'no test case executable specified'
|
||||
fi
|
||||
|
||||
if [ -z "$caseout" ]; then
|
||||
die 'no test case output (some-case.out) specified'
|
||||
fi
|
||||
|
||||
if [ ! -x "$casebin" ]; then
|
||||
die "test case does not exist or is not executable: $casebin"
|
||||
fi
|
||||
|
||||
if [ ! -f "$caseout" ]; then
|
||||
die "test case expected output file does not exist: $caseout"
|
||||
fi
|
||||
|
||||
output="$("$casebin" "$@" 2>&1)"
|
||||
r=$?
|
||||
if [ $r -eq 139 ]; then
|
||||
die "xopt test case failed with SEGFAULT ($r)"
|
||||
fi
|
||||
|
||||
diff="$(diff -U0 -d -t "$caseout" - <<< "$output" 2>&1)"
|
||||
if [ ! -z "$diff" ]; then
|
||||
die "xopt test case didn't match expected output: '$caseout'\n$diff"
|
||||
fi
|
Reference in New Issue
Block a user