-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctest
executable file
·69 lines (52 loc) · 1.76 KB
/
Functest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
#
# This is expected to be called from ../Test.
# It assumes that the virtualenv with r8format is activated.
#
set -eu -o pipefail
trap 'ec=$?; echo 1>&2 "INTERNAL ERROR: ec=$ec line=$LINENO cmd=$BASH_COMMAND";
exit $ec;' ERR
PASSED=false
trap 'ec=$?; $PASSED || { echo 1>&2 "*** FAILED (exitcode=$ec)"; }' 0
qecho() {
[[ -n $quiet ]] && return
echo "$@"
}
hexdiff() {
cmp "$1" "$2" && return 0
diff -U 0 \
--label "$1" --label "$2" \
<(xxd -c8 -g1 "$1") <(xxd -c8 -g1 "$2")
}
####################################################################
[[ -d ${T8_PROJDIR:-} ]] || { echo 2>&1 \
'$T8_PROJDIR not set; not called from top-level Test?'; exit 7; }
basedir=$(cd "$(dirname "$0")" && pwd -P)
cd "$basedir"
# -q anywhere in the command line (even with -v!) sets functests quiet.
quiet=
for arg in "$@"; do [[ $arg == -q ]] && quiet=-q; done
####################################################################
# Unit tests have already been done by ../Test.
####################################################################
# Functional Tests
ftdata=$T8_PROJDIR/.build/programs/
mkdir -p $ftdata/detok
echo "====== bastok"
qecho "------ basdump basdump.bas"
basdump programs/basdump.bas | diff - programs/basdump.dump
qecho "------ detok simple.bas"
detok programs/simple.bas >$ftdata/detok/simple.ba0
diff -u {$ftdata/detok,programs}/simple.ba0
qecho "------ detok -e simple.bas"
detok -e programs/simple.bas >$ftdata/detok/simple.ba1
diff -u {$ftdata/detok,programs}/simple.ba1
{
f="binchars"
qecho "------ detok --binary $f.bas"
detok --binary programs/$f.bas >$ftdata/detok/$f.baa
hexdiff {$ftdata/detok,programs}/$f.baa
}
echo "====== cmtconv"
src/cmtconv/Test "$@"
PASSED=true