gash/check.sh

203 lines
2.9 KiB
Bash
Raw Normal View History

if [ -n "$V" ]; then
set -x
fi
DIFF=diff
SHELL=${SHELL-scripts/gash}
tests='
00-exit
00-exit-0
00-exit-1
2018-11-13 08:02:35 +00:00
00-exit-2
2018-12-01 07:42:15 +00:00
00-exit-error
00-exit-var
01-script-newline
01-script-semi
01-script-backslash
2018-11-10 09:16:50 +00:00
01-script-backslash-space
01-script-backslash-twice
01-script-$0
2018-12-01 08:38:09 +00:00
01-script-$#
01-script-$@
2018-11-25 07:46:10 +00:00
01-script-shift
2018-11-03 10:29:34 +00:00
03-echo
2018-11-04 19:45:40 +00:00
03-echo-doublequotes
2018-11-03 10:29:34 +00:00
03-echo-nesting
03-echo-escaped-doublequotes
03-echo-quoted-doublequotes
2018-12-01 07:00:12 +00:00
03-echo-brace
2018-11-03 10:29:34 +00:00
04-echo-var
2018-11-03 10:29:34 +00:00
04-echo-equal
2018-12-02 08:42:35 +00:00
04-echo-word-at
2018-12-02 08:51:41 +00:00
04-echo-word-at-word
2018-11-03 10:29:34 +00:00
05-assignment
2018-10-31 19:22:13 +00:00
05-assignment-echo
2018-11-03 10:29:34 +00:00
05-assignment-empty
2018-10-31 19:22:13 +00:00
05-assignment-singlequote
05-assignment-double-quote
05-assignment-variable-word
2018-11-03 10:29:34 +00:00
05-assignment-word-variable
05-assignment-doublequoted-doublequotes
06-compound-word
06-command-compound-word
07-variable-or
07-variable-not-or
07-variable-or-slash
07-variable-or-variable
07-variable-or-doublequote
2018-11-25 10:53:29 +00:00
07-variable-or-empty
08-variable-and
08-variable-not-and
10-if
2018-11-03 10:29:34 +00:00
10-if-false
10-if-word-variable
2018-11-10 09:59:08 +00:00
10-if-multiple
10-if-else
10-else-multiple
10-if-elif
10-if-test
10-if-test-false
10-if-bracket
10-if-bracket-false
2018-11-10 11:07:07 +00:00
10-if-redirect
2018-11-10 09:59:08 +00:00
2018-11-03 10:29:34 +00:00
11-for
11-for-split-sequence
11-for-done-subshell
2018-11-03 10:29:34 +00:00
20-semi
20-or
20-and
20-pipe-exit-0
2018-11-03 10:29:34 +00:00
20-pipe-exit-1
20-pipe-sed
2018-12-01 07:03:04 +00:00
20-exec
2018-11-03 10:29:34 +00:00
30-substitution
2018-12-01 07:19:28 +00:00
30-substitution-word
2018-11-03 10:29:34 +00:00
30-substitution-backtick
30-substitution-assignment
30-for-substitution
2018-11-24 19:48:21 +00:00
30-substitution-assignment
2018-12-01 09:40:20 +00:00
30-substitution-assignment-at
2018-11-24 19:48:21 +00:00
30-substitution-redirect
2018-11-03 10:29:34 +00:00
40-eval
40-eval-echo-variable
2018-11-10 09:16:50 +00:00
40-assignment-eval-echo
2018-11-03 10:29:34 +00:00
41-dot
2018-11-24 12:17:21 +00:00
42-sh
2018-12-08 06:55:55 +00:00
42-sh-export
2018-11-10 09:25:02 +00:00
2018-11-03 10:29:34 +00:00
50-iohere
2018-11-14 21:49:06 +00:00
50-iohere-builtin
50-redirect
50-redirect-space
50-redirect-in
50-redirect-append
2018-11-24 20:05:59 +00:00
50-redirect-pipe
2018-11-24 20:57:34 +00:00
50-redirect-merge
2018-11-30 13:17:46 +00:00
50-redirect-sed
2018-12-02 06:15:45 +00:00
50-redirect-in-out
2018-11-03 10:29:34 +00:00
2018-11-04 19:45:40 +00:00
60-function
2018-12-01 08:38:09 +00:00
60-function-at
2018-11-04 19:45:40 +00:00
60-subst
2018-11-10 09:16:50 +00:00
70-hash
70-hash-hash
70-percent
70-percent-percent
70-percent-space
70-slash
70-slash-string
70-slash-string-slash
2018-11-05 21:37:55 +00:00
2018-11-24 10:32:33 +00:00
100-cd
100-cd-foo
2018-12-03 19:59:10 +00:00
100-test
2018-11-30 15:36:00 +00:00
100-test-file
100-bracket-file
100-basename-root
100-dirname-root
100-basename-autoconf
100-dirname-autoconf
2018-11-03 10:29:34 +00:00
100-sed
100-sed-once
100-sed-global
100-sed-case
100-sed-group
100-sed-group-extended
100-sed-twice
100-sed-undo
100-sed-file
2018-12-02 06:35:13 +00:00
100-sed-fooRbar
2018-12-09 19:03:27 +00:00
100-sed-pattern-address
2018-12-09 19:36:08 +00:00
100-sed-quit
100-sed-autoconf-basename
2018-11-03 10:29:34 +00:00
100-tar
100-tar-Z
100-tar-Z-old
100-tar-Z-pipe
100-tar-ro
2018-11-30 15:36:00 +00:00
2018-12-02 06:15:45 +00:00
100-tr
'
broken="
"
if [ "$(basename $SHELL)" = bash ]; then
broken="
00-sed
"
fi
expect=$(echo $broken | wc -w)
pass=0
fail=0
total=0
for t in $tests; do
if [ "$PARSE" ]; then
scripts/gash -p "tests/$t.sh"
else
sh test.sh "tests/$t" &> tests/"$t".log
fi
r=$?
total=$((total+1))
if [ $r = 0 ]; then
echo $t: [OK]
pass=$((pass+1))
else
echo $t: [FAIL]
fail=$((fail+1))
fi
done
[ $expect != 0 ] && echo "expect: $expect"
[ $fail != 0 ] && echo "failed: $fail"
[ $fail -lt $expect ] && echo "solved: $(($expect - $fail))"
echo "passed: $pass"
echo "total: $total"
if [ $fail != 0 -a $fail -gt $expect ]; then
echo FAILED: $fail/$total
exit 1
elif [ $fail != 0 ]; then
echo PASS: $pass/$total
else
echo PASS: $total
fi