From e594c724ee7e8109c69f1dffc42ed0fcce81a7fc Mon Sep 17 00:00:00 2001 From: Stefan Farfeleder Date: Mon, 5 Sep 2005 09:42:10 +0000 Subject: [PATCH] - Add tests for hash and return and more tests for set -e. - Simplify regress.sh, sort tests. --- tools/regression/bin/sh/builtins/hash1.0 | 5 +++++ tools/regression/bin/sh/builtins/hash1.0.stdout | 1 + tools/regression/bin/sh/builtins/hash2.0 | 4 ++++ tools/regression/bin/sh/builtins/hash2.0.stdout | 1 + tools/regression/bin/sh/builtins/hash3.0 | 3 +++ tools/regression/bin/sh/builtins/hash3.0.stdout | 2 ++ tools/regression/bin/sh/builtins/return1.0 | 7 +++++++ tools/regression/bin/sh/builtins/return2.1 | 7 +++++++ tools/regression/bin/sh/builtins/return3.1 | 3 +++ tools/regression/bin/sh/regress.sh | 13 ++++--------- tools/regression/bin/sh/set-e/for1.0 | 9 +++++++++ tools/regression/bin/sh/set-e/func1.0 | 7 +++++++ tools/regression/bin/sh/set-e/func2.1 | 7 +++++++ tools/regression/bin/sh/set-e/until3.0 | 9 +++++++++ tools/regression/bin/sh/set-e/while3.0 | 9 +++++++++ 15 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 tools/regression/bin/sh/builtins/hash1.0 create mode 100644 tools/regression/bin/sh/builtins/hash1.0.stdout create mode 100644 tools/regression/bin/sh/builtins/hash2.0 create mode 100644 tools/regression/bin/sh/builtins/hash2.0.stdout create mode 100644 tools/regression/bin/sh/builtins/hash3.0 create mode 100644 tools/regression/bin/sh/builtins/hash3.0.stdout create mode 100644 tools/regression/bin/sh/builtins/return1.0 create mode 100644 tools/regression/bin/sh/builtins/return2.1 create mode 100644 tools/regression/bin/sh/builtins/return3.1 create mode 100644 tools/regression/bin/sh/set-e/for1.0 create mode 100644 tools/regression/bin/sh/set-e/func1.0 create mode 100644 tools/regression/bin/sh/set-e/func2.1 create mode 100644 tools/regression/bin/sh/set-e/until3.0 create mode 100644 tools/regression/bin/sh/set-e/while3.0 diff --git a/tools/regression/bin/sh/builtins/hash1.0 b/tools/regression/bin/sh/builtins/hash1.0 new file mode 100644 index 00000000000..45cc3003fb5 --- /dev/null +++ b/tools/regression/bin/sh/builtins/hash1.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ +cat /dev/null +hash +hash -r +hash diff --git a/tools/regression/bin/sh/builtins/hash1.0.stdout b/tools/regression/bin/sh/builtins/hash1.0.stdout new file mode 100644 index 00000000000..3afc3e7b383 --- /dev/null +++ b/tools/regression/bin/sh/builtins/hash1.0.stdout @@ -0,0 +1 @@ +/bin/cat diff --git a/tools/regression/bin/sh/builtins/hash2.0 b/tools/regression/bin/sh/builtins/hash2.0 new file mode 100644 index 00000000000..e5cd21bc57d --- /dev/null +++ b/tools/regression/bin/sh/builtins/hash2.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ +hash +hash cat +hash diff --git a/tools/regression/bin/sh/builtins/hash2.0.stdout b/tools/regression/bin/sh/builtins/hash2.0.stdout new file mode 100644 index 00000000000..3afc3e7b383 --- /dev/null +++ b/tools/regression/bin/sh/builtins/hash2.0.stdout @@ -0,0 +1 @@ +/bin/cat diff --git a/tools/regression/bin/sh/builtins/hash3.0 b/tools/regression/bin/sh/builtins/hash3.0 new file mode 100644 index 00000000000..eade0b31954 --- /dev/null +++ b/tools/regression/bin/sh/builtins/hash3.0 @@ -0,0 +1,3 @@ +# $FreeBSD$ +hash -v cat +hash diff --git a/tools/regression/bin/sh/builtins/hash3.0.stdout b/tools/regression/bin/sh/builtins/hash3.0.stdout new file mode 100644 index 00000000000..a34864cd6df --- /dev/null +++ b/tools/regression/bin/sh/builtins/hash3.0.stdout @@ -0,0 +1,2 @@ +/bin/cat +/bin/cat diff --git a/tools/regression/bin/sh/builtins/return1.0 b/tools/regression/bin/sh/builtins/return1.0 new file mode 100644 index 00000000000..787e892a769 --- /dev/null +++ b/tools/regression/bin/sh/builtins/return1.0 @@ -0,0 +1,7 @@ +# $FreeBSD$ +f() { + return 0 + exit 1 +} + +f diff --git a/tools/regression/bin/sh/builtins/return2.1 b/tools/regression/bin/sh/builtins/return2.1 new file mode 100644 index 00000000000..0ef817179d7 --- /dev/null +++ b/tools/regression/bin/sh/builtins/return2.1 @@ -0,0 +1,7 @@ +# $FreeBSD$ +f() { + true && return 1 + return 0 +} + +f diff --git a/tools/regression/bin/sh/builtins/return3.1 b/tools/regression/bin/sh/builtins/return3.1 new file mode 100644 index 00000000000..605ec680d66 --- /dev/null +++ b/tools/regression/bin/sh/builtins/return3.1 @@ -0,0 +1,3 @@ +# $FreeBSD$ +return 1 +exit 0 diff --git a/tools/regression/bin/sh/regress.sh b/tools/regression/bin/sh/regress.sh index 0e098d0d3d1..e2767d7cb11 100644 --- a/tools/regression/bin/sh/regress.sh +++ b/tools/regression/bin/sh/regress.sh @@ -1,6 +1,6 @@ # $FreeBSD$ -echo '1..31' +echo '1..42' COUNTER=1 @@ -31,12 +31,7 @@ do_test() { 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 +TESTS=$(find -s . -name "*.[01]") +for i in ${TESTS} ; do + do_test ${i} ${i##*.} done diff --git a/tools/regression/bin/sh/set-e/for1.0 b/tools/regression/bin/sh/set-e/for1.0 new file mode 100644 index 00000000000..67eb718ee61 --- /dev/null +++ b/tools/regression/bin/sh/set-e/for1.0 @@ -0,0 +1,9 @@ +# $FreeBSD$ +set -e +f() { + for i in a b c; do + false + true + done +} +f || true diff --git a/tools/regression/bin/sh/set-e/func1.0 b/tools/regression/bin/sh/set-e/func1.0 new file mode 100644 index 00000000000..3c6b70492fa --- /dev/null +++ b/tools/regression/bin/sh/set-e/func1.0 @@ -0,0 +1,7 @@ +# $FreeBSD$ +set -e +f() { + false + true +} +f || true diff --git a/tools/regression/bin/sh/set-e/func2.1 b/tools/regression/bin/sh/set-e/func2.1 new file mode 100644 index 00000000000..cc76d6edfa5 --- /dev/null +++ b/tools/regression/bin/sh/set-e/func2.1 @@ -0,0 +1,7 @@ +# $FreeBSD$ +set -e +f() { + false + exit 0 +} +f diff --git a/tools/regression/bin/sh/set-e/until3.0 b/tools/regression/bin/sh/set-e/until3.0 new file mode 100644 index 00000000000..597db593bda --- /dev/null +++ b/tools/regression/bin/sh/set-e/until3.0 @@ -0,0 +1,9 @@ +# $FreeBSD$ +set -e +f() { + until false; do + false + break + done +} +f || true diff --git a/tools/regression/bin/sh/set-e/while3.0 b/tools/regression/bin/sh/set-e/while3.0 new file mode 100644 index 00000000000..dd3c7902523 --- /dev/null +++ b/tools/regression/bin/sh/set-e/while3.0 @@ -0,0 +1,9 @@ +# $FreeBSD$ +set -e +f() { + while true; do + false + break + done +} +f || true