Add a couple of regression tests for /bin/sh.
This commit is contained in:
parent
4f6bd877d3
commit
ce5d9c9b6d
4
tools/regression/bin/sh/Makefile
Normal file
4
tools/regression/bin/sh/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
|
||||
all:
|
||||
sh regress.sh
|
6
tools/regression/bin/sh/builtins/alias.0
Normal file
6
tools/regression/bin/sh/builtins/alias.0
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
|
||||
unalias -a
|
||||
alias foo=bar
|
||||
alias
|
1
tools/regression/bin/sh/builtins/alias.0.stdout
Normal file
1
tools/regression/bin/sh/builtins/alias.0.stdout
Normal file
@ -0,0 +1 @@
|
||||
foo='bar'
|
3
tools/regression/bin/sh/builtins/alias.1
Normal file
3
tools/regression/bin/sh/builtins/alias.1
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
unalias -a
|
||||
alias foo
|
1
tools/regression/bin/sh/builtins/alias.1.stderr
Normal file
1
tools/regression/bin/sh/builtins/alias.1.stderr
Normal file
@ -0,0 +1 @@
|
||||
alias: foo not found
|
21
tools/regression/bin/sh/builtins/unalias.0
Normal file
21
tools/regression/bin/sh/builtins/unalias.0
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
|
||||
alias false=true
|
||||
false
|
||||
unalias false
|
||||
false && exit 1
|
||||
unalias false && exit 1
|
||||
|
||||
alias a1=foo a2=bar
|
||||
unalias a1 a2
|
||||
unalias a1 && exit 1
|
||||
unalias a2 && exit 1
|
||||
alias a2=bar
|
||||
unalias a1 a2 && exit 1
|
||||
|
||||
alias a1=foo a2=bar
|
||||
unalias -a
|
||||
unalias a1 && exit 1
|
||||
unalias a2 && exit 1
|
||||
exit 0
|
42
tools/regression/bin/sh/regress.sh
Normal file
42
tools/regression/bin/sh/regress.sh
Normal file
@ -0,0 +1,42 @@
|
||||
# $FreeBSD$
|
||||
|
||||
echo '1..31'
|
||||
|
||||
COUNTER=1
|
||||
|
||||
do_test() {
|
||||
local c
|
||||
c=${COUNTER}
|
||||
COUNTER=$((COUNTER+1))
|
||||
sh $1 > tmp.stdout 2> tmp.stderr
|
||||
if [ $? -ne $2 ]; then
|
||||
echo "not ok ${c} - ${1} # wrong exit status"
|
||||
rm tmp.stdout tmp.stderr
|
||||
return
|
||||
fi
|
||||
for i in stdout stderr; do
|
||||
if [ -f ${1}.${i} ]; then
|
||||
if ! cmp -s tmp.${i} ${1}.${i}; then
|
||||
echo "not ok ${c} - ${1} # wrong output on ${i}"
|
||||
rm tmp.stdout tmp.stderr
|
||||
return
|
||||
fi
|
||||
elif [ -s tmp.${i} ]; then
|
||||
echo "not ok ${c} - ${1} # wrong output on ${i}"
|
||||
rm tmp.stdout tmp.stderr
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo "ok ${c} - ${1}"
|
||||
rm tmp.stdout tmp.stderr
|
||||
}
|
||||
|
||||
SUCCESS=$(find . -name "*.0")
|
||||
for i in ${SUCCESS} ; do
|
||||
do_test ${i} 0
|
||||
done
|
||||
|
||||
FAILURE=$(find . -name "*.1")
|
||||
for i in ${FAILURE} ; do
|
||||
do_test ${i} 1
|
||||
done
|
6
tools/regression/bin/sh/regress.t
Normal file
6
tools/regression/bin/sh/regress.t
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
sh regress.sh
|
3
tools/regression/bin/sh/set-e/and1.0
Normal file
3
tools/regression/bin/sh/set-e/and1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
true && true
|
4
tools/regression/bin/sh/set-e/and2.1
Normal file
4
tools/regression/bin/sh/set-e/and2.1
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
true && false
|
||||
exit 0
|
4
tools/regression/bin/sh/set-e/and3.0
Normal file
4
tools/regression/bin/sh/set-e/and3.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false && true
|
||||
exit 0
|
4
tools/regression/bin/sh/set-e/and4.0
Normal file
4
tools/regression/bin/sh/set-e/and4.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false && false
|
||||
exit 0
|
3
tools/regression/bin/sh/set-e/background1.0
Normal file
3
tools/regression/bin/sh/set-e/background1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false &
|
3
tools/regression/bin/sh/set-e/cmd1.0
Normal file
3
tools/regression/bin/sh/set-e/cmd1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
true
|
4
tools/regression/bin/sh/set-e/cmd2.1
Normal file
4
tools/regression/bin/sh/set-e/cmd2.1
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false
|
||||
exit 0
|
5
tools/regression/bin/sh/set-e/elif1.0
Normal file
5
tools/regression/bin/sh/set-e/elif1.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
if false; then
|
||||
elif false; then
|
||||
fi
|
5
tools/regression/bin/sh/set-e/elif2.0
Normal file
5
tools/regression/bin/sh/set-e/elif2.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
if false; then
|
||||
elif false; false; then
|
||||
fi
|
4
tools/regression/bin/sh/set-e/if1.0
Normal file
4
tools/regression/bin/sh/set-e/if1.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
if false; then
|
||||
fi
|
7
tools/regression/bin/sh/set-e/if2.0
Normal file
7
tools/regression/bin/sh/set-e/if2.0
Normal file
@ -0,0 +1,7 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
# PR 28852
|
||||
if true; then
|
||||
false && true
|
||||
fi
|
||||
exit 0
|
4
tools/regression/bin/sh/set-e/if3.0
Normal file
4
tools/regression/bin/sh/set-e/if3.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
if false; false then
|
||||
fi
|
4
tools/regression/bin/sh/set-e/not1.0
Normal file
4
tools/regression/bin/sh/set-e/not1.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
! true
|
||||
exit 0
|
3
tools/regression/bin/sh/set-e/not2.0
Normal file
3
tools/regression/bin/sh/set-e/not2.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
! false
|
3
tools/regression/bin/sh/set-e/or1.0
Normal file
3
tools/regression/bin/sh/set-e/or1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
true || false
|
3
tools/regression/bin/sh/set-e/or2.0
Normal file
3
tools/regression/bin/sh/set-e/or2.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false || true
|
4
tools/regression/bin/sh/set-e/or3.1
Normal file
4
tools/regression/bin/sh/set-e/or3.1
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false || false
|
||||
exit 0
|
4
tools/regression/bin/sh/set-e/pipe1.1
Normal file
4
tools/regression/bin/sh/set-e/pipe1.1
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
true | false
|
||||
exit 0
|
3
tools/regression/bin/sh/set-e/pipe2.0
Normal file
3
tools/regression/bin/sh/set-e/pipe2.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false | true
|
11
tools/regression/bin/sh/set-e/return1.0
Normal file
11
tools/regression/bin/sh/set-e/return1.0
Normal file
@ -0,0 +1,11 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
|
||||
# PR 85267
|
||||
f() {
|
||||
false || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
f || true
|
||||
exit 0
|
4
tools/regression/bin/sh/set-e/semi1.1
Normal file
4
tools/regression/bin/sh/set-e/semi1.1
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
false; true
|
||||
exit 0
|
4
tools/regression/bin/sh/set-e/semi2.1
Normal file
4
tools/regression/bin/sh/set-e/semi2.1
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
true; false
|
||||
exit 0
|
3
tools/regression/bin/sh/set-e/subshell1.0
Normal file
3
tools/regression/bin/sh/set-e/subshell1.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
(true)
|
4
tools/regression/bin/sh/set-e/subshell2.1
Normal file
4
tools/regression/bin/sh/set-e/subshell2.1
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
(false)
|
||||
exit 0
|
5
tools/regression/bin/sh/set-e/until1.0
Normal file
5
tools/regression/bin/sh/set-e/until1.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
until false; do
|
||||
break
|
||||
done
|
5
tools/regression/bin/sh/set-e/until2.0
Normal file
5
tools/regression/bin/sh/set-e/until2.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
until false; false; do
|
||||
break
|
||||
done
|
4
tools/regression/bin/sh/set-e/while1.0
Normal file
4
tools/regression/bin/sh/set-e/while1.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
while false; do
|
||||
done
|
4
tools/regression/bin/sh/set-e/while2.0
Normal file
4
tools/regression/bin/sh/set-e/while2.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
set -e
|
||||
while false; false; do
|
||||
done
|
Loading…
Reference in New Issue
Block a user