diff options
author | June McEnroe <june@causal.agency> | 2019-01-10 20:19:51 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-01-10 20:19:51 -0500 |
commit | fb2b96be043fdba3ab70f256cad339b848b8c30f (patch) | |
tree | 8f5147243cfcebc7fdc1a616aeadd88e9bfe207b /bin/cash/tests/builtins | |
parent | Remove funcs (diff) | |
download | src-fb2b96be043fdba3ab70f256cad339b848b8c30f.tar.gz src-fb2b96be043fdba3ab70f256cad339b848b8c30f.zip |
Remove cash/tests
Diffstat (limited to 'bin/cash/tests/builtins')
192 files changed, 0 insertions, 2839 deletions
diff --git a/bin/cash/tests/builtins/Makefile b/bin/cash/tests/builtins/Makefile deleted file mode 100644 index a2749595..00000000 --- a/bin/cash/tests/builtins/Makefile +++ /dev/null @@ -1,187 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/Makefile 336320 2018-07-15 21:55:17Z jilles $ - -PACKAGE= tests - -.include <src.opts.mk> - -TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T} - -.PATH: ${.CURDIR:H} -ATF_TESTS_SH= functional_test - -${PACKAGE}FILES+= alias.0 alias.0.stdout -${PACKAGE}FILES+= alias.1 alias.1.stderr -${PACKAGE}FILES+= alias3.0 alias3.0.stdout -${PACKAGE}FILES+= alias4.0 -${PACKAGE}FILES+= break1.0 -${PACKAGE}FILES+= break2.0 break2.0.stdout -${PACKAGE}FILES+= break3.0 -${PACKAGE}FILES+= break4.4 -${PACKAGE}FILES+= break5.4 -${PACKAGE}FILES+= break6.0 -${PACKAGE}FILES+= builtin1.0 -${PACKAGE}FILES+= case1.0 -${PACKAGE}FILES+= case2.0 -${PACKAGE}FILES+= case3.0 -${PACKAGE}FILES+= case4.0 -${PACKAGE}FILES+= case5.0 -${PACKAGE}FILES+= case6.0 -${PACKAGE}FILES+= case7.0 -${PACKAGE}FILES+= case8.0 -${PACKAGE}FILES+= case9.0 -${PACKAGE}FILES+= case10.0 -${PACKAGE}FILES+= case11.0 -${PACKAGE}FILES+= case12.0 -${PACKAGE}FILES+= case13.0 -${PACKAGE}FILES+= case14.0 -${PACKAGE}FILES+= case15.0 -${PACKAGE}FILES+= case16.0 -${PACKAGE}FILES+= case17.0 -${PACKAGE}FILES+= case18.0 -${PACKAGE}FILES+= case19.0 -${PACKAGE}FILES+= case20.0 -${PACKAGE}FILES+= case21.0 -${PACKAGE}FILES+= case22.0 -${PACKAGE}FILES+= case23.0 -${PACKAGE}FILES+= cd1.0 -${PACKAGE}FILES+= cd2.0 -${PACKAGE}FILES+= cd3.0 -${PACKAGE}FILES+= cd4.0 -${PACKAGE}FILES+= cd5.0 -${PACKAGE}FILES+= cd6.0 -${PACKAGE}FILES+= cd7.0 -${PACKAGE}FILES+= cd8.0 -${PACKAGE}FILES+= cd9.0 cd9.0.stdout -${PACKAGE}FILES+= cd10.0 -${PACKAGE}FILES+= cd11.0 -${PACKAGE}FILES+= command1.0 -${PACKAGE}FILES+= command2.0 -${PACKAGE}FILES+= command3.0 -${PACKAGE}FILES+= command3.0.stdout -${PACKAGE}FILES+= command4.0 -${PACKAGE}FILES+= command5.0 -${PACKAGE}FILES+= command5.0.stdout -${PACKAGE}FILES+= command6.0 -${PACKAGE}FILES+= command6.0.stdout -${PACKAGE}FILES+= command7.0 -${PACKAGE}FILES+= command8.0 -${PACKAGE}FILES+= command9.0 -${PACKAGE}FILES+= command10.0 -${PACKAGE}FILES+= command11.0 -${PACKAGE}FILES+= command12.0 -${PACKAGE}FILES+= dot1.0 -${PACKAGE}FILES+= dot2.0 -${PACKAGE}FILES+= dot3.0 -${PACKAGE}FILES+= dot4.0 -${PACKAGE}FILES+= echo1.0 -${PACKAGE}FILES+= echo2.0 -${PACKAGE}FILES+= echo3.0 -${PACKAGE}FILES+= eval1.0 -${PACKAGE}FILES+= eval2.0 -${PACKAGE}FILES+= eval3.0 -${PACKAGE}FILES+= eval4.0 -${PACKAGE}FILES+= eval5.0 -${PACKAGE}FILES+= eval6.0 -${PACKAGE}FILES+= eval7.0 -${PACKAGE}FILES+= eval8.7 -${PACKAGE}FILES+= exec1.0 -${PACKAGE}FILES+= exec2.0 -${PACKAGE}FILES+= exit1.0 -${PACKAGE}FILES+= exit2.8 -${PACKAGE}FILES+= exit3.0 -${PACKAGE}FILES+= export1.0 -${PACKAGE}FILES+= fc1.0 -${PACKAGE}FILES+= fc2.0 -${PACKAGE}FILES+= for1.0 -${PACKAGE}FILES+= for2.0 -${PACKAGE}FILES+= for3.0 -${PACKAGE}FILES+= getopts1.0 getopts1.0.stdout -${PACKAGE}FILES+= getopts2.0 getopts2.0.stdout -${PACKAGE}FILES+= getopts3.0 -${PACKAGE}FILES+= getopts4.0 -${PACKAGE}FILES+= getopts5.0 -${PACKAGE}FILES+= getopts6.0 -${PACKAGE}FILES+= getopts7.0 -${PACKAGE}FILES+= getopts8.0 getopts8.0.stdout -${PACKAGE}FILES+= getopts9.0 getopts9.0.stdout -${PACKAGE}FILES+= getopts10.0 -${PACKAGE}FILES+= hash1.0 hash1.0.stdout -${PACKAGE}FILES+= hash2.0 hash2.0.stdout -${PACKAGE}FILES+= hash3.0 hash3.0.stdout -${PACKAGE}FILES+= hash4.0 -${PACKAGE}FILES+= jobid1.0 -${PACKAGE}FILES+= jobid2.0 -${PACKAGE}FILES+= kill1.0 kill2.0 -${PACKAGE}FILES+= lineno.0 lineno.0.stdout -${PACKAGE}FILES+= lineno2.0 -${PACKAGE}FILES+= lineno3.0 lineno3.0.stdout -${PACKAGE}FILES+= local1.0 -${PACKAGE}FILES+= local2.0 -${PACKAGE}FILES+= local3.0 -${PACKAGE}FILES+= local4.0 -${PACKAGE}FILES+= local5.0 -${PACKAGE}FILES+= local6.0 -${PACKAGE}FILES+= local7.0 -.if ${MK_NLS} != "no" -${PACKAGE}FILES+= locale1.0 -.endif -${PACKAGE}FILES+= locale2.0 -${PACKAGE}FILES+= printf1.0 -${PACKAGE}FILES+= printf2.0 -${PACKAGE}FILES+= printf3.0 -${PACKAGE}FILES+= printf4.0 -${PACKAGE}FILES+= read1.0 read1.0.stdout -${PACKAGE}FILES+= read2.0 -${PACKAGE}FILES+= read3.0 read3.0.stdout -${PACKAGE}FILES+= read4.0 read4.0.stdout -${PACKAGE}FILES+= read5.0 -${PACKAGE}FILES+= read6.0 -${PACKAGE}FILES+= read7.0 -${PACKAGE}FILES+= read8.0 -${PACKAGE}FILES+= read9.0 -${PACKAGE}FILES+= return1.0 -${PACKAGE}FILES+= return2.1 -${PACKAGE}FILES+= return3.1 -${PACKAGE}FILES+= return4.0 -${PACKAGE}FILES+= return5.0 -${PACKAGE}FILES+= return6.4 -${PACKAGE}FILES+= return7.4 -${PACKAGE}FILES+= return8.0 -${PACKAGE}FILES+= set1.0 -${PACKAGE}FILES+= set2.0 -${PACKAGE}FILES+= set3.0 -${PACKAGE}FILES+= trap1.0 -${PACKAGE}FILES+= trap10.0 -${PACKAGE}FILES+= trap11.0 -${PACKAGE}FILES+= trap12.0 -${PACKAGE}FILES+= trap13.0 -${PACKAGE}FILES+= trap14.0 -${PACKAGE}FILES+= trap15.0 -${PACKAGE}FILES+= trap16.0 -${PACKAGE}FILES+= trap17.0 -${PACKAGE}FILES+= trap2.0 -${PACKAGE}FILES+= trap3.0 -${PACKAGE}FILES+= trap4.0 -${PACKAGE}FILES+= trap5.0 -${PACKAGE}FILES+= trap6.0 -${PACKAGE}FILES+= trap7.0 -${PACKAGE}FILES+= trap8.0 -${PACKAGE}FILES+= trap9.0 -${PACKAGE}FILES+= type1.0 type1.0.stderr -${PACKAGE}FILES+= type2.0 -${PACKAGE}FILES+= type3.0 -${PACKAGE}FILES+= unalias.0 -${PACKAGE}FILES+= var-assign.0 -${PACKAGE}FILES+= var-assign2.0 -${PACKAGE}FILES+= wait1.0 -${PACKAGE}FILES+= wait2.0 -${PACKAGE}FILES+= wait3.0 -${PACKAGE}FILES+= wait4.0 -${PACKAGE}FILES+= wait5.0 -${PACKAGE}FILES+= wait6.0 -${PACKAGE}FILES+= wait7.0 -${PACKAGE}FILES+= wait8.0 -${PACKAGE}FILES+= wait9.127 -${PACKAGE}FILES+= wait10.0 - -.include <bsd.test.mk> diff --git a/bin/cash/tests/builtins/alias.0 b/bin/cash/tests/builtins/alias.0 deleted file mode 100644 index 7a4864fe..00000000 --- a/bin/cash/tests/builtins/alias.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/alias.0 190285 2009-03-22 21:12:00Z stefanf $ -set -e - -unalias -a -alias foo=bar -alias bar= -alias quux="1 2 3" -alias -alias foo diff --git a/bin/cash/tests/builtins/alias.0.stdout b/bin/cash/tests/builtins/alias.0.stdout deleted file mode 100644 index 52efaf0b..00000000 --- a/bin/cash/tests/builtins/alias.0.stdout +++ /dev/null @@ -1,4 +0,0 @@ -bar='' -foo=bar -quux='1 2 3' -foo=bar diff --git a/bin/cash/tests/builtins/alias.1 b/bin/cash/tests/builtins/alias.1 deleted file mode 100644 index 176ce71e..00000000 --- a/bin/cash/tests/builtins/alias.1 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/alias.1 149781 2005-09-04 11:59:59Z stefanf $ -unalias -a -alias foo diff --git a/bin/cash/tests/builtins/alias.1.stderr b/bin/cash/tests/builtins/alias.1.stderr deleted file mode 100644 index c9f4011b..00000000 --- a/bin/cash/tests/builtins/alias.1.stderr +++ /dev/null @@ -1 +0,0 @@ -alias: foo: not found diff --git a/bin/cash/tests/builtins/alias3.0 b/bin/cash/tests/builtins/alias3.0 deleted file mode 100644 index 3185e37e..00000000 --- a/bin/cash/tests/builtins/alias3.0 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/alias3.0 242767 2012-11-08 13:36:19Z jilles $ -set -e - -unalias -a -alias foo=bar -alias bar= -alias quux="1 2 3" -alias foo=bar -alias bar= -alias quux="1 2 3" -alias -alias foo diff --git a/bin/cash/tests/builtins/alias3.0.stdout b/bin/cash/tests/builtins/alias3.0.stdout deleted file mode 100644 index 52efaf0b..00000000 --- a/bin/cash/tests/builtins/alias3.0.stdout +++ /dev/null @@ -1,4 +0,0 @@ -bar='' -foo=bar -quux='1 2 3' -foo=bar diff --git a/bin/cash/tests/builtins/alias4.0 b/bin/cash/tests/builtins/alias4.0 deleted file mode 100644 index b445c1b1..00000000 --- a/bin/cash/tests/builtins/alias4.0 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/alias4.0 254849 2013-08-25 11:42:53Z jilles $ - -unalias -a -alias -- diff --git a/bin/cash/tests/builtins/break1.0 b/bin/cash/tests/builtins/break1.0 deleted file mode 100644 index 2d52d18a..00000000 --- a/bin/cash/tests/builtins/break1.0 +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/break1.0 211349 2010-08-15 21:06:53Z jilles $ - -if [ "$1" != nested ]; then - while :; do - set -- nested - . "$0" - echo bad2 - exit 2 - done - exit 0 -fi -# To trigger the bug, the following commands must be at the top level, -# with newlines in between. -break -echo bad1 -exit 1 diff --git a/bin/cash/tests/builtins/break2.0 b/bin/cash/tests/builtins/break2.0 deleted file mode 100644 index 1ae7c91e..00000000 --- a/bin/cash/tests/builtins/break2.0 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/break2.0 211467 2010-08-18 20:26:50Z jilles $ - -# It is not immediately obvious that this should work, and someone probably -# relies on it. - -while :; do - trap 'break' USR1 - kill -USR1 $$ - echo bad - exit 1 -done -echo good diff --git a/bin/cash/tests/builtins/break2.0.stdout b/bin/cash/tests/builtins/break2.0.stdout deleted file mode 100644 index 12799ccb..00000000 --- a/bin/cash/tests/builtins/break2.0.stdout +++ /dev/null @@ -1 +0,0 @@ -good diff --git a/bin/cash/tests/builtins/break3.0 b/bin/cash/tests/builtins/break3.0 deleted file mode 100644 index 8a239be6..00000000 --- a/bin/cash/tests/builtins/break3.0 +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/break3.0 211612 2010-08-22 11:07:46Z jilles $ - -# We accept this and people might rely on it. -# However, various other shells do not accept it. - -f() { - break - echo bad1 -} - -while :; do - f - echo bad2 - exit 2 -done diff --git a/bin/cash/tests/builtins/break4.4 b/bin/cash/tests/builtins/break4.4 deleted file mode 100644 index cfd3449d..00000000 --- a/bin/cash/tests/builtins/break4.4 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/break4.4 251180 2013-05-31 14:45:25Z jilles $ - -# Although this is not specified by POSIX, some configure scripts (gawk 4.1.0) -# appear to depend on it. - -break -exit 4 diff --git a/bin/cash/tests/builtins/break5.4 b/bin/cash/tests/builtins/break5.4 deleted file mode 100644 index b1e3b8e1..00000000 --- a/bin/cash/tests/builtins/break5.4 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/break5.4 251180 2013-05-31 14:45:25Z jilles $ - -# Although this is not specified by POSIX, some configure scripts (gawk 4.1.0) -# appear to depend on it. -# In some uncommitted code, the subshell environment corrupted the outer -# shell environment's state. - -(for i in a b c; do - exit 3 -done) -break -exit 4 diff --git a/bin/cash/tests/builtins/break6.0 b/bin/cash/tests/builtins/break6.0 deleted file mode 100644 index a803aaff..00000000 --- a/bin/cash/tests/builtins/break6.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/break6.0 268927 2014-07-20 20:29:09Z jilles $ -# Per POSIX, this need only work if LONG_MAX > 4294967295. - -while :; do - break 4294967296 - echo bad - exit 3 -done diff --git a/bin/cash/tests/builtins/builtin1.0 b/bin/cash/tests/builtins/builtin1.0 deleted file mode 100644 index 3f419c2e..00000000 --- a/bin/cash/tests/builtins/builtin1.0 +++ /dev/null @@ -1,31 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/builtin1.0 201431 2010-01-03 15:01:38Z jilles $ - -failures=0 - -check() { - if ! eval "[ $* ]"; then - echo "Failed: $*" - : $((failures += 1)) - fi -} - -builtin : || echo "Bad return code at $LINENO" -builtin true || echo "Bad return code at $LINENO" -builtin ls 2>/dev/null && echo "Bad return code at $LINENO" -check '"$(builtin pwd)" = "$(pwd)"' -check '-z "$(builtin :)"' -check '-z "$(builtin true)"' -check '-z "$( (builtin nosuchtool) 2>/dev/null)"' -check '-z "$(builtin nosuchtool 2>/dev/null)"' -check '-z "$(builtin nosuchtool 2>/dev/null; :)"' -check '-z "$( (builtin ls) 2>/dev/null)"' -check '-z "$(builtin ls 2>/dev/null)"' -check '-z "$(builtin ls 2>/dev/null; :)"' -check '-n "$( (builtin nosuchtool) 2>&1)"' -check '-n "$(builtin nosuchtool 2>&1)"' -check '-n "$(builtin nosuchtool 2>&1; :)"' -check '-n "$( (builtin ls) 2>&1)"' -check '-n "$(builtin ls 2>&1)"' -check '-n "$(builtin ls 2>&1; :)"' - -exit $((failures > 0)) diff --git a/bin/cash/tests/builtins/case1.0 b/bin/cash/tests/builtins/case1.0 deleted file mode 100644 index 6c050c62..00000000 --- a/bin/cash/tests/builtins/case1.0 +++ /dev/null @@ -1,13 +0,0 @@ -#$FreeBSD: releng/12.0/bin/sh/tests/builtins/case1.0 172440 2007-10-04 16:14:48Z stefanf $ -f() -{ - false - case $1 in - foo) true ;; - bar) false ;; - esac -} - -f foo || exit 1 -f bar && exit 1 -f quux || exit 1 diff --git a/bin/cash/tests/builtins/case10.0 b/bin/cash/tests/builtins/case10.0 deleted file mode 100644 index e53576e4..00000000 --- a/bin/cash/tests/builtins/case10.0 +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case10.0 223546 2011-06-25 20:37:43Z jilles $ - -case ! in -[\!!]) ;; -*) echo Failed at $LINENO ;; -esac - -case ! in -['!'!]) ;; -*) echo Failed at $LINENO ;; -esac - -case ! in -["!"!]) ;; -*) echo Failed at $LINENO ;; -esac diff --git a/bin/cash/tests/builtins/case11.0 b/bin/cash/tests/builtins/case11.0 deleted file mode 100644 index 01c0080a..00000000 --- a/bin/cash/tests/builtins/case11.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case11.0 228007 2011-11-26 22:28:25Z jilles $ - -false -case x in -*) -esac diff --git a/bin/cash/tests/builtins/case12.0 b/bin/cash/tests/builtins/case12.0 deleted file mode 100644 index 2d96c740..00000000 --- a/bin/cash/tests/builtins/case12.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case12.0 228007 2011-11-26 22:28:25Z jilles $ - -false -case x in -y) -esac diff --git a/bin/cash/tests/builtins/case13.0 b/bin/cash/tests/builtins/case13.0 deleted file mode 100644 index 37a8ffbe..00000000 --- a/bin/cash/tests/builtins/case13.0 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case13.0 228943 2011-12-28 23:51:17Z jilles $ - -case ^ in -[\^^]) ;; -*) echo Failed at $LINENO ;; -esac - -case s in -[\^^]) echo Failed at $LINENO ;; -[s\]]) ;; -*) echo Failed at $LINENO ;; -esac diff --git a/bin/cash/tests/builtins/case14.0 b/bin/cash/tests/builtins/case14.0 deleted file mode 100644 index 49387625..00000000 --- a/bin/cash/tests/builtins/case14.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case14.0 230154 2012-01-15 20:04:05Z jilles $ - -case `false` in -no) exit 3 ;; -esac diff --git a/bin/cash/tests/builtins/case15.0 b/bin/cash/tests/builtins/case15.0 deleted file mode 100644 index 6ca773ff..00000000 --- a/bin/cash/tests/builtins/case15.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case15.0 230154 2012-01-15 20:04:05Z jilles $ - -case x in -`false`) exit 3 ;; -esac diff --git a/bin/cash/tests/builtins/case16.0 b/bin/cash/tests/builtins/case16.0 deleted file mode 100644 index e6431cc4..00000000 --- a/bin/cash/tests/builtins/case16.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case16.0 230154 2012-01-15 20:04:05Z jilles $ - -f() { return 42; } -f -case x in -x) [ $? = 42 ] ;; -esac diff --git a/bin/cash/tests/builtins/case17.0 b/bin/cash/tests/builtins/case17.0 deleted file mode 100644 index be0827c6..00000000 --- a/bin/cash/tests/builtins/case17.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case17.0 230161 2012-01-15 21:39:38Z jilles $ - -! case x in x) false ;& y) esac diff --git a/bin/cash/tests/builtins/case18.0 b/bin/cash/tests/builtins/case18.0 deleted file mode 100644 index 590fe8d9..00000000 --- a/bin/cash/tests/builtins/case18.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case18.0 230161 2012-01-15 21:39:38Z jilles $ - -case x$(false) in -x) ;& -y) [ $? != 0 ] ;; -z) false ;; -esac diff --git a/bin/cash/tests/builtins/case19.0 b/bin/cash/tests/builtins/case19.0 deleted file mode 100644 index f3496369..00000000 --- a/bin/cash/tests/builtins/case19.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case19.0 230161 2012-01-15 21:39:38Z jilles $ - -[ "`case x in -x) false ;& -y) ;& -z) echo $? ;; -esac`" != 0 ] diff --git a/bin/cash/tests/builtins/case2.0 b/bin/cash/tests/builtins/case2.0 deleted file mode 100644 index cc737f42..00000000 --- a/bin/cash/tests/builtins/case2.0 +++ /dev/null @@ -1,106 +0,0 @@ -# Generated by ./test-fnmatch -s 1, do not edit. -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case2.0 207821 2010-05-09 16:15:40Z jilles $ -failures= -failed() { printf '%s\n' "Failed: $1 '$2' '$3'"; failures=x$failures; } -testmatch() { eval "case \$2 in ''$1) ;; *) failed testmatch \"\$@\";; esac"; } -testnomatch() { eval "case \$2 in ''$1) failed testnomatch \"\$@\";; esac"; } -testmatch '' '' -testmatch 'a' 'a' -testnomatch 'a' 'b' -testnomatch 'a' 'A' -testmatch '*' 'a' -testmatch '*' 'aa' -testmatch '*a' 'a' -testnomatch '*a' 'b' -testnomatch '*a*' 'b' -testmatch '*a*b*' 'ab' -testmatch '*a*b*' 'qaqbq' -testmatch '*a*bb*' 'qaqbqbbq' -testmatch '*a*bc*' 'qaqbqbcq' -testmatch '*a*bb*' 'qaqbqbb' -testmatch '*a*bc*' 'qaqbqbc' -testmatch '*a*bb' 'qaqbqbb' -testmatch '*a*bc' 'qaqbqbc' -testnomatch '*a*bb' 'qaqbqbbq' -testnomatch '*a*bc' 'qaqbqbcq' -testnomatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaa' -testmatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaaa' -testmatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaaaa' -testnomatch '.*.*.*.*.*.*.*.*.*.*' '.........' -testmatch '.*.*.*.*.*.*.*.*.*.*' '..........' -testmatch '.*.*.*.*.*.*.*.*.*.*' '...........' -testnomatch '*?*?*?*?*?*?*?*?*?*?*' '123456789' -testnomatch '??????????*' '123456789' -testnomatch '*??????????' '123456789' -testmatch '*?*?*?*?*?*?*?*?*?*?*' '1234567890' -testmatch '??????????*' '1234567890' -testmatch '*??????????' '1234567890' -testmatch '*?*?*?*?*?*?*?*?*?*?*' '12345678901' -testmatch '??????????*' '12345678901' -testmatch '*??????????' '12345678901' -testmatch '[x]' 'x' -testmatch '[*]' '*' -testmatch '[?]' '?' -testmatch '[' '[' -testmatch '[[]' '[' -testnomatch '[[]' 'x' -testnomatch '[*]' '' -testnomatch '[*]' 'x' -testnomatch '[?]' 'x' -testmatch '*[*]*' 'foo*foo' -testnomatch '*[*]*' 'foo' -testmatch '[0-9]' '0' -testmatch '[0-9]' '5' -testmatch '[0-9]' '9' -testnomatch '[0-9]' '/' -testnomatch '[0-9]' ':' -testnomatch '[0-9]' '*' -testnomatch '[!0-9]' '0' -testnomatch '[!0-9]' '5' -testnomatch '[!0-9]' '9' -testmatch '[!0-9]' '/' -testmatch '[!0-9]' ':' -testmatch '[!0-9]' '*' -testmatch '*[0-9]' 'a0' -testmatch '*[0-9]' 'a5' -testmatch '*[0-9]' 'a9' -testnomatch '*[0-9]' 'a/' -testnomatch '*[0-9]' 'a:' -testnomatch '*[0-9]' 'a*' -testnomatch '*[!0-9]' 'a0' -testnomatch '*[!0-9]' 'a5' -testnomatch '*[!0-9]' 'a9' -testmatch '*[!0-9]' 'a/' -testmatch '*[!0-9]' 'a:' -testmatch '*[!0-9]' 'a*' -testmatch '*[0-9]' 'a00' -testmatch '*[0-9]' 'a55' -testmatch '*[0-9]' 'a99' -testmatch '*[0-9]' 'a0a0' -testmatch '*[0-9]' 'a5a5' -testmatch '*[0-9]' 'a9a9' -testmatch '\*' '*' -testmatch '\?' '?' -testmatch '\[x]' '[x]' -testmatch '\[' '[' -testmatch '\\' '\' -testmatch '*\**' 'foo*foo' -testnomatch '*\**' 'foo' -testmatch '*\\*' 'foo\foo' -testnomatch '*\\*' 'foo' -testmatch '\(' '(' -testmatch '\a' 'a' -testnomatch '\*' 'a' -testnomatch '\?' 'a' -testnomatch '\*' '\*' -testnomatch '\?' '\?' -testnomatch '\[x]' '\[x]' -testnomatch '\[x]' '\x' -testnomatch '\[' '\[' -testnomatch '\(' '\(' -testnomatch '\a' '\a' -testmatch '.*' '.' -testmatch '.*' '..' -testmatch '.*' '.a' -testmatch 'a*' 'a.' -[ -z "$failures" ] diff --git a/bin/cash/tests/builtins/case20.0 b/bin/cash/tests/builtins/case20.0 deleted file mode 100644 index 32f46bc1..00000000 --- a/bin/cash/tests/builtins/case20.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case20.0 287148 2015-08-25 21:55:15Z jilles $ - -# Shells do not agree about what this pattern should match, but it is -# certain that it must not crash and the missing close bracket must not -# be simply ignored. - -case B in -[[:alpha:]) echo bad ;; -esac diff --git a/bin/cash/tests/builtins/case21.0 b/bin/cash/tests/builtins/case21.0 deleted file mode 100644 index ec8089f0..00000000 --- a/bin/cash/tests/builtins/case21.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case21.0 318258 2017-05-13 20:28:32Z jilles $ - -case 5 in -[0$((-9))]) ;; -*) echo bad1 ;; -esac - -case - in -[0$((-9))]) echo bad2 ;; -esac diff --git a/bin/cash/tests/builtins/case22.0 b/bin/cash/tests/builtins/case22.0 deleted file mode 100644 index c80dc017..00000000 --- a/bin/cash/tests/builtins/case22.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case22.0 318269 2017-05-14 13:14:19Z jilles $ - -case 5 in -[0"$((-9))"]) echo bad1 ;; -esac - -case - in -[0"$((-9))"]) ;; -*) echo bad2 ;; -esac diff --git a/bin/cash/tests/builtins/case23.0 b/bin/cash/tests/builtins/case23.0 deleted file mode 100644 index c0f36562..00000000 --- a/bin/cash/tests/builtins/case23.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case23.0 333092 2018-04-29 17:46:08Z jilles $ - -case [ in -[[:alpha:]]) echo bad -esac diff --git a/bin/cash/tests/builtins/case3.0 b/bin/cash/tests/builtins/case3.0 deleted file mode 100644 index 4eb688fe..00000000 --- a/bin/cash/tests/builtins/case3.0 +++ /dev/null @@ -1,95 +0,0 @@ -# Generated by ./test-fnmatch -s 2, do not edit. -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case3.0 207821 2010-05-09 16:15:40Z jilles $ -failures= -failed() { printf '%s\n' "Failed: $1 '$2' '$3'"; failures=x$failures; } -# We do not treat a backslash specially in this case, -# but this is not the case in all shells. -netestmatch() { case $2 in $1) ;; *) failed netestmatch "$@";; esac; } -netestnomatch() { case $2 in $1) failed netestnomatch "$@";; esac; } -netestmatch '' '' -netestmatch 'a' 'a' -netestnomatch 'a' 'b' -netestnomatch 'a' 'A' -netestmatch '*' 'a' -netestmatch '*' 'aa' -netestmatch '*a' 'a' -netestnomatch '*a' 'b' -netestnomatch '*a*' 'b' -netestmatch '*a*b*' 'ab' -netestmatch '*a*b*' 'qaqbq' -netestmatch '*a*bb*' 'qaqbqbbq' -netestmatch '*a*bc*' 'qaqbqbcq' -netestmatch '*a*bb*' 'qaqbqbb' -netestmatch '*a*bc*' 'qaqbqbc' -netestmatch '*a*bb' 'qaqbqbb' -netestmatch '*a*bc' 'qaqbqbc' -netestnomatch '*a*bb' 'qaqbqbbq' -netestnomatch '*a*bc' 'qaqbqbcq' -netestnomatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaa' -netestmatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaaa' -netestmatch '*a*a*a*a*a*a*a*a*a*a*' 'aaaaaaaaaaa' -netestnomatch '.*.*.*.*.*.*.*.*.*.*' '.........' -netestmatch '.*.*.*.*.*.*.*.*.*.*' '..........' -netestmatch '.*.*.*.*.*.*.*.*.*.*' '...........' -netestnomatch '*?*?*?*?*?*?*?*?*?*?*' '123456789' -netestnomatch '??????????*' '123456789' -netestnomatch '*??????????' '123456789' -netestmatch '*?*?*?*?*?*?*?*?*?*?*' '1234567890' -netestmatch '??????????*' '1234567890' -netestmatch '*??????????' '1234567890' -netestmatch '*?*?*?*?*?*?*?*?*?*?*' '12345678901' -netestmatch '??????????*' '12345678901' -netestmatch '*??????????' '12345678901' -netestmatch '[x]' 'x' -netestmatch '[*]' '*' -netestmatch '[?]' '?' -netestmatch '[' '[' -netestmatch '[[]' '[' -netestnomatch '[[]' 'x' -netestnomatch '[*]' '' -netestnomatch '[*]' 'x' -netestnomatch '[?]' 'x' -netestmatch '*[*]*' 'foo*foo' -netestnomatch '*[*]*' 'foo' -netestmatch '[0-9]' '0' -netestmatch '[0-9]' '5' -netestmatch '[0-9]' '9' -netestnomatch '[0-9]' '/' -netestnomatch '[0-9]' ':' -netestnomatch '[0-9]' '*' -netestnomatch '[!0-9]' '0' -netestnomatch '[!0-9]' '5' -netestnomatch '[!0-9]' '9' -netestmatch '[!0-9]' '/' -netestmatch '[!0-9]' ':' -netestmatch '[!0-9]' '*' -netestmatch '*[0-9]' 'a0' -netestmatch '*[0-9]' 'a5' -netestmatch '*[0-9]' 'a9' -netestnomatch '*[0-9]' 'a/' -netestnomatch '*[0-9]' 'a:' -netestnomatch '*[0-9]' 'a*' -netestnomatch '*[!0-9]' 'a0' -netestnomatch '*[!0-9]' 'a5' -netestnomatch '*[!0-9]' 'a9' -netestmatch '*[!0-9]' 'a/' -netestmatch '*[!0-9]' 'a:' -netestmatch '*[!0-9]' 'a*' -netestmatch '*[0-9]' 'a00' -netestmatch '*[0-9]' 'a55' -netestmatch '*[0-9]' 'a99' -netestmatch '*[0-9]' 'a0a0' -netestmatch '*[0-9]' 'a5a5' -netestmatch '*[0-9]' 'a9a9' -netestmatch '\*' '\*' -netestmatch '\?' '\?' -netestmatch '\' '\' -netestnomatch '\\' '\' -netestmatch '\\' '\\' -netestmatch '*\*' 'foo\foo' -netestnomatch '*\*' 'foo' -netestmatch '.*' '.' -netestmatch '.*' '..' -netestmatch '.*' '.a' -netestmatch 'a*' 'a.' -[ -z "$failures" ] diff --git a/bin/cash/tests/builtins/case4.0 b/bin/cash/tests/builtins/case4.0 deleted file mode 100644 index c900630b..00000000 --- a/bin/cash/tests/builtins/case4.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case4.0 220654 2011-04-15 15:14:58Z jilles $ - -set -- "*" -case x in -"$1") echo failed ;; -esac diff --git a/bin/cash/tests/builtins/case5.0 b/bin/cash/tests/builtins/case5.0 deleted file mode 100644 index a1dce3d3..00000000 --- a/bin/cash/tests/builtins/case5.0 +++ /dev/null @@ -1,57 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case5.0 221646 2011-05-08 11:32:20Z jilles $ - -unset LC_ALL -LC_CTYPE=en_US.UTF-8 -export LC_CTYPE - -c1=e -# a umlaut -c2=$(printf '\303\244') -# euro sign -c3=$(printf '\342\202\254') -# some sort of 't' outside BMP -c4=$(printf '\360\235\225\245') - -ok=0 -case $c1$c2$c3$c4 in -*) ok=1 ;; -esac -if [ $ok = 0 ]; then - echo wrong at $LINENO - exit 3 -fi - -case $c1$c2$c3$c4 in -$c1$c2$c3$c4) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -"$c1$c2$c3$c4") ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -????) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1.$c2.$c3.$c4 in -?.?.?.?) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -[!a][!b][!c][!d]) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -[$c1][$c2][$c3][$c4]) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -["$c1"]["$c2"]["$c3"]["$c4"]) ;; -*) echo wrong at $LINENO ;; -esac diff --git a/bin/cash/tests/builtins/case6.0 b/bin/cash/tests/builtins/case6.0 deleted file mode 100644 index 38557bc1..00000000 --- a/bin/cash/tests/builtins/case6.0 +++ /dev/null @@ -1,52 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case6.0 223007 2011-06-12 12:27:17Z jilles $ - -unset LC_ALL -LC_CTYPE=de_DE.ISO8859-1 -export LC_CTYPE - -c1=e -# o umlaut -c2=$(printf '\366') -# non-break space -c3=$(printf '\240') -c4=$(printf '\240') -# $c2$c3$c4 form one utf-8 character - -ok=0 -case $c1$c2$c3$c4 in -*) ok=1 ;; -esac -if [ $ok = 0 ]; then - echo wrong at $LINENO - exit 3 -fi - -case $c1$c2$c3$c4 in -$c1$c2$c3$c4) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -"$c1$c2$c3$c4") ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -????) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -[!$c2][!b][!c][!d]) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -[$c1][$c2][$c3][$c4]) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2$c3$c4 in -["$c1"]["$c2"]["$c3"]["$c4"]) ;; -*) echo wrong at $LINENO ;; -esac diff --git a/bin/cash/tests/builtins/case7.0 b/bin/cash/tests/builtins/case7.0 deleted file mode 100644 index 35978e5c..00000000 --- a/bin/cash/tests/builtins/case7.0 +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case7.0 302829 2016-07-14 09:34:42Z ache $ - -# Character ranges in a locale other than the POSIX locale, not specified -# by POSIX. - -unset LC_ALL -LC_CTYPE=de_DE.ISO8859-1 -export LC_CTYPE -LC_COLLATE=de_DE.ISO8859-1 -export LC_COLLATE - -c1=e -# o umlaut -c2=$(printf '\366') - -case $c1$c2 in -[a-z][a-z]) ;; -*) echo wrong at $LINENO ;; -esac - -case $c1$c2 in -[a-f][n-p]) ;; -*) echo wrong at $LINENO ;; -esac diff --git a/bin/cash/tests/builtins/case8.0 b/bin/cash/tests/builtins/case8.0 deleted file mode 100644 index 22c31111..00000000 --- a/bin/cash/tests/builtins/case8.0 +++ /dev/null @@ -1,32 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case8.0 223120 2011-06-15 21:48:10Z jilles $ - -case aZ_ in -[[:alpha:]_][[:upper:]_][[:alpha:]_]) ;; -*) echo Failed at $LINENO ;; -esac - -case ' ' in -[[:alpha:][:digit:]]) echo Failed at $LINENO ;; -[![:alpha:][:digit:]]) ;; -*) echo Failed at $LINENO ;; -esac - -case '.X.' in -*[[:lower:]]*) echo Failed at $LINENO ;; -*[[:upper:]]*) ;; -*) echo Failed at $LINENO ;; -esac - -case ' ' in -[![:print:]]) echo Failed at $LINENO ;; -[![:alnum:][:punct:]]) ;; -*) echo Failed at $LINENO ;; -esac - -case ' -' in -[[:print:]]) echo Failed at $LINENO ;; -[' -'[:digit:]]) ;; -*) echo Failed at $LINENO ;; -esac diff --git a/bin/cash/tests/builtins/case9.0 b/bin/cash/tests/builtins/case9.0 deleted file mode 100644 index c7b05bd8..00000000 --- a/bin/cash/tests/builtins/case9.0 +++ /dev/null @@ -1,39 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/case9.0 223186 2011-06-17 13:03:49Z jilles $ - -errors=0 - -f() { - result= - case $1 in - a) result=${result}a ;; - b) result=${result}b ;& - c) result=${result}c ;& - d) result=${result}d ;; - e) result=${result}e ;& - esac -} - -check() { - f "$1" - if [ "$result" != "$2" ]; then - printf "For %s, expected %s got %s\n" "$1" "$2" "$result" - errors=$((errors + 1)) - fi -} - -check '' '' -check a a -check b bcd -check c cd -check d d -check e e - -if ! (case 1 in - 1) false ;& - 2) true ;; -esac) then - echo "Subshell bad" - errors=$((errors + 1)) -fi - -exit $((errors != 0)) diff --git a/bin/cash/tests/builtins/cd1.0 b/bin/cash/tests/builtins/cd1.0 deleted file mode 100644 index 82a7d105..00000000 --- a/bin/cash/tests/builtins/cd1.0 +++ /dev/null @@ -1,30 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd1.0 228975 2011-12-30 00:04:11Z uqs $ -set -e - -P=${TMPDIR:-/tmp} -cd $P -T=$(mktemp -d sh-test.XXXXXX) - -chmod 0 $T -if [ `id -u` -ne 0 ]; then - # Root can always cd, regardless of directory permissions. - cd -L $T 2>/dev/null && exit 1 - [ "$PWD" = "$P" ] - [ "$(pwd)" = "$P" ] - cd -P $T 2>/dev/null && exit 1 - [ "$PWD" = "$P" ] - [ "$(pwd)" = "$P" ] -fi - -chmod 755 $T -cd $T -mkdir -p 1/2/3 -ln -s 1/2 link1 -ln -s 2/3 1/link2 -(cd -L 1/../1 && [ "$(pwd -L)" = "$P/$T/1" ]) -(cd -L link1 && [ "$(pwd -L)" = "$P/$T/link1" ]) -(cd -L link1 && [ "$(pwd -P)" = "$P/$T/1/2" ]) -(cd -P link1 && [ "$(pwd -L)" = "$P/$T/1/2" ]) -(cd -P link1 && [ "$(pwd -P)" = "$P/$T/1/2" ]) - -rm -rf ${P}/${T} diff --git a/bin/cash/tests/builtins/cd10.0 b/bin/cash/tests/builtins/cd10.0 deleted file mode 100644 index b5008ca9..00000000 --- a/bin/cash/tests/builtins/cd10.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd10.0 320340 2017-06-25 21:53:08Z jilles $ - -# Precondition -(cd /bin) || exit -# Verify write error is ignored. -$SH +m -ic 'CDPATH=/:; cd bin 1</dev/null' diff --git a/bin/cash/tests/builtins/cd11.0 b/bin/cash/tests/builtins/cd11.0 deleted file mode 100644 index 191723a4..00000000 --- a/bin/cash/tests/builtins/cd11.0 +++ /dev/null @@ -1,24 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd11.0 336320 2018-07-15 21:55:17Z jilles $ - -set -e -T=$(mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXX") -trap 'rm -rf "$T"' 0 - -mkdir "$T/%?^&*" -cd -P "$T/%?^&*" -D=$(pwd) - -mkdir a a/1 b b/1 b/2 - -CDPATH=$D/a: -# Basic test. -cd 1 >/dev/null -[ "$(pwd)" = "$D/a/1" ] -# Test that the current directory is not checked before CDPATH. -cd "$D/b" -cd 1 >/dev/null -[ "$(pwd)" = "$D/a/1" ] -# Test not using a CDPATH entry. -cd "$D/b" -cd 2 -[ "$(pwd)" = "$D/b/2" ] diff --git a/bin/cash/tests/builtins/cd2.0 b/bin/cash/tests/builtins/cd2.0 deleted file mode 100644 index e4807875..00000000 --- a/bin/cash/tests/builtins/cd2.0 +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd2.0 216019 2010-11-28 22:49:58Z jilles $ -set -e - -L=$(getconf PATH_MAX / 2>/dev/null) || L=4096 -[ "$L" -lt 100000 ] 2>/dev/null || L=4096 -L=$((L+100)) -T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) -trap 'rm -rf ${T}' 0 -cd $T -D=$T -while [ ${#D} -lt $L ]; do - mkdir veryverylongdirectoryname - cd veryverylongdirectoryname - D=$D/veryverylongdirectoryname -done -[ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n diff --git a/bin/cash/tests/builtins/cd3.0 b/bin/cash/tests/builtins/cd3.0 deleted file mode 100644 index b41caee2..00000000 --- a/bin/cash/tests/builtins/cd3.0 +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd3.0 222154 2011-05-20 22:55:18Z jilles $ - -# If fully successful, cd -Pe must be like cd -P. - -set -e - -cd "${TMPDIR:-/tmp}" -cd -Pe / -[ "$PWD" = / ] -[ "$(pwd)" = / ] -cd "${TMPDIR:-/tmp}" -cd -eP / -[ "$PWD" = / ] -[ "$(pwd)" = / ] - -set +e - -# If cd -Pe cannot chdir, the exit status must be greater than 1. - -v=$( (cd -Pe /var/empty/nonexistent) 2>&1 >/dev/null) -[ $? -gt 1 ] && [ -n "$v" ] diff --git a/bin/cash/tests/builtins/cd4.0 b/bin/cash/tests/builtins/cd4.0 deleted file mode 100644 index 19531321..00000000 --- a/bin/cash/tests/builtins/cd4.0 +++ /dev/null @@ -1,38 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd4.0 222154 2011-05-20 22:55:18Z jilles $ - -# This test assumes that whatever mechanism cd -P uses to determine the -# pathname to the current directory if it is longer than PATH_MAX requires -# read permission on all parent directories. It also works if this -# requirement always applies. - -set -e -L=$(getconf PATH_MAX / 2>/dev/null) || L=4096 -[ "$L" -lt 100000 ] 2>/dev/null || L=4096 -L=$((L+100)) -T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) -trap 'chmod u+r ${T}; rm -rf ${T}' 0 -cd -Pe $T -D=$(pwd) -chmod u-r "$D" -if [ -r "$D" ]; then - # Running as root, cannot test. - exit 0 -fi -set +e -while [ ${#D} -lt $L ]; do - mkdir veryverylongdirectoryname || exit - cd -Pe veryverylongdirectoryname 2>/dev/null - r=$? - [ $r -gt 1 ] && exit $r - if [ $r -eq 1 ]; then - # Verify that the directory was changed correctly. - cd -Pe .. || exit - [ "$(pwd)" = "$D" ] || exit - # Verify that omitting -e results in success. - cd -P veryverylongdirectoryname 2>/dev/null || exit - exit 0 - fi - D=$D/veryverylongdirectoryname -done -echo "cd -Pe never returned 1" -exit 0 diff --git a/bin/cash/tests/builtins/cd5.0 b/bin/cash/tests/builtins/cd5.0 deleted file mode 100644 index 76df7887..00000000 --- a/bin/cash/tests/builtins/cd5.0 +++ /dev/null @@ -1,23 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd5.0 222379 2011-05-27 19:36:07Z jilles $ - -set -e -T=$(mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXX") -trap 'rm -rf "$T"' 0 - -cd -P "$T" -D=$(pwd) - -mkdir a a/1 b b/1 b/2 - -CDPATH=$D/a: -# Basic test. -cd 1 >/dev/null -[ "$(pwd)" = "$D/a/1" ] -# Test that the current directory is not checked before CDPATH. -cd "$D/b" -cd 1 >/dev/null -[ "$(pwd)" = "$D/a/1" ] -# Test not using a CDPATH entry. -cd "$D/b" -cd 2 -[ "$(pwd)" = "$D/b/2" ] diff --git a/bin/cash/tests/builtins/cd6.0 b/bin/cash/tests/builtins/cd6.0 deleted file mode 100644 index 34c8955a..00000000 --- a/bin/cash/tests/builtins/cd6.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd6.0 222381 2011-05-27 20:01:46Z jilles $ - -set -e -cd -P /bin -d=$PWD -CDPATH=/: -cd -P . -[ "$d" = "$PWD" ] -cd -P ./ -[ "$d" = "$PWD" ] diff --git a/bin/cash/tests/builtins/cd7.0 b/bin/cash/tests/builtins/cd7.0 deleted file mode 100644 index 2219b7b4..00000000 --- a/bin/cash/tests/builtins/cd7.0 +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd7.0 222381 2011-05-27 20:01:46Z jilles $ - -set -e -cd /usr/bin -[ "$PWD" = /usr/bin ] -CDPATH=/: -cd . -[ "$PWD" = /usr/bin ] -cd ./ -[ "$PWD" = /usr/bin ] -cd .. -[ "$PWD" = /usr ] -cd /usr/bin -cd ../ -[ "$PWD" = /usr ] diff --git a/bin/cash/tests/builtins/cd8.0 b/bin/cash/tests/builtins/cd8.0 deleted file mode 100644 index 5ee87ba1..00000000 --- a/bin/cash/tests/builtins/cd8.0 +++ /dev/null @@ -1,26 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd8.0 230095 2012-01-13 23:32:27Z jilles $ - -# The exact wording of the error message is not standardized, but giving -# a description of the errno is useful. - -LC_ALL=C -export LC_ALL -r=0 - -t() { - exec 3>&1 - errmsg=`cd "$1" 2>&1 >&3 3>&-` - exec 3>&- - case $errmsg in - *[Nn]ot\ a\ directory*) - ;; - *) - printf "Wrong error message for %s: %s\n" "$1" "$errmsg" - r=3 - ;; - esac -} - -t /dev/tty -t /dev/tty/x -exit $r diff --git a/bin/cash/tests/builtins/cd9.0 b/bin/cash/tests/builtins/cd9.0 deleted file mode 100644 index 56afe1ec..00000000 --- a/bin/cash/tests/builtins/cd9.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/cd9.0 293371 2016-01-07 21:46:07Z jilles $ - -cd /dev -cd /bin -cd - >/dev/null -pwd -cd - >/dev/null -pwd diff --git a/bin/cash/tests/builtins/cd9.0.stdout b/bin/cash/tests/builtins/cd9.0.stdout deleted file mode 100644 index dac16a76..00000000 --- a/bin/cash/tests/builtins/cd9.0.stdout +++ /dev/null @@ -1,2 +0,0 @@ -/dev -/bin diff --git a/bin/cash/tests/builtins/command1.0 b/bin/cash/tests/builtins/command1.0 deleted file mode 100644 index 55f19961..00000000 --- a/bin/cash/tests/builtins/command1.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command1.0 151797 2005-10-28 14:02:42Z stefanf $ -true() { - false -} -command true diff --git a/bin/cash/tests/builtins/command10.0 b/bin/cash/tests/builtins/command10.0 deleted file mode 100644 index 71bb437a..00000000 --- a/bin/cash/tests/builtins/command10.0 +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command10.0 204802 2010-03-06 17:31:09Z jilles $ - -failures=0 - -check() { - if ! eval "[ $* ]"; then - echo "Failed: $*" - : $((failures += 1)) - fi -} - -check '"$(f() { shift x; }; { command eval f 2>/dev/null; } >/dev/null; echo hi)" = hi' - -exit $((failures > 0)) diff --git a/bin/cash/tests/builtins/command11.0 b/bin/cash/tests/builtins/command11.0 deleted file mode 100644 index 35941fa1..00000000 --- a/bin/cash/tests/builtins/command11.0 +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command11.0 205154 2010-03-14 14:24:35Z jilles $ - -failures=0 - -check() { - if ! eval "[ $* ]"; then - echo "Failed: $*" - : $((failures += 1)) - fi -} - -check '"$({ command eval \{ shift x\; \} 2\>/dev/null; } >/dev/null; echo hi)" = hi' - -exit $((failures > 0)) diff --git a/bin/cash/tests/builtins/command12.0 b/bin/cash/tests/builtins/command12.0 deleted file mode 100644 index db38709c..00000000 --- a/bin/cash/tests/builtins/command12.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command12.0 257929 2013-11-10 23:00:39Z jilles $ - -alias aa=echo\ \'\"\' -cmd=$(command -v aa) -alias aa=echo\ bad -eval "$cmd" -[ "$(eval aa)" = \" ] diff --git a/bin/cash/tests/builtins/command2.0 b/bin/cash/tests/builtins/command2.0 deleted file mode 100644 index 41cd2deb..00000000 --- a/bin/cash/tests/builtins/command2.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command2.0 151797 2005-10-28 14:02:42Z stefanf $ -PATH= -command -p cat < /dev/null diff --git a/bin/cash/tests/builtins/command3.0 b/bin/cash/tests/builtins/command3.0 deleted file mode 100644 index 5fd8c92c..00000000 --- a/bin/cash/tests/builtins/command3.0 +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command3.0 211399 2010-08-16 17:18:08Z jilles $ -command -v ls -command -v true -command -v /bin/ls - -fun() { - : -} -command -v fun -command -v break -command -v if - -alias foo=bar -command -v foo diff --git a/bin/cash/tests/builtins/command3.0.stdout b/bin/cash/tests/builtins/command3.0.stdout deleted file mode 100644 index 67b86915..00000000 --- a/bin/cash/tests/builtins/command3.0.stdout +++ /dev/null @@ -1,7 +0,0 @@ -/bin/ls -true -/bin/ls -fun -break -if -alias foo=bar diff --git a/bin/cash/tests/builtins/command4.0 b/bin/cash/tests/builtins/command4.0 deleted file mode 100644 index b0306c31..00000000 --- a/bin/cash/tests/builtins/command4.0 +++ /dev/null @@ -1,2 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command4.0 211973 2010-08-29 20:53:24Z jilles $ -! command -v nonexisting diff --git a/bin/cash/tests/builtins/command5.0 b/bin/cash/tests/builtins/command5.0 deleted file mode 100644 index 5a2c1b0b..00000000 --- a/bin/cash/tests/builtins/command5.0 +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command5.0 211399 2010-08-16 17:18:08Z jilles $ -command -V ls -command -V true -command -V /bin/ls - -fun() { - : -} -command -V fun -command -V break -command -V if -command -V { - -alias foo=bar -command -V foo diff --git a/bin/cash/tests/builtins/command5.0.stdout b/bin/cash/tests/builtins/command5.0.stdout deleted file mode 100644 index 523f7b22..00000000 --- a/bin/cash/tests/builtins/command5.0.stdout +++ /dev/null @@ -1,8 +0,0 @@ -ls is /bin/ls -true is a shell builtin -/bin/ls is /bin/ls -fun is a shell function -break is a special shell builtin -if is a shell keyword -{ is a shell keyword -foo is an alias for bar diff --git a/bin/cash/tests/builtins/command6.0 b/bin/cash/tests/builtins/command6.0 deleted file mode 100644 index 747c3db0..00000000 --- a/bin/cash/tests/builtins/command6.0 +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command6.0 218356 2011-02-05 23:00:24Z jilles $ -PATH=/var/empty -case $(command -pV ls) in -*/var/empty/ls*) - echo "Failed: \$(command -pV ls) should not match */var/empty/ls*" ;; -"ls is"*" "/*/ls) ;; -*) - echo "Failed: \$(command -pV ls) match \"ls is\"*\" \"/*/ls" ;; -esac -command -pV true -command -pV /bin/ls - -fun() { - : -} -command -pV fun -command -pV break -command -pV if -command -pV { - -alias foo=bar -command -pV foo diff --git a/bin/cash/tests/builtins/command6.0.stdout b/bin/cash/tests/builtins/command6.0.stdout deleted file mode 100644 index 3180207a..00000000 --- a/bin/cash/tests/builtins/command6.0.stdout +++ /dev/null @@ -1,7 +0,0 @@ -true is a shell builtin -/bin/ls is /bin/ls -fun is a shell function -break is a special shell builtin -if is a shell keyword -{ is a shell keyword -foo is an alias for bar diff --git a/bin/cash/tests/builtins/command7.0 b/bin/cash/tests/builtins/command7.0 deleted file mode 100644 index f0621277..00000000 --- a/bin/cash/tests/builtins/command7.0 +++ /dev/null @@ -1,34 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command7.0 218356 2011-02-05 23:00:24Z jilles $ - -failures=0 - -check() { - if ! eval "[ $* ]"; then - echo "Failed: $*" - : $((failures += 1)) - fi -} - -check '"$(PATH=/libexec command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"' -check '"$(PATH=/libexec command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"' -check '"$(PATH=/libexec command -pv ld-elf.so.1)" = ""' -check '"$(PATH=/libexec command -pv ld-elf.so.1; :)" = ""' - -PATH=/libexec:$PATH - -check '"$(command -V ld-elf.so.1)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"' -check '"$(command -V ld-elf.so.1; :)" = "ld-elf.so.1 is /libexec/ld-elf.so.1"' -check '"$(command -pv ld-elf.so.1)" = ""' -check '"$(command -pv ld-elf.so.1; :)" = ""' - -PATH=/libexec - -check '"$(command -v ls)" = ""' -case $(command -pv ls) in -/*/ls) ;; -*) - echo "Failed: \$(command -pv ls) match /*/ls" - : $((failures += 1)) ;; -esac - -exit $((failures > 0)) diff --git a/bin/cash/tests/builtins/command8.0 b/bin/cash/tests/builtins/command8.0 deleted file mode 100644 index 50dfac3e..00000000 --- a/bin/cash/tests/builtins/command8.0 +++ /dev/null @@ -1,45 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command8.0 213738 2010-10-12 18:20:38Z obrien $ -IFS=, - -SPECIAL="break,\ - :,\ - continue,\ - . /dev/null,\ - eval,\ - exec,\ - export -p,\ - readonly -p,\ - set,\ - shift 0,\ - times,\ - trap,\ - unset foo" - -set -e - -# Check that special builtins can be executed via "command". - -set -- ${SPECIAL} -for cmd in "$@" -do - ${SH} -c "v=:; while \$v; do v=false; command ${cmd}; done" >/dev/null -done - -while :; do - command break - echo Error on line $LINENO -done - -set p q r -command shift 2 -if [ $# -ne 1 ]; then - echo Error on line $LINENO -fi - -( - command exec >/dev/null - echo Error on line $LINENO -) - -set +e -! command shift 2 2>/dev/null diff --git a/bin/cash/tests/builtins/command9.0 b/bin/cash/tests/builtins/command9.0 deleted file mode 100644 index 821be0a4..00000000 --- a/bin/cash/tests/builtins/command9.0 +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/command9.0 204801 2010-03-06 17:09:22Z jilles $ - -failures=0 - -check() { - if ! eval "[ $* ]"; then - echo "Failed: $*" - : $((failures += 1)) - fi -} - -check '"$({ command eval shift x 2>/dev/null; } >/dev/null; echo hi)" = hi' - -exit $((failures > 0)) diff --git a/bin/cash/tests/builtins/dot1.0 b/bin/cash/tests/builtins/dot1.0 deleted file mode 100644 index a0bf12e0..00000000 --- a/bin/cash/tests/builtins/dot1.0 +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/dot1.0 208629 2010-05-28 22:08:34Z jilles $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit -trap 'rm -rf $T' 0 -cd $T || exit 3 -unset x -echo 'x=2' >testscript -. ./testscript -[ "$x" = 2 ] || failure $LINENO -cd / || exit 3 -x=1 -PATH=$T:$PATH . testscript -[ "$x" = 2 ] || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/dot2.0 b/bin/cash/tests/builtins/dot2.0 deleted file mode 100644 index 342e73b1..00000000 --- a/bin/cash/tests/builtins/dot2.0 +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/dot2.0 208630 2010-05-28 22:40:24Z jilles $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit -trap 'rm -rf $T' 0 -cd $T || exit 3 -unset x -echo 'x=2' >testscript -. -- ./testscript -[ "$x" = 2 ] || failure $LINENO -cd / || exit 3 -x=1 -PATH=$T:$PATH . -- testscript -[ "$x" = 2 ] || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/dot3.0 b/bin/cash/tests/builtins/dot3.0 deleted file mode 100644 index eb67b7b9..00000000 --- a/bin/cash/tests/builtins/dot3.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/dot3.0 219390 2011-03-07 23:52:23Z jilles $ - -# . should return 0 if no command was executed. - -if false; then - exit 3 -else - . /dev/null - exit $? -fi diff --git a/bin/cash/tests/builtins/dot4.0 b/bin/cash/tests/builtins/dot4.0 deleted file mode 100644 index 2b9e86ea..00000000 --- a/bin/cash/tests/builtins/dot4.0 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/dot4.0 222174 2011-05-22 12:15:14Z jilles $ - -v=abcd -v=$v$v$v$v -v=$v$v$v$v -v=$v$v$v$v -v=$v$v$v$v -v=$v$v$v$v -r=$( ( - trap 'exit 0' 0 - . "$v" -) 2>&1 >/dev/null) && [ -n "$r" ] diff --git a/bin/cash/tests/builtins/echo1.0 b/bin/cash/tests/builtins/echo1.0 deleted file mode 100644 index d9267817..00000000 --- a/bin/cash/tests/builtins/echo1.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/echo1.0 305305 2016-09-02 21:13:46Z jilles $ - -# Not specified by POSIX. - -[ "`echo -n a b; echo c d; echo e f`" = "a bc d -e f" ] diff --git a/bin/cash/tests/builtins/echo2.0 b/bin/cash/tests/builtins/echo2.0 deleted file mode 100644 index ef3d606d..00000000 --- a/bin/cash/tests/builtins/echo2.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/echo2.0 305305 2016-09-02 21:13:46Z jilles $ - -# Not specified by POSIX. - -a=`echo -e '\a\b\e\f\n\r\t\v\\\\\0041\c'; echo .` -b=`printf '\a\b\033\f\n\r\t\v\\\\!.'` -[ "$a" = "$b" ] diff --git a/bin/cash/tests/builtins/echo3.0 b/bin/cash/tests/builtins/echo3.0 deleted file mode 100644 index 018417bc..00000000 --- a/bin/cash/tests/builtins/echo3.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/echo3.0 305305 2016-09-02 21:13:46Z jilles $ - -# Not specified by POSIX. - -[ "`echo -e 'a\cb' c; echo d`" = "ad" ] diff --git a/bin/cash/tests/builtins/eval1.0 b/bin/cash/tests/builtins/eval1.0 deleted file mode 100644 index 3888f1d5..00000000 --- a/bin/cash/tests/builtins/eval1.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval1.0 193178 2009-05-31 17:23:27Z stefanf $ -set -e - -eval -eval "" "" -eval "true" -! eval "false - -" diff --git a/bin/cash/tests/builtins/eval2.0 b/bin/cash/tests/builtins/eval2.0 deleted file mode 100644 index 04ed57dc..00000000 --- a/bin/cash/tests/builtins/eval2.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval2.0 194897 2009-06-24 20:22:54Z jilles $ - -eval ' -false - -' && exit 1 -exit 0 diff --git a/bin/cash/tests/builtins/eval3.0 b/bin/cash/tests/builtins/eval3.0 deleted file mode 100644 index 89b5398a..00000000 --- a/bin/cash/tests/builtins/eval3.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval3.0 196607 2009-08-27 22:23:23Z jilles $ - -eval 'false;' && exit 1 -eval 'true;' || exit 1 -eval 'false; -' && exit 1 -eval 'true; -' || exit 1 -exit 0 diff --git a/bin/cash/tests/builtins/eval4.0 b/bin/cash/tests/builtins/eval4.0 deleted file mode 100644 index 111483c3..00000000 --- a/bin/cash/tests/builtins/eval4.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval4.0 210738 2010-08-01 22:39:07Z jilles $ - -# eval should preserve $? from command substitutions when starting -# the parsed command. -[ $(eval 'echo $?' $(false)) = 1 ] diff --git a/bin/cash/tests/builtins/eval5.0 b/bin/cash/tests/builtins/eval5.0 deleted file mode 100644 index 056ee756..00000000 --- a/bin/cash/tests/builtins/eval5.0 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval5.0 210829 2010-08-03 22:17:29Z jilles $ - -# eval should return 0 if no command was executed. -eval $(false) diff --git a/bin/cash/tests/builtins/eval6.0 b/bin/cash/tests/builtins/eval6.0 deleted file mode 100644 index 02097c76..00000000 --- a/bin/cash/tests/builtins/eval6.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval6.0 249220 2013-04-06 22:30:46Z jilles $ - -# eval should preserve $? from command substitutions when starting -# the parsed command. -[ $(false; eval 'echo $?' $(:)) = 0 ] diff --git a/bin/cash/tests/builtins/eval7.0 b/bin/cash/tests/builtins/eval7.0 deleted file mode 100644 index 36cb7c4a..00000000 --- a/bin/cash/tests/builtins/eval7.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval7.0 272983 2014-10-12 13:12:06Z jilles $ -# Assumes that break can break out of a loop outside eval. - -while :; do - eval "break -echo bad1" - echo bad2 - exit 3 -done diff --git a/bin/cash/tests/builtins/eval8.7 b/bin/cash/tests/builtins/eval8.7 deleted file mode 100644 index 12a3e37e..00000000 --- a/bin/cash/tests/builtins/eval8.7 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/eval8.7 272983 2014-10-12 13:12:06Z jilles $ - -f() { - eval "return 7 -echo bad2" -} -f diff --git a/bin/cash/tests/builtins/exec1.0 b/bin/cash/tests/builtins/exec1.0 deleted file mode 100644 index 19f2eef1..00000000 --- a/bin/cash/tests/builtins/exec1.0 +++ /dev/null @@ -1,25 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/exec1.0 213738 2010-10-12 18:20:38Z obrien $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -( - exec >/dev/null - echo bad -) -[ $? = 0 ] || failure $LINENO -( - exec ${SH} -c 'exit 42' - echo bad -) -[ $? = 42 ] || failure $LINENO -( - exec /var/empty/nosuch - echo bad -) 2>/dev/null -[ $? = 127 ] || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/exec2.0 b/bin/cash/tests/builtins/exec2.0 deleted file mode 100644 index 9b29bd5d..00000000 --- a/bin/cash/tests/builtins/exec2.0 +++ /dev/null @@ -1,25 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/exec2.0 213738 2010-10-12 18:20:38Z obrien $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -( - exec -- >/dev/null - echo bad -) -[ $? = 0 ] || failure $LINENO -( - exec -- ${SH} -c 'exit 42' - echo bad -) -[ $? = 42 ] || failure $LINENO -( - exec -- /var/empty/nosuch - echo bad -) 2>/dev/null -[ $? = 127 ] || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/exit1.0 b/bin/cash/tests/builtins/exit1.0 deleted file mode 100644 index 0ca4279c..00000000 --- a/bin/cash/tests/builtins/exit1.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/exit1.0 216871 2011-01-01 15:25:15Z jilles $ - -# exit with an argument should overwrite the exit status in an EXIT trap. - -trap 'true; exit $?' 0 -false diff --git a/bin/cash/tests/builtins/exit2.8 b/bin/cash/tests/builtins/exit2.8 deleted file mode 100644 index ee747ccd..00000000 --- a/bin/cash/tests/builtins/exit2.8 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/exit2.8 217172 2011-01-08 23:00:38Z jilles $ - -# exit without arguments is the same as exit $? outside a trap. - -trap 'true; true' 0 -(exit 8) -exit diff --git a/bin/cash/tests/builtins/exit3.0 b/bin/cash/tests/builtins/exit3.0 deleted file mode 100644 index 3855919d..00000000 --- a/bin/cash/tests/builtins/exit3.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/exit3.0 217175 2011-01-08 23:08:13Z jilles $ - -# exit without arguments differs from exit $? in an EXIT trap. - -trap 'false; exit' 0 diff --git a/bin/cash/tests/builtins/export1.0 b/bin/cash/tests/builtins/export1.0 deleted file mode 100644 index 77a098b5..00000000 --- a/bin/cash/tests/builtins/export1.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/export1.0 223183 2011-06-17 10:21:24Z jilles $ - -env @badness=1 ${SH} -c 'v=`export -p`; eval "$v"' diff --git a/bin/cash/tests/builtins/fc1.0 b/bin/cash/tests/builtins/fc1.0 deleted file mode 100644 index e52e5884..00000000 --- a/bin/cash/tests/builtins/fc1.0 +++ /dev/null @@ -1,27 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/fc1.0 213738 2010-10-12 18:20:38Z obrien $ -set -e -trap 'echo Broken pipe -- test failed' PIPE - -P=${TMPDIR:-/tmp} -cd $P -T=$(mktemp -d sh-test.XXXXXX) -cd $T - -mkfifo input output error -HISTFILE=/dev/null ${SH} +m -i <input >output 2>error & -{ - # Syntax error - echo ')' >&3 - # Read error message, shell will read new input now - read dummy <&5 - # Execute bad command again - echo 'fc -e true' >&3 - # Verify that the shell is still running - echo 'echo continued' >&3 || rc=3 - echo 'exit' >&3 || rc=3 - read line <&4 && [ "$line" = continued ] && : ${rc:=0} -} 3>input 4<output 5<error - -rm input output error -rmdir ${P}/${T} -exit ${rc:-3} diff --git a/bin/cash/tests/builtins/fc2.0 b/bin/cash/tests/builtins/fc2.0 deleted file mode 100644 index 9abf4485..00000000 --- a/bin/cash/tests/builtins/fc2.0 +++ /dev/null @@ -1,34 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/fc2.0 213738 2010-10-12 18:20:38Z obrien $ -set -e -trap 'echo Broken pipe -- test failed' PIPE - -P=${TMPDIR:-/tmp} -cd $P -T=$(mktemp -d sh-test.XXXXXX) -cd $T - -mkfifo input output error -HISTFILE=/dev/null ${SH} +m -i <input >output 2>error & -exec 3>input -{ - # Command not found, containing slash - echo '/var/empty/nonexistent' >&3 - # Read error message, shell will read new input now - read dummy <&5 - # Execute bad command again - echo 'fc -e true; echo continued' >&3 - read dummy <&5 - read line <&4 && [ "$line" = continued ] && : ${rc:=0} - exec 3>&- - # Old sh duplicates itself after the fc, producing another line - # of output. - if read line <&4; then - echo "Extraneous output: $line" - rc=1 - fi -} 4<output 5<error -exec 3>&- - -rm input output error -rmdir ${P}/${T} -exit ${rc:-3} diff --git a/bin/cash/tests/builtins/for1.0 b/bin/cash/tests/builtins/for1.0 deleted file mode 100644 index 51e01e48..00000000 --- a/bin/cash/tests/builtins/for1.0 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/for1.0 226892 2011-10-28 23:02:21Z jilles $ - -false -for i in `false`; do exit 3; done diff --git a/bin/cash/tests/builtins/for2.0 b/bin/cash/tests/builtins/for2.0 deleted file mode 100644 index ab10d9ae..00000000 --- a/bin/cash/tests/builtins/for2.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/for2.0 230463 2012-01-22 14:00:33Z jilles $ - -r=x -f() { return 42; } -f -for i in x; do - r=$? -done -[ "$r" = 42 ] diff --git a/bin/cash/tests/builtins/for3.0 b/bin/cash/tests/builtins/for3.0 deleted file mode 100644 index f42cb958..00000000 --- a/bin/cash/tests/builtins/for3.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/for3.0 230463 2012-01-22 14:00:33Z jilles $ - -r=x -f() { return 42; } -for i in x`f`; do - r=$? -done -[ "$r" = 42 ] diff --git a/bin/cash/tests/builtins/getopts1.0 b/bin/cash/tests/builtins/getopts1.0 deleted file mode 100644 index ceca459f..00000000 --- a/bin/cash/tests/builtins/getopts1.0 +++ /dev/null @@ -1,25 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts1.0 297752 2016-04-09 16:06:13Z jilles $ - -printf -- '-1-\n' -set -- -abc -getopts "ab:" OPTION -printf '%s\n' "${OPTION}" - -# In this case 'getopts' should realize that we have not provided the -# required argument for "-b". -# Note that Solaris 10's (UNIX 03) /usr/xpg4/bin/sh, /bin/sh, and /bin/ksh; -# ksh93 20090505; pdksh 5.2.14p2; mksh R39c; bash 4.1 PL7; and zsh 4.3.10. -# all recognize that "b" is missing its argument on the *first* iteration -# of 'getopts' and do not produce the "a" in $OPTION. -printf -- '-2-\n' -set -- -ab -getopts "ab:" OPTION -printf '%s\n' "${OPTION}" -getopts "ab:" OPTION 3>&2 2>&1 >&3 3>&- -printf '%s\n' "${OPTION}" - -# The 'shift' is aimed at causing an error. -printf -- '-3-\n' -shift 1 -getopts "ab:" OPTION -printf '%s\n' "${OPTION}" diff --git a/bin/cash/tests/builtins/getopts1.0.stdout b/bin/cash/tests/builtins/getopts1.0.stdout deleted file mode 100644 index a0a347ee..00000000 --- a/bin/cash/tests/builtins/getopts1.0.stdout +++ /dev/null @@ -1,8 +0,0 @@ --1- -a --2- -a -No arg for -b option -? --3- -? diff --git a/bin/cash/tests/builtins/getopts10.0 b/bin/cash/tests/builtins/getopts10.0 deleted file mode 100644 index 59508f9e..00000000 --- a/bin/cash/tests/builtins/getopts10.0 +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts10.0 293359 2016-01-07 20:48:24Z jilles $ - -set -- -x arg -opt=not -getopts x opt -r1=$? OPTIND1=$OPTIND opt1=$opt -: $(: $((OPTIND = 1))) -getopts x opt -r2=$? OPTIND2=$OPTIND -[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] && - [ "$OPTIND2" = 2 ] diff --git a/bin/cash/tests/builtins/getopts2.0 b/bin/cash/tests/builtins/getopts2.0 deleted file mode 100644 index 9e26a7d9..00000000 --- a/bin/cash/tests/builtins/getopts2.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts2.0 297752 2016-04-09 16:06:13Z jilles $ -set - -ax -getopts ax option -set -C -getopts ax option -printf '%s\n' "$option" diff --git a/bin/cash/tests/builtins/getopts2.0.stdout b/bin/cash/tests/builtins/getopts2.0.stdout deleted file mode 100644 index 587be6b4..00000000 --- a/bin/cash/tests/builtins/getopts2.0.stdout +++ /dev/null @@ -1 +0,0 @@ -x diff --git a/bin/cash/tests/builtins/getopts3.0 b/bin/cash/tests/builtins/getopts3.0 deleted file mode 100644 index 428ad5c3..00000000 --- a/bin/cash/tests/builtins/getopts3.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts3.0 265616 2014-05-07 21:45:25Z jilles $ - -shift $# -getopts x opt -r=$? -[ "$r" != 0 ] && [ "$OPTIND" = 1 ] diff --git a/bin/cash/tests/builtins/getopts4.0 b/bin/cash/tests/builtins/getopts4.0 deleted file mode 100644 index b67831eb..00000000 --- a/bin/cash/tests/builtins/getopts4.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts4.0 265616 2014-05-07 21:45:25Z jilles $ - -set -- -x -opt=not -getopts x opt -r1=$? OPTIND1=$OPTIND opt1=$opt -getopts x opt -r2=$? OPTIND2=$OPTIND -[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] && - [ "$OPTIND2" = 2 ] diff --git a/bin/cash/tests/builtins/getopts5.0 b/bin/cash/tests/builtins/getopts5.0 deleted file mode 100644 index b350caba..00000000 --- a/bin/cash/tests/builtins/getopts5.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts5.0 265616 2014-05-07 21:45:25Z jilles $ - -set -- -x arg -opt=not -getopts x opt -r1=$? OPTIND1=$OPTIND opt1=$opt -getopts x opt -r2=$? OPTIND2=$OPTIND -[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] && - [ "$OPTIND2" = 2 ] diff --git a/bin/cash/tests/builtins/getopts6.0 b/bin/cash/tests/builtins/getopts6.0 deleted file mode 100644 index 55724ddd..00000000 --- a/bin/cash/tests/builtins/getopts6.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts6.0 265844 2014-05-10 17:42:21Z jilles $ - -set -- -x -y -getopts :x var || echo "First getopts bad: $?" -getopts :x var -r=$? -[ r != 0 ] && [ "$OPTIND" = 3 ] diff --git a/bin/cash/tests/builtins/getopts7.0 b/bin/cash/tests/builtins/getopts7.0 deleted file mode 100644 index 3b9c01df..00000000 --- a/bin/cash/tests/builtins/getopts7.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts7.0 265844 2014-05-10 17:42:21Z jilles $ - -set -- -x -getopts :x: var -r=$? -[ r != 0 ] && [ "$OPTIND" = 2 ] diff --git a/bin/cash/tests/builtins/getopts8.0 b/bin/cash/tests/builtins/getopts8.0 deleted file mode 100644 index c9855810..00000000 --- a/bin/cash/tests/builtins/getopts8.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts8.0 265849 2014-05-10 19:18:49Z jilles $ - -set -- -yz -wx -opt=wrong1 OPTARG=wrong2 -while getopts :x opt; do - echo "$opt:${OPTARG-unset}" -done -echo "OPTIND=$OPTIND" diff --git a/bin/cash/tests/builtins/getopts8.0.stdout b/bin/cash/tests/builtins/getopts8.0.stdout deleted file mode 100644 index f10cefcd..00000000 --- a/bin/cash/tests/builtins/getopts8.0.stdout +++ /dev/null @@ -1,5 +0,0 @@ -?:y -?:z -?:w -x:unset -OPTIND=3 diff --git a/bin/cash/tests/builtins/getopts9.0 b/bin/cash/tests/builtins/getopts9.0 deleted file mode 100644 index 3f96c4da..00000000 --- a/bin/cash/tests/builtins/getopts9.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/getopts9.0 297752 2016-04-09 16:06:13Z jilles $ - -args='-ab' -getopts ab opt $args -printf '%s\n' "$?:$opt:$OPTARG" -for dummy in dummy1 dummy2; do - getopts ab opt $args - printf '%s\n' "$?:$opt:$OPTARG" -done diff --git a/bin/cash/tests/builtins/getopts9.0.stdout b/bin/cash/tests/builtins/getopts9.0.stdout deleted file mode 100644 index 4d32063f..00000000 --- a/bin/cash/tests/builtins/getopts9.0.stdout +++ /dev/null @@ -1,3 +0,0 @@ -0:a: -0:b: -1:?: diff --git a/bin/cash/tests/builtins/hash1.0 b/bin/cash/tests/builtins/hash1.0 deleted file mode 100644 index 58051796..00000000 --- a/bin/cash/tests/builtins/hash1.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/hash1.0 149791 2005-09-05 09:42:10Z stefanf $ -cat /dev/null -hash -hash -r -hash diff --git a/bin/cash/tests/builtins/hash1.0.stdout b/bin/cash/tests/builtins/hash1.0.stdout deleted file mode 100644 index 3afc3e7b..00000000 --- a/bin/cash/tests/builtins/hash1.0.stdout +++ /dev/null @@ -1 +0,0 @@ -/bin/cat diff --git a/bin/cash/tests/builtins/hash2.0 b/bin/cash/tests/builtins/hash2.0 deleted file mode 100644 index d96f911c..00000000 --- a/bin/cash/tests/builtins/hash2.0 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/hash2.0 149791 2005-09-05 09:42:10Z stefanf $ -hash -hash cat -hash diff --git a/bin/cash/tests/builtins/hash2.0.stdout b/bin/cash/tests/builtins/hash2.0.stdout deleted file mode 100644 index 3afc3e7b..00000000 --- a/bin/cash/tests/builtins/hash2.0.stdout +++ /dev/null @@ -1 +0,0 @@ -/bin/cat diff --git a/bin/cash/tests/builtins/hash3.0 b/bin/cash/tests/builtins/hash3.0 deleted file mode 100644 index 02d89695..00000000 --- a/bin/cash/tests/builtins/hash3.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/hash3.0 149791 2005-09-05 09:42:10Z stefanf $ -hash -v cat -hash diff --git a/bin/cash/tests/builtins/hash3.0.stdout b/bin/cash/tests/builtins/hash3.0.stdout deleted file mode 100644 index a34864cd..00000000 --- a/bin/cash/tests/builtins/hash3.0.stdout +++ /dev/null @@ -1,2 +0,0 @@ -/bin/cat -/bin/cat diff --git a/bin/cash/tests/builtins/hash4.0 b/bin/cash/tests/builtins/hash4.0 deleted file mode 100644 index bd07b83e..00000000 --- a/bin/cash/tests/builtins/hash4.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/hash4.0 231535 2012-02-11 21:06:45Z jilles $ - -exec 3>&1 -m=`hash nosuchtool 2>&1 >&3` -r=$? -[ "$r" != 0 ] && [ -n "$m" ] diff --git a/bin/cash/tests/builtins/jobid1.0 b/bin/cash/tests/builtins/jobid1.0 deleted file mode 100644 index fae17708..00000000 --- a/bin/cash/tests/builtins/jobid1.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/jobid1.0 254412 2013-08-16 13:48:11Z jilles $ -# Non-standard builtin. - -: & -p1=$! -p2=$(jobid) -[ "${p1:?}" = "${p2:?}" ] diff --git a/bin/cash/tests/builtins/jobid2.0 b/bin/cash/tests/builtins/jobid2.0 deleted file mode 100644 index abfa71ad..00000000 --- a/bin/cash/tests/builtins/jobid2.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/jobid2.0 254413 2013-08-16 13:56:43Z jilles $ - -: & -p1=$(jobid) -p2=$(jobid --) -p3=$(jobid %+) -p4=$(jobid -- %+) -[ "${p1:?}" = "${p2:?}" ] && [ "${p2:?}" = "${p3:?}" ] && -[ "${p3:?}" = "${p4:?}" ] && [ "${p4:?}" = "${p1:?}" ] diff --git a/bin/cash/tests/builtins/kill1.0 b/bin/cash/tests/builtins/kill1.0 deleted file mode 100644 index 844a0ab9..00000000 --- a/bin/cash/tests/builtins/kill1.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/kill1.0 262931 2014-03-08 19:44:34Z jilles $ - -: & -p1=$! -: & -p2=$! -wait $p2 -kill %1 diff --git a/bin/cash/tests/builtins/kill2.0 b/bin/cash/tests/builtins/kill2.0 deleted file mode 100644 index c4e70e7c..00000000 --- a/bin/cash/tests/builtins/kill2.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/kill2.0 263206 2014-03-15 14:58:48Z jilles $ - -sleep 1 | sleep 1 & -kill %+ -wait "$!" -r=$? -[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = TERM ] diff --git a/bin/cash/tests/builtins/lineno.0 b/bin/cash/tests/builtins/lineno.0 deleted file mode 100644 index d70fdf12..00000000 --- a/bin/cash/tests/builtins/lineno.0 +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/lineno.0 179023 2008-05-15 19:58:44Z stefanf $ -echo $LINENO -echo $LINENO - -f() { - echo $LINENO - echo $LINENO -} - -f - -echo ${LINENO:-foo} -echo ${LINENO=foo} -echo ${LINENO:+foo} -echo ${LINENO+foo} -echo ${#LINENO} diff --git a/bin/cash/tests/builtins/lineno.0.stdout b/bin/cash/tests/builtins/lineno.0.stdout deleted file mode 100644 index 82583a93..00000000 --- a/bin/cash/tests/builtins/lineno.0.stdout +++ /dev/null @@ -1,9 +0,0 @@ -2 -3 -2 -3 -12 -13 -foo -foo -2 diff --git a/bin/cash/tests/builtins/lineno2.0 b/bin/cash/tests/builtins/lineno2.0 deleted file mode 100644 index e232632d..00000000 --- a/bin/cash/tests/builtins/lineno2.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/lineno2.0 262565 2014-02-27 16:54:43Z jilles $ - -f() { - : ${LINENO+${x?}} -} - -unset -v x -command eval f 2>/dev/null && exit 3 -x=1 -f diff --git a/bin/cash/tests/builtins/lineno3.0 b/bin/cash/tests/builtins/lineno3.0 deleted file mode 100644 index 69e99f76..00000000 --- a/bin/cash/tests/builtins/lineno3.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/lineno3.0 272482 2014-10-03 20:24:56Z jilles $ - -echo before: $LINENO -dummy=$'a\0 -' -echo after: $LINENO diff --git a/bin/cash/tests/builtins/lineno3.0.stdout b/bin/cash/tests/builtins/lineno3.0.stdout deleted file mode 100644 index 6e0e4ac8..00000000 --- a/bin/cash/tests/builtins/lineno3.0.stdout +++ /dev/null @@ -1,2 +0,0 @@ -before: 3 -after: 6 diff --git a/bin/cash/tests/builtins/local1.0 b/bin/cash/tests/builtins/local1.0 deleted file mode 100644 index a1fb2c38..00000000 --- a/bin/cash/tests/builtins/local1.0 +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/local1.0 238469 2012-07-15 10:22:13Z jilles $ -# A commonly used but non-POSIX builtin. - -f() { - local x - x=2 - [ "$x" = 2 ] -} -x=1 -f || exit 3 -[ "$x" = 1 ] || exit 3 -f || exit 3 -[ "$x" = 1 ] || exit 3 diff --git a/bin/cash/tests/builtins/local2.0 b/bin/cash/tests/builtins/local2.0 deleted file mode 100644 index 185cc39f..00000000 --- a/bin/cash/tests/builtins/local2.0 +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/local2.0 251797 2013-06-15 22:22:03Z jilles $ - -f() { - local - - set -a - case $- in - *a*) : ;; - *) echo In-function \$- bad - esac -} -case $- in -*a*) echo Initial \$- bad -esac -f -case $- in -*a*) echo Final \$- bad -esac diff --git a/bin/cash/tests/builtins/local3.0 b/bin/cash/tests/builtins/local3.0 deleted file mode 100644 index 3f786408..00000000 --- a/bin/cash/tests/builtins/local3.0 +++ /dev/null @@ -1,26 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/local3.0 251797 2013-06-15 22:22:03Z jilles $ - -f() { - local "$@" - set -a - x=7 - case $- in - *a*) : ;; - *) echo In-function \$- bad - esac - [ "$x" = 7 ] || echo In-function \$x bad -} -x=1 -case $- in -*a*) echo Initial \$- bad -esac -f x - -case $- in -*a*) echo Intermediate \$- bad -esac -[ "$x" = 1 ] || echo Intermediate \$x bad -f - x -case $- in -*a*) echo Final \$- bad -esac -[ "$x" = 1 ] || echo Final \$x bad diff --git a/bin/cash/tests/builtins/local4.0 b/bin/cash/tests/builtins/local4.0 deleted file mode 100644 index 1b05dfed..00000000 --- a/bin/cash/tests/builtins/local4.0 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/local4.0 254339 2013-08-14 21:59:48Z jilles $ - -f() { - local -- x - x=2 - [ "$x" = 2 ] -} -x=1 -f || exit 3 -[ "$x" = 1 ] || exit 3 -f || exit 3 -[ "$x" = 1 ] || exit 3 diff --git a/bin/cash/tests/builtins/local5.0 b/bin/cash/tests/builtins/local5.0 deleted file mode 100644 index 72bd616c..00000000 --- a/bin/cash/tests/builtins/local5.0 +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/local5.0 293635 2016-01-10 16:31:28Z jilles $ - -f() { - local PATH IFS elem - IFS=: - for elem in ''$PATH''; do - PATH=/var/empty/$elem:$PATH - done - ls -d / >/dev/null -} - -p1=$(command -v ls) -f -p2=$(command -v ls) -[ "$p1" = "$p2" ] diff --git a/bin/cash/tests/builtins/local6.0 b/bin/cash/tests/builtins/local6.0 deleted file mode 100644 index 88283edb..00000000 --- a/bin/cash/tests/builtins/local6.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/local6.0 294582 2016-01-22 18:10:36Z jilles $ - -f() { - local x - readonly x=2 -} -x=3 -f -x=4 -[ "$x" = 4 ] diff --git a/bin/cash/tests/builtins/local7.0 b/bin/cash/tests/builtins/local7.0 deleted file mode 100644 index fc820962..00000000 --- a/bin/cash/tests/builtins/local7.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/local7.0 294593 2016-01-22 20:10:08Z jilles $ - -f() { - local x - readonly x=2 -} -unset x -f -x=4 -[ "$x" = 4 ] diff --git a/bin/cash/tests/builtins/locale1.0 b/bin/cash/tests/builtins/locale1.0 deleted file mode 100644 index 3b6a0987..00000000 --- a/bin/cash/tests/builtins/locale1.0 +++ /dev/null @@ -1,134 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/locale1.0 218819 2011-02-18 20:37:09Z jilles $ -# Note: this test depends on strerror() using locale. - -failures=0 - -check() { - if ! eval "[ $1 ]"; then - echo "Failed: $1 at $2" - : $((failures += 1)) - fi -} - -unset LANG LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME LC_MESSAGES -unset LANGUAGE - -msgeng="No such file or directory" -msgdut="Bestand of map niet gevonden" - -# Verify C locale error message. -case $(command . /var/empty/foo 2>&1) in - *"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -# Various locale variables that should not affect the message. -case $(LC_ALL=C command . /var/empty/foo 2>&1) in - *"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LC_ALL=C LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in - *"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LC_ALL=C LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in - *"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LC_CTYPE=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in - *"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -# Verify Dutch message. -case $(export LANG=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(export LC_MESSAGES=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(export LC_ALL=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -# Verify that command assignments do not set the locale persistently. -case $(command . /var/empty/foo 2>&1) in - *"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in - *"$msgdut"*"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in - *"$msgdut"*"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in - *"$msgdut"*"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -# Check special builtin; add colon invocation to avoid depending on certain fix. -case $(LC_ALL=nl_NL.ISO8859-1 . /var/empty/foo 2>&1; :) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -# Assignments on special builtins are exported to that builtin; the export -# is not persistent. -case $(LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in - *"$msgeng"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -case $(export LC_ALL; LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in - *"$msgdut"*) ok=1 ;; - *) ok=0 ;; -esac -check '$ok -eq 1' $LINENO - -exit $((failures > 0)) diff --git a/bin/cash/tests/builtins/locale2.0 b/bin/cash/tests/builtins/locale2.0 deleted file mode 100644 index cdb17095..00000000 --- a/bin/cash/tests/builtins/locale2.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/locale2.0 317912 2017-05-07 19:49:46Z jilles $ - -$SH -c 'LC_ALL=C true; kill -INT $$; echo continued' -r=$? -[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ] diff --git a/bin/cash/tests/builtins/printf1.0 b/bin/cash/tests/builtins/printf1.0 deleted file mode 100644 index 0669bd49..00000000 --- a/bin/cash/tests/builtins/printf1.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/printf1.0 214853 2010-11-05 21:47:58Z jilles $ - -[ "$(printf '%c\0%s%d' x '\' 010 | tr '\0' Z)" = 'xZ\8' ] diff --git a/bin/cash/tests/builtins/printf2.0 b/bin/cash/tests/builtins/printf2.0 deleted file mode 100644 index f85d39e1..00000000 --- a/bin/cash/tests/builtins/printf2.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/printf2.0 214853 2010-11-05 21:47:58Z jilles $ - -[ "$(printf '%cZ%s%d' x '\' 010)" = 'xZ\8' ] diff --git a/bin/cash/tests/builtins/printf3.0 b/bin/cash/tests/builtins/printf3.0 deleted file mode 100644 index e6a1dec9..00000000 --- a/bin/cash/tests/builtins/printf3.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/printf3.0 216606 2010-12-20 23:06:57Z jilles $ - -set -e -v=$(! printf "%d" @wrong 2>/dev/null) -[ "$v" = "0" ] diff --git a/bin/cash/tests/builtins/printf4.0 b/bin/cash/tests/builtins/printf4.0 deleted file mode 100644 index ab6abef6..00000000 --- a/bin/cash/tests/builtins/printf4.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/printf4.0 216606 2010-12-20 23:06:57Z jilles $ - -set -e -v=$(! printf "%d" 4wrong 2>/dev/null) -[ "$v" = "4" ] diff --git a/bin/cash/tests/builtins/read1.0 b/bin/cash/tests/builtins/read1.0 deleted file mode 100644 index 753613d0..00000000 --- a/bin/cash/tests/builtins/read1.0 +++ /dev/null @@ -1,26 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read1.0 190300 2009-03-22 23:00:52Z stefanf $ -set -e - -echo "1 2 3" | { read a; echo "x${a}x"; } -echo "1 2 3" | { read a b; echo "x${a}x${b}x"; } -echo "1 2 3" | { read a b c; echo "x${a}x${b}x${c}x"; } -echo "1 2 3" | { read a b c d; echo "x${a}x${b}x${c}x${d}x"; } - -echo " 1 2 3 " | { read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 2 3 " | { unset IFS; read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 2 3 " | { IFS=$(printf ' \t\n') read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 2 3 " | { IFS= read a b; echo "x${a}x${b}x"; } - -echo " 1,2 3 " | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; } -echo ", 2 ,3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 ,,3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 , , 3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 ,2 3," | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 ,2 3,," | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; } - -echo " 1,2 3 " | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; } -echo ", 2 ,3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 ,,3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 , , 3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 ,2 3," | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; } -echo " 1 ,2 3,," | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; } diff --git a/bin/cash/tests/builtins/read1.0.stdout b/bin/cash/tests/builtins/read1.0.stdout deleted file mode 100644 index dbcb1af9..00000000 --- a/bin/cash/tests/builtins/read1.0.stdout +++ /dev/null @@ -1,20 +0,0 @@ -x1 2 3x -x1x2 3x -x1x2x3x -x1x2x3xx -x1x2x3x -x1x2x3x -x1x2x3x -x 1 2 3 xx -x1x2x3x -xx2x3x -x1xx3x -x1xx3x -x1x2x3x -x1x2x3,,x -x1x2x3x -xx2x3x -x1xx3x -x1xx3x -x1x2x3x -x1x2x3,,x diff --git a/bin/cash/tests/builtins/read2.0 b/bin/cash/tests/builtins/read2.0 deleted file mode 100644 index f41acd51..00000000 --- a/bin/cash/tests/builtins/read2.0 +++ /dev/null @@ -1,31 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read2.0 212187 2010-09-03 21:17:33Z jilles $ - -set -e -{ - echo 1 - echo two - echo three -} | { - read x - [ "$x" = 1 ] - (read x - [ "$x" = two ]) - read x - [ "$x" = three ] -} - -T=`mktemp sh-test.XXXXXX` -trap 'rm -f "$T"' 0 -{ - echo 1 - echo two - echo three -} >$T -{ - read x - [ "$x" = 1 ] - (read x - [ "$x" = two ]) - read x - [ "$x" = three ] -} <$T diff --git a/bin/cash/tests/builtins/read3.0 b/bin/cash/tests/builtins/read3.0 deleted file mode 100644 index 594ef6a1..00000000 --- a/bin/cash/tests/builtins/read3.0 +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read3.0 212330 2010-09-08 18:32:23Z jilles $ - -printf '%s\n' 'a\ b c' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' 'a b\ c' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' 'a\:b:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' 'a:b\:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\\' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\\\ a' | { read -r a b; printf '%s\n' "x${a}x${b}x"; } diff --git a/bin/cash/tests/builtins/read3.0.stdout b/bin/cash/tests/builtins/read3.0.stdout deleted file mode 100644 index 8ed98ca9..00000000 --- a/bin/cash/tests/builtins/read3.0.stdout +++ /dev/null @@ -1,9 +0,0 @@ -xa bxcx -xaxb cx -xa:bxcx -xaxb:cx -x axx -x:axx -x\xx -x\ axx -x\\\xax diff --git a/bin/cash/tests/builtins/read4.0 b/bin/cash/tests/builtins/read4.0 deleted file mode 100644 index 9a3a8f41..00000000 --- a/bin/cash/tests/builtins/read4.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read4.0 212339 2010-09-08 20:35:43Z jilles $ - -printf '%s\n' '\a\ b c' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\a b\ c' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\a\:b:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\a:b\:c' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\\\ a' | { read a b; printf '%s\n' "x${a}x${b}x"; } -printf '%s\n' '\\\:a' | { IFS=: read a b; printf '%s\n' "x${a}x${b}x"; } diff --git a/bin/cash/tests/builtins/read4.0.stdout b/bin/cash/tests/builtins/read4.0.stdout deleted file mode 100644 index a8747a46..00000000 --- a/bin/cash/tests/builtins/read4.0.stdout +++ /dev/null @@ -1,8 +0,0 @@ -xa bxcx -xaxb cx -xa:bxcx -xaxb:cx -x\xax -x\xax -x\ axx -x\:axx diff --git a/bin/cash/tests/builtins/read5.0 b/bin/cash/tests/builtins/read5.0 deleted file mode 100644 index 60bca1f7..00000000 --- a/bin/cash/tests/builtins/read5.0 +++ /dev/null @@ -1,32 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read5.0 218821 2011-02-18 20:51:13Z jilles $ - -unset LC_ALL -LC_CTYPE=en_US.ISO8859-1 -export LC_CTYPE - -# Note: the first and last characters are not whitespace. -# Exclude backslash and newline. -bad1=`printf %03o \'\\\\` -bad2=`printf %03o \'' -'` -e= -for i in 0 1 2 3; do - for j in 0 1 2 3 4 5 6 7; do - for k in 0 1 2 3 4 5 6 7; do - case $i$j$k in - 000|$bad1|$bad2) continue ;; - esac - e="$e\\$i$j$k" - done - done -done -e=`printf "$e"` -[ "${#e}" = 253 ] || echo length bad - -r1=`printf '%s\n' "$e" | { read -r x; printf '%s' "$x"; }` -[ "$r1" = "$e" ] || echo "read with -r bad" -r2=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` -[ "$r2" = "$e" ] || echo "read without -r bad 1" -IFS= -r3=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` -[ "$r3" = "$e" ] || echo "read without -r bad 2" diff --git a/bin/cash/tests/builtins/read6.0 b/bin/cash/tests/builtins/read6.0 deleted file mode 100644 index 784f59af..00000000 --- a/bin/cash/tests/builtins/read6.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read6.0 247190 2013-02-23 15:15:41Z jilles $ - -: | read x -r=$? -[ "$r" = 1 ] diff --git a/bin/cash/tests/builtins/read7.0 b/bin/cash/tests/builtins/read7.0 deleted file mode 100644 index 2df732b9..00000000 --- a/bin/cash/tests/builtins/read7.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read7.0 250214 2013-05-03 15:28:31Z jilles $ - -{ errmsg=`read x <&- 2>&1 >&3`; } 3>&1 -r=$? -[ "$r" -ge 2 ] && [ "$r" -le 128 ] && [ -n "$errmsg" ] diff --git a/bin/cash/tests/builtins/read8.0 b/bin/cash/tests/builtins/read8.0 deleted file mode 100644 index 2ff60144..00000000 --- a/bin/cash/tests/builtins/read8.0 +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read8.0 286826 2015-08-16 12:57:17Z jilles $ - -read a b c <<\EOF -\ -A\ - \ - \ - \ -B\ - \ - \ -C\ - \ - \ - \ -EOF -[ "$a.$b.$c" = "A.B.C" ] diff --git a/bin/cash/tests/builtins/read9.0 b/bin/cash/tests/builtins/read9.0 deleted file mode 100644 index dbd76d3e..00000000 --- a/bin/cash/tests/builtins/read9.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read9.0 287308 2015-08-30 17:24:22Z jilles $ - -empty='' -read a b c <<EOF -\ \ A B\ \ B C\ \ $empty -EOF -read d e <<EOF -D\ $empty -EOF -[ "$a.$b.$c.$d.$e" = " A.B B.C .D ." ] diff --git a/bin/cash/tests/builtins/return1.0 b/bin/cash/tests/builtins/return1.0 deleted file mode 100644 index 26ae07ec..00000000 --- a/bin/cash/tests/builtins/return1.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return1.0 149791 2005-09-05 09:42:10Z stefanf $ -f() { - return 0 - exit 1 -} - -f diff --git a/bin/cash/tests/builtins/return2.1 b/bin/cash/tests/builtins/return2.1 deleted file mode 100644 index 4ed4dbe8..00000000 --- a/bin/cash/tests/builtins/return2.1 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return2.1 149791 2005-09-05 09:42:10Z stefanf $ -f() { - true && return 1 - return 0 -} - -f diff --git a/bin/cash/tests/builtins/return3.1 b/bin/cash/tests/builtins/return3.1 deleted file mode 100644 index b34d0040..00000000 --- a/bin/cash/tests/builtins/return3.1 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return3.1 149791 2005-09-05 09:42:10Z stefanf $ -return 1 -exit 0 diff --git a/bin/cash/tests/builtins/return4.0 b/bin/cash/tests/builtins/return4.0 deleted file mode 100644 index 606e55e6..00000000 --- a/bin/cash/tests/builtins/return4.0 +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return4.0 208629 2010-05-28 22:08:34Z jilles $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit -trap 'rm -rf $T' 0 -cd $T || exit 3 -echo 'return 42; exit 4' >testscript -. ./testscript -[ "$?" = 42 ] || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/return5.0 b/bin/cash/tests/builtins/return5.0 deleted file mode 100644 index 6ce02b32..00000000 --- a/bin/cash/tests/builtins/return5.0 +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return5.0 211349 2010-08-15 21:06:53Z jilles $ - -if [ "$1" != nested ]; then - f() { - set -- nested - . "$0" - # Allow return to return from the function or the dot script. - return 4 - } - f - exit $(($? ^ 4)) -fi -# To trigger the bug, the following commands must be at the top level, -# with newlines in between. -return 4 -echo bad -exit 1 diff --git a/bin/cash/tests/builtins/return6.4 b/bin/cash/tests/builtins/return6.4 deleted file mode 100644 index 1e1eaec9..00000000 --- a/bin/cash/tests/builtins/return6.4 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return6.4 212475 2010-09-11 15:07:40Z jilles $ - -while return 4; do exit 3; done diff --git a/bin/cash/tests/builtins/return7.4 b/bin/cash/tests/builtins/return7.4 deleted file mode 100644 index de459c15..00000000 --- a/bin/cash/tests/builtins/return7.4 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return7.4 212475 2010-09-11 15:07:40Z jilles $ - -f() { - while return 4; do exit 3; done -} -f diff --git a/bin/cash/tests/builtins/return8.0 b/bin/cash/tests/builtins/return8.0 deleted file mode 100644 index 4e3b667a..00000000 --- a/bin/cash/tests/builtins/return8.0 +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/return8.0 255215 2013-09-04 22:10:16Z jilles $ - -if [ "$1" = nested ]; then - return 17 -fi - -f() { - set -- nested - . "$0" - return $(($? ^ 1)) -} -f -exit $(($? ^ 16)) diff --git a/bin/cash/tests/builtins/set1.0 b/bin/cash/tests/builtins/set1.0 deleted file mode 100644 index fc39fade..00000000 --- a/bin/cash/tests/builtins/set1.0 +++ /dev/null @@ -1,32 +0,0 @@ -# $FreeBSD$ - -set +C -set +f -set -e - -settings=$(set +o) -set -C -set -f -set +e -case $- in -*C*) ;; -*) echo missing C ;; -esac -case $- in -*f*) ;; -*) echo missing C ;; -esac -case $- in -*e*) echo bad e ;; -esac -eval "$settings" -case $- in -*C*) echo bad C ;; -esac -case $- in -*f*) echo bad f ;; -esac -case $- in -*e*) ;; -*) echo missing e ;; -esac diff --git a/bin/cash/tests/builtins/set2.0 b/bin/cash/tests/builtins/set2.0 deleted file mode 100644 index 38be55ea..00000000 --- a/bin/cash/tests/builtins/set2.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/set2.0 223183 2011-06-17 10:21:24Z jilles $ - -! env @badness=1 ${SH} -c 'v=`set`; eval "$v"' 2>&1 | grep @badness diff --git a/bin/cash/tests/builtins/set3.0 b/bin/cash/tests/builtins/set3.0 deleted file mode 100644 index c2772e28..00000000 --- a/bin/cash/tests/builtins/set3.0 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/set3.0 296578 2016-03-09 21:05:21Z jilles $ - -settings1=$(set +o) && set -o nolog && settings2=$(set +o) && -[ "$settings1" != "$settings2" ] diff --git a/bin/cash/tests/builtins/trap1.0 b/bin/cash/tests/builtins/trap1.0 deleted file mode 100644 index 061a84cd..00000000 --- a/bin/cash/tests/builtins/trap1.0 +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap1.0 213738 2010-10-12 18:20:38Z obrien $ - -test "$(trap 'echo trapped' EXIT; :)" = trapped || exit 1 - -test "$(trap 'echo trapped' EXIT; /usr/bin/true)" = trapped || exit 1 - -result=$(${SH} -c 'trap "echo trapped" EXIT; /usr/bin/false') -test $? -eq 1 || exit 1 -test "$result" = trapped || exit 1 - -result=$(${SH} -c 'trap "echo trapped" EXIT; exec /usr/bin/false') -test $? -eq 1 || exit 1 -test -z "$result" || exit 1 - -result=0 -trap 'result=$((result+1))' INT -kill -INT $$ -test "$result" -eq 1 || exit 1 -(kill -INT $$) -test "$result" -eq 2 || exit 1 - -exit 0 diff --git a/bin/cash/tests/builtins/trap10.0 b/bin/cash/tests/builtins/trap10.0 deleted file mode 100644 index 23515454..00000000 --- a/bin/cash/tests/builtins/trap10.0 +++ /dev/null @@ -1,6 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap10.0 230212 2012-01-16 11:07:46Z dumbbell $ - -# Check that the return statement will not break the EXIT trap, ie. all -# trap commands are executed before the script exits. - -test "$(trap 'printf trap; echo ped' EXIT; f() { return; }; f)" = trapped || exit 1 diff --git a/bin/cash/tests/builtins/trap11.0 b/bin/cash/tests/builtins/trap11.0 deleted file mode 100644 index 63eddeee..00000000 --- a/bin/cash/tests/builtins/trap11.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap11.0 230212 2012-01-16 11:07:46Z dumbbell $ - -# Check that the return statement will not break the USR1 trap, ie. all -# trap commands are executed before the script resumes. - -result=$(${SH} -c 'trap "printf trap; echo ped" USR1; f() { return $(kill -USR1 $$); }; f') -test $? -eq 0 || exit 1 -test "$result" = trapped || exit 1 diff --git a/bin/cash/tests/builtins/trap12.0 b/bin/cash/tests/builtins/trap12.0 deleted file mode 100644 index 134391f7..00000000 --- a/bin/cash/tests/builtins/trap12.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap12.0 247720 2013-03-03 17:33:59Z jilles $ - -f() { - trap 'return 42' USR1 - kill -USR1 $$ - return 3 -} -f -r=$? -[ "$r" = 42 ] diff --git a/bin/cash/tests/builtins/trap13.0 b/bin/cash/tests/builtins/trap13.0 deleted file mode 100644 index 38678bf7..00000000 --- a/bin/cash/tests/builtins/trap13.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap13.0 257399 2013-10-30 21:36:15Z jilles $ - -{ - trap 'exit 0' INT - ${SH} -c 'kill -INT $PPID' - exit 3 -} & -wait $! diff --git a/bin/cash/tests/builtins/trap14.0 b/bin/cash/tests/builtins/trap14.0 deleted file mode 100644 index ce49b4c9..00000000 --- a/bin/cash/tests/builtins/trap14.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap14.0 257399 2013-10-30 21:36:15Z jilles $ - -{ - trap - INT - ${SH} -c 'kill -INT $PPID' & - wait -} & -wait $! -r=$? -[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ] diff --git a/bin/cash/tests/builtins/trap15.0 b/bin/cash/tests/builtins/trap15.0 deleted file mode 100644 index 5bb7aeb2..00000000 --- a/bin/cash/tests/builtins/trap15.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap15.0 281718 2015-04-18 23:49:57Z bdrewery $ - -(${SH} -c 'term(){ exit 5;}; trap term TERM; kill -TERM $$') & -wait >/dev/null 2>&1 $! -[ $? -eq 5 ] diff --git a/bin/cash/tests/builtins/trap16.0 b/bin/cash/tests/builtins/trap16.0 deleted file mode 100644 index 0c960546..00000000 --- a/bin/cash/tests/builtins/trap16.0 +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap16.0 281718 2015-04-18 23:49:57Z bdrewery $ - -traps=$(${SH} -c 'trap "echo bad" 0; trap - 0; trap') -[ -z "$traps" ] || exit 1 -traps=$(${SH} -c 'trap "echo bad" 0; trap "" 0; trap') -expected_traps=$(${SH} -c 'trap "" EXIT; trap') -[ "$traps" = "$expected_traps" ] || exit 2 -traps=$(${SH} -c 'trap "echo bad" 0; trap 0; trap') -[ -z "$traps" ] || exit 3 -traps=$(${SH} -c 'trap "echo bad" 0; trap -- 0; trap') -[ -z "$traps" ] || exit 4 -traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap - 0 1 2; trap') -[ -z "$traps" ] || exit 5 -traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap "" 0 1 2; trap') -expected_traps=$(${SH} -c 'trap "" EXIT HUP INT; trap') -[ "$traps" = "$expected_traps" ] || exit 6 -traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap 0 1 2; trap') -[ -z "$traps" ] || exit 7 -traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap -- 0 1 2; trap') -[ -z "$traps" ] || exit 8 diff --git a/bin/cash/tests/builtins/trap17.0 b/bin/cash/tests/builtins/trap17.0 deleted file mode 100644 index ec2e5870..00000000 --- a/bin/cash/tests/builtins/trap17.0 +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap17.0 297360 2016-03-28 18:58:40Z jilles $ -# This use-after-free bug probably needs non-default settings to show up. - -v1=nothing v2=nothing -trap 'trap "echo bad" USR1 -v1=trap_received -v2=trap_invoked -:' USR1 -kill -USR1 "$$" -[ "$v1.$v2" = trap_received.trap_invoked ] diff --git a/bin/cash/tests/builtins/trap2.0 b/bin/cash/tests/builtins/trap2.0 deleted file mode 100644 index 020dcfd9..00000000 --- a/bin/cash/tests/builtins/trap2.0 +++ /dev/null @@ -1,52 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap2.0 194517 2009-06-19 22:15:59Z jilles $ -# This is really a test for outqstr(), which is readily accessible via trap. - -runtest() -{ - teststring=$1 - trap -- "$teststring" USR1 - traps=$(trap) - if [ "$teststring" != "-" ] && [ -z "$traps" ]; then - # One possible reading of POSIX requires the above to return an - # empty string because backquote commands are executed in a - # subshell and subshells shall reset traps. However, an example - # in the normative description of the trap builtin shows the - # same usage as here, it is useful and our /bin/sh allows it. - echo '$(trap) is broken' - exit 1 - fi - trap - USR1 - eval "$traps" - traps2=$(trap) - if [ "$traps" != "$traps2" ]; then - echo "Mismatch for '$teststring'" - exit 1 - fi -} - -runtest 'echo' -runtest 'echo hi' -runtest "'echo' 'hi'" -runtest '"echo" $PATH' -runtest '\echo "$PATH"' -runtest ' 0' -runtest '0 ' -runtest ' 1' -runtest '1 ' -i=1 -while [ $i -le 127 ]; do - c=$(printf \\"$(printf %o $i)") - if [ $i -lt 48 ] || [ $i -gt 57 ]; then - runtest "$c" - fi - runtest " $c$c" - runtest "a$c" - i=$((i+1)) -done -IFS=, -runtest ' ' -runtest ',' -unset IFS -runtest ' ' - -exit 0 diff --git a/bin/cash/tests/builtins/trap3.0 b/bin/cash/tests/builtins/trap3.0 deleted file mode 100644 index e08f7355..00000000 --- a/bin/cash/tests/builtins/trap3.0 +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap3.0 218889 2011-02-20 14:18:58Z jilles $ - -{ - trap '' garbage && exit 3 - trap - garbage && exit 3 - trap true garbage && exit 3 - trap '' 99999 && exit 3 - trap - 99999 && exit 3 - trap true 99999 && exit 3 -} 2>/dev/null -exit 0 diff --git a/bin/cash/tests/builtins/trap4.0 b/bin/cash/tests/builtins/trap4.0 deleted file mode 100644 index 5c31f165..00000000 --- a/bin/cash/tests/builtins/trap4.0 +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap4.0 217035 2011-01-05 23:17:29Z jilles $ - -T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) -trap 'rm -rf $T' 0 -cd $T || exit 3 -mkfifo fifo1 - -v=$( - exec 3>&1 - : <fifo1 & - { - wait $! - trap 'trap "" PIPE; echo trapped >&3 2>/dev/null' PIPE - echo x 2>/dev/null - } >fifo1 -) -test "$v" = trapped diff --git a/bin/cash/tests/builtins/trap5.0 b/bin/cash/tests/builtins/trap5.0 deleted file mode 100644 index 541dff30..00000000 --- a/bin/cash/tests/builtins/trap5.0 +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap5.0 217461 2011-01-15 21:09:00Z jilles $ - -set -e -trap - USR1 -initial=$(trap) -trap -- -l USR1 -added=$(trap) -[ -n "$added" ] -trap - USR1 -second=$(trap) -[ "$initial" = "$second" ] -eval "$added" -added2=$(trap) -added3=$(trap --) -[ "$added" = "$added2" ] -[ "$added2" = "$added3" ] -trap -- - USR1 -third=$(trap) -[ "$initial" = "$third" ] diff --git a/bin/cash/tests/builtins/trap6.0 b/bin/cash/tests/builtins/trap6.0 deleted file mode 100644 index e28097a9..00000000 --- a/bin/cash/tests/builtins/trap6.0 +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap6.0 217472 2011-01-16 13:56:41Z jilles $ - -v=$( - ${SH} -c 'trap "echo ok; exit" USR1; kill -USR1 $$' & - # Suppress possible message about exit on signal - wait $! >/dev/null 2>&1 -) -r=$(kill -l $?) -[ "$v" = "ok" ] && { [ "$r" = "USR1" ] || [ "$r" = "usr1" ]; } diff --git a/bin/cash/tests/builtins/trap7.0 b/bin/cash/tests/builtins/trap7.0 deleted file mode 100644 index a6facbdc..00000000 --- a/bin/cash/tests/builtins/trap7.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap7.0 217996 2011-01-27 23:08:20Z jilles $ - -[ "$(trap 'echo trapped' EXIT)" = trapped ] diff --git a/bin/cash/tests/builtins/trap8.0 b/bin/cash/tests/builtins/trap8.0 deleted file mode 100644 index d9cb2cc2..00000000 --- a/bin/cash/tests/builtins/trap8.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap8.0 218889 2011-02-20 14:18:58Z jilles $ - -# I am not sure if POSIX requires the shell to continue processing -# further trap names in the same trap command after an invalid one. - -test -n "$(trap true garbage TERM 2>/dev/null || trap)" || exit 3 -exit 0 diff --git a/bin/cash/tests/builtins/trap9.0 b/bin/cash/tests/builtins/trap9.0 deleted file mode 100644 index cfcee29d..00000000 --- a/bin/cash/tests/builtins/trap9.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/trap9.0 230211 2012-01-16 10:59:44Z dumbbell $ - -test "$(trap 'printf trap; echo ped' EXIT; f() { :; }; f)" = trapped || exit 1 diff --git a/bin/cash/tests/builtins/type1.0 b/bin/cash/tests/builtins/type1.0 deleted file mode 100644 index b4a6db2f..00000000 --- a/bin/cash/tests/builtins/type1.0 +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/type1.0 165931 2007-01-11 00:25:20Z stefanf $ -command -v not-here && exit 1 -command -v /not-here && exit 1 -command -V not-here && exit 1 -command -V /not-here && exit 1 -type not-here && exit 1 -type /not-here && exit 1 -exit 0 diff --git a/bin/cash/tests/builtins/type1.0.stderr b/bin/cash/tests/builtins/type1.0.stderr deleted file mode 100644 index 7853418a..00000000 --- a/bin/cash/tests/builtins/type1.0.stderr +++ /dev/null @@ -1,4 +0,0 @@ -not-here: not found -/not-here: No such file or directory -not-here: not found -/not-here: No such file or directory diff --git a/bin/cash/tests/builtins/type2.0 b/bin/cash/tests/builtins/type2.0 deleted file mode 100644 index 82891e50..00000000 --- a/bin/cash/tests/builtins/type2.0 +++ /dev/null @@ -1,26 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/type2.0 201344 2009-12-31 17:44:24Z jilles $ - -failures=0 - -check() { - if ! eval "$*"; then - echo "Failed: $*" - : $((failures += 1)) - fi -} - -check 'PATH=/libexec type ld-elf.so.1 >/dev/null' -check '! PATH=/libexec type ls 2>/dev/null' - -PATH=/libexec:$PATH - -check 'type ld-elf.so.1 >/dev/null' - -PATH=/libexec - -check 'type ld-elf.so.1 >/dev/null' -check '! type ls 2>/dev/null' -check 'PATH=/bin type ls >/dev/null' -check '! PATH=/bin type ld-elf.so.1 2>/dev/null' - -exit $((failures > 0)) diff --git a/bin/cash/tests/builtins/type3.0 b/bin/cash/tests/builtins/type3.0 deleted file mode 100644 index e60d40ba..00000000 --- a/bin/cash/tests/builtins/type3.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/type3.0 255072 2013-08-30 12:09:59Z jilles $ - -[ "$(type type)" = "$(type -- type)" ] diff --git a/bin/cash/tests/builtins/unalias.0 b/bin/cash/tests/builtins/unalias.0 deleted file mode 100644 index 813fea14..00000000 --- a/bin/cash/tests/builtins/unalias.0 +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/unalias.0 149781 2005-09-04 11:59:59Z stefanf $ -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 diff --git a/bin/cash/tests/builtins/var-assign.0 b/bin/cash/tests/builtins/var-assign.0 deleted file mode 100644 index 9869795e..00000000 --- a/bin/cash/tests/builtins/var-assign.0 +++ /dev/null @@ -1,55 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/var-assign.0 327281 2017-12-28 08:22:26Z eadler $ -IFS=, - -SPECIAL="break,\ - :,\ - continue,\ - . /dev/null, - eval, - exec, - export -p, - readonly -p, - set, - shift 0, - times, - trap, - unset foo" - -UTILS="alias,\ - bg,\ - bind,\ - cd,\ - command echo,\ - echo,\ - false,\ - fc -l,\ - fg,\ - getopts a var,\ - hash,\ - jobs,\ - printf a,\ - pwd,\ - read var < /dev/null,\ - test,\ - true,\ - type ls,\ - ulimit,\ - umask,\ - unalias -a,\ - wait" - -set -e - -# For special built-ins variable assignments affect the shell environment. -set -- ${SPECIAL} -for cmd in "$@" -do - ${SH} -c "VAR=1; VAR=0 ${cmd}; exit \${VAR}" >/dev/null 2>&1 -done - -# For other built-ins and utilities they do not. -set -- ${UTILS} -for cmd in "$@" -do - ${SH} -c "VAR=0; VAR=1 ${cmd}; exit \${VAR}" >/dev/null 2>&1 -done diff --git a/bin/cash/tests/builtins/var-assign2.0 b/bin/cash/tests/builtins/var-assign2.0 deleted file mode 100644 index ff60f72a..00000000 --- a/bin/cash/tests/builtins/var-assign2.0 +++ /dev/null @@ -1,55 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/var-assign2.0 213738 2010-10-12 18:20:38Z obrien $ -IFS=, - -SPECIAL="break,\ - :,\ - continue,\ - . /dev/null,\ - eval,\ - exec,\ - export -p,\ - readonly -p,\ - set,\ - shift 0,\ - times,\ - trap,\ - unset foo" - -UTILS="alias,\ - bg,\ - bind,\ - cd,\ - command echo,\ - echo,\ - false,\ - fc -l,\ - fg,\ - getopts a var,\ - hash,\ - jobs,\ - printf a,\ - pwd,\ - read var < /dev/null,\ - test,\ - true,\ - type ls,\ - ulimit,\ - umask,\ - unalias -a,\ - wait" - -set -e - -# With 'command', variable assignments do not affect the shell environment. - -set -- ${SPECIAL} -for cmd in "$@" -do - ${SH} -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1 -done - -set -- ${UTILS} -for cmd in "$@" -do - ${SH} -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1 -done diff --git a/bin/cash/tests/builtins/wait1.0 b/bin/cash/tests/builtins/wait1.0 deleted file mode 100644 index 4e8ae080..00000000 --- a/bin/cash/tests/builtins/wait1.0 +++ /dev/null @@ -1,23 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait1.0 208476 2010-05-23 22:10:20Z jilles $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -exit 4 & p4=$! -exit 8 & p8=$! -wait $p4 -[ $? = 4 ] || failure $LINENO -wait $p8 -[ $? = 8 ] || failure $LINENO - -exit 3 & p3=$! -exit 7 & p7=$! -wait $p7 -[ $? = 7 ] || failure $LINENO -wait $p3 -[ $? = 3 ] || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/wait10.0 b/bin/cash/tests/builtins/wait10.0 deleted file mode 100644 index f2f51855..00000000 --- a/bin/cash/tests/builtins/wait10.0 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait10.0 251430 2013-06-05 19:40:52Z jilles $ -# Init cannot be a child of the shell. -exit 49 & p49=$! -wait 1 "$p49" -[ "$?" = 49 ] diff --git a/bin/cash/tests/builtins/wait2.0 b/bin/cash/tests/builtins/wait2.0 deleted file mode 100644 index c6a93607..00000000 --- a/bin/cash/tests/builtins/wait2.0 +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait2.0 208476 2010-05-23 22:10:20Z jilles $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -for i in 1 2 3 4 5 6 7 8 9 10; do - exit $i & -done -wait || failure $LINENO -wait || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/wait3.0 b/bin/cash/tests/builtins/wait3.0 deleted file mode 100644 index b03d07f6..00000000 --- a/bin/cash/tests/builtins/wait3.0 +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait3.0 236771 2012-06-08 22:54:25Z jilles $ - -failures= -failure() { - echo "Error at line $1" >&2 - failures=x$failures -} - -T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) -trap 'rm -rf $T' 0 -cd $T || exit 3 -mkfifo fifo1 -for i in 1 2 3 4 5 6 7 8 9 10; do - exit $i 4<fifo1 & -done -exec 3>fifo1 -wait || failure $LINENO -(${SH} -c echo >&3) 2>/dev/null && failure $LINENO -wait || failure $LINENO - -test -z "$failures" diff --git a/bin/cash/tests/builtins/wait4.0 b/bin/cash/tests/builtins/wait4.0 deleted file mode 100644 index dbaeeb10..00000000 --- a/bin/cash/tests/builtins/wait4.0 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait4.0 247206 2013-02-23 22:50:57Z jilles $ - -T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX` -trap 'rm -rf $T' 0 -cd $T || exit 3 -mkfifo fifo1 -trapped= -trap trapped=1 QUIT -{ kill -QUIT $$; sleep 1; exit 4; } >fifo1 & -wait $! <fifo1 -r=$? -[ "$r" -gt 128 ] && [ -n "$trapped" ] diff --git a/bin/cash/tests/builtins/wait5.0 b/bin/cash/tests/builtins/wait5.0 deleted file mode 100644 index b9a8ed49..00000000 --- a/bin/cash/tests/builtins/wait5.0 +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait5.0 247206 2013-02-23 22:50:57Z jilles $ - -T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX` -trap 'rm -rf $T' 0 -cd $T || exit 3 -mkfifo fifo1 -trapped= -trap trapped=1 QUIT -{ kill -QUIT $$; sleep 1; exit 4; } >fifo1 & -wait <fifo1 -r=$? -[ "$r" -gt 128 ] && [ -n "$trapped" ] diff --git a/bin/cash/tests/builtins/wait6.0 b/bin/cash/tests/builtins/wait6.0 deleted file mode 100644 index 2a790ae2..00000000 --- a/bin/cash/tests/builtins/wait6.0 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait6.0 248349 2013-03-15 20:29:31Z jilles $ - -wait -- diff --git a/bin/cash/tests/builtins/wait7.0 b/bin/cash/tests/builtins/wait7.0 deleted file mode 100644 index 893cdcb7..00000000 --- a/bin/cash/tests/builtins/wait7.0 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait7.0 248349 2013-03-15 20:29:31Z jilles $ - -: & -wait -- $! diff --git a/bin/cash/tests/builtins/wait8.0 b/bin/cash/tests/builtins/wait8.0 deleted file mode 100644 index 8212035b..00000000 --- a/bin/cash/tests/builtins/wait8.0 +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait8.0 251429 2013-06-05 19:08:22Z jilles $ - -exit 44 & p44=$! -exit 45 & p45=$! -exit 7 & p7=$! -wait "$p44" "$p7" "$p45" -[ "$?" = 45 ] diff --git a/bin/cash/tests/builtins/wait9.127 b/bin/cash/tests/builtins/wait9.127 deleted file mode 100644 index 0e0866c3..00000000 --- a/bin/cash/tests/builtins/wait9.127 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD: releng/12.0/bin/sh/tests/builtins/wait9.127 251430 2013-06-05 19:40:52Z jilles $ -# Init cannot be a child of the shell. -wait 1 |