summary refs log tree commit diff
path: root/bin/cash/tests/parameters
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/cash/tests/parameters/Makefile29
-rw-r--r--bin/cash/tests/parameters/env1.011
-rw-r--r--bin/cash/tests/parameters/exitstatus1.09
-rw-r--r--bin/cash/tests/parameters/ifs1.010
-rw-r--r--bin/cash/tests/parameters/mail1.015
-rw-r--r--bin/cash/tests/parameters/mail2.015
-rw-r--r--bin/cash/tests/parameters/optind1.03
-rw-r--r--bin/cash/tests/parameters/optind2.03
-rw-r--r--bin/cash/tests/parameters/positional1.013
-rw-r--r--bin/cash/tests/parameters/positional2.065
-rw-r--r--bin/cash/tests/parameters/positional3.04
-rw-r--r--bin/cash/tests/parameters/positional4.04
-rw-r--r--bin/cash/tests/parameters/positional5.014
-rw-r--r--bin/cash/tests/parameters/positional6.07
-rw-r--r--bin/cash/tests/parameters/positional7.08
-rw-r--r--bin/cash/tests/parameters/positional8.031
-rw-r--r--bin/cash/tests/parameters/positional9.018
-rw-r--r--bin/cash/tests/parameters/pwd1.011
-rw-r--r--bin/cash/tests/parameters/pwd2.024
19 files changed, 0 insertions, 294 deletions
diff --git a/bin/cash/tests/parameters/Makefile b/bin/cash/tests/parameters/Makefile
deleted file mode 100644
index b5d5edab..00000000
--- a/bin/cash/tests/parameters/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/Makefile 306843 2016-10-08 13:40:12Z jilles $
-
-PACKAGE=	tests
-
-TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
-
-.PATH: ${.CURDIR:H}
-ATF_TESTS_SH=	functional_test
-
-${PACKAGE}FILES+=	env1.0
-${PACKAGE}FILES+=	exitstatus1.0
-${PACKAGE}FILES+=	ifs1.0
-${PACKAGE}FILES+=	mail1.0
-${PACKAGE}FILES+=	mail2.0
-${PACKAGE}FILES+=	optind1.0
-${PACKAGE}FILES+=	optind2.0
-${PACKAGE}FILES+=	positional1.0
-${PACKAGE}FILES+=	positional2.0
-${PACKAGE}FILES+=	positional3.0
-${PACKAGE}FILES+=	positional4.0
-${PACKAGE}FILES+=	positional5.0
-${PACKAGE}FILES+=	positional6.0
-${PACKAGE}FILES+=	positional7.0
-${PACKAGE}FILES+=	positional8.0
-${PACKAGE}FILES+=	positional9.0
-${PACKAGE}FILES+=	pwd1.0
-${PACKAGE}FILES+=	pwd2.0
-
-.include <bsd.test.mk>
diff --git a/bin/cash/tests/parameters/env1.0 b/bin/cash/tests/parameters/env1.0
deleted file mode 100644
index b5891b61..00000000
--- a/bin/cash/tests/parameters/env1.0
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/env1.0 222957 2011-06-10 22:42:00Z jilles $
-
-export key='must contain this'
-unset x
-r=$(ENV="\${x?\$key}" ${SH} -i +m 2>&1 >/dev/null <<\EOF
-exit 0
-EOF
-) && case $r in
-*"$key"*) true ;;
-*) false ;;
-esac
diff --git a/bin/cash/tests/parameters/exitstatus1.0 b/bin/cash/tests/parameters/exitstatus1.0
deleted file mode 100644
index 5e9e0823..00000000
--- a/bin/cash/tests/parameters/exitstatus1.0
+++ /dev/null
@@ -1,9 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/exitstatus1.0 185232 2008-11-23 20:27:03Z stefanf $
-f() {
-	[ $? = $1 ] || exit 1
-}
-
-true
-f 0
-false
-f 1
diff --git a/bin/cash/tests/parameters/ifs1.0 b/bin/cash/tests/parameters/ifs1.0
deleted file mode 100644
index 231cf2b0..00000000
--- a/bin/cash/tests/parameters/ifs1.0
+++ /dev/null
@@ -1,10 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/ifs1.0 306843 2016-10-08 13:40:12Z jilles $
-
-env IFS=_ ${SH} -c '
-rc=2
-nosuchtool_function() {
-	rc=0
-}
-v=nosuchtool_function
-$v && exit "$rc"
-'
diff --git a/bin/cash/tests/parameters/mail1.0 b/bin/cash/tests/parameters/mail1.0
deleted file mode 100644
index 84636293..00000000
--- a/bin/cash/tests/parameters/mail1.0
+++ /dev/null
@@ -1,15 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/mail1.0 213738 2010-10-12 18:20:38Z obrien $
-# Test that a non-interactive shell does not access $MAIL.
-
-goodfile=/var/empty/sh-test-goodfile
-mailfile=/var/empty/sh-test-mailfile
-T=$(mktemp sh-test.XXXXXX) || exit
-MAIL=$mailfile ktrace -i -f "$T" ${SH} -c "[ -s $goodfile ]" 2>/dev/null
-if ! grep -q $goodfile "$T"; then
-	# ktrace problem
-	rc=0
-elif ! grep -q $mailfile "$T"; then
-	rc=0
-fi
-rm "$T"
-exit ${rc:-3}
diff --git a/bin/cash/tests/parameters/mail2.0 b/bin/cash/tests/parameters/mail2.0
deleted file mode 100644
index 07d9c882..00000000
--- a/bin/cash/tests/parameters/mail2.0
+++ /dev/null
@@ -1,15 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/mail2.0 213738 2010-10-12 18:20:38Z obrien $
-# Test that an interactive shell accesses $MAIL.
-
-goodfile=/var/empty/sh-test-goodfile
-mailfile=/var/empty/sh-test-mailfile
-T=$(mktemp sh-test.XXXXXX) || exit
-ENV=$goodfile MAIL=$mailfile ktrace -i -f "$T" ${SH} +m -i </dev/null >/dev/null 2>&1
-if ! grep -q $goodfile "$T"; then
-	# ktrace problem
-	rc=0
-elif grep -q $mailfile "$T"; then
-	rc=0
-fi
-rm "$T"
-exit ${rc:-3}
diff --git a/bin/cash/tests/parameters/optind1.0 b/bin/cash/tests/parameters/optind1.0
deleted file mode 100644
index b5499bae..00000000
--- a/bin/cash/tests/parameters/optind1.0
+++ /dev/null
@@ -1,3 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/optind1.0 227773 2011-11-20 21:48:50Z jilles $
-
-unset OPTIND && [ -z "$OPTIND" ]
diff --git a/bin/cash/tests/parameters/optind2.0 b/bin/cash/tests/parameters/optind2.0
deleted file mode 100644
index 699b2814..00000000
--- a/bin/cash/tests/parameters/optind2.0
+++ /dev/null
@@ -1,3 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/optind2.0 259846 2013-12-24 22:38:24Z jilles $
-
-[ "$(OPTIND=42 ${SH} -c 'printf %s "$OPTIND"')" = 1 ]
diff --git a/bin/cash/tests/parameters/positional1.0 b/bin/cash/tests/parameters/positional1.0
deleted file mode 100644
index f1cf7a04..00000000
--- a/bin/cash/tests/parameters/positional1.0
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional1.0 222158 2011-05-21 14:52:26Z jilles $
-
-set -- a b c d e f g h i j
-[ "$1" = a ] || echo "error at line $LINENO"
-[ "${1}" = a ] || echo "error at line $LINENO"
-[ "${1-foo}" = a ] || echo "error at line $LINENO"
-[ "${1+foo}" = foo ] || echo "error at line $LINENO"
-[ "$1+foo" = a+foo ] || echo "error at line $LINENO"
-[ "$10" = a0 ] || echo "error at line $LINENO"
-[ "$100" = a00 ] || echo "error at line $LINENO"
-[ "${10}" = j ] || echo "error at line $LINENO"
-[ "${10-foo}" = j ] || echo "error at line $LINENO"
-[ "${100-foo}" = foo ] || echo "error at line $LINENO"
diff --git a/bin/cash/tests/parameters/positional2.0 b/bin/cash/tests/parameters/positional2.0
deleted file mode 100644
index 51c9b566..00000000
--- a/bin/cash/tests/parameters/positional2.0
+++ /dev/null
@@ -1,65 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional2.0 228873 2011-12-25 13:24:48Z jilles $
-
-failures=''
-ok=''
-
-testcase() {
-	code="$1"
-	expected="$2"
-	oIFS="$IFS"
-	eval "$code"
-	IFS='|'
-	result="$#|$*"
-	IFS="$oIFS"
-	if [ "x$result" = "x$expected" ]; then
-		ok=x$ok
-	else
-		failures=x$failures
-		echo "For $code, expected $expected actual $result"
-	fi
-}
-
-testcase 'set -- a b; set -- p$@q'		'2|pa|bq'
-testcase 'set -- a b; set -- $@q'		'2|a|bq'
-testcase 'set -- a b; set -- p$@'		'2|pa|b'
-testcase 'set -- a b; set -- p$@q'		'2|pa|bq'
-testcase 'set -- a b; set -- $@q'		'2|a|bq'
-testcase 'set -- a b; set -- p$@'		'2|pa|b'
-testcase 'set -- a b; set -- p$*q'		'2|pa|bq'
-testcase 'set -- a b; set -- $*q'		'2|a|bq'
-testcase 'set -- a b; set -- p$*'		'2|pa|b'
-testcase 'set -- a b; set -- p$*q'		'2|pa|bq'
-testcase 'set -- a b; set -- $*q'		'2|a|bq'
-testcase 'set -- a b; set -- p$*'		'2|pa|b'
-testcase 'set -- a b; set -- "p$@q"'		'2|pa|bq'
-testcase 'set -- a b; set -- "$@q"'		'2|a|bq'
-testcase 'set -- a b; set -- "p$@"'		'2|pa|b'
-testcase 'set -- a b; set -- p"$@"q'		'2|pa|bq'
-testcase 'set -- a b; set -- "$@"q'		'2|a|bq'
-testcase 'set -- a b; set -- p"$@"'		'2|pa|b'
-testcase 'set -- "" a b; set -- "p$@q"'		'3|p|a|bq'
-testcase 'set -- "" a b; set -- "$@q"'		'3||a|bq'
-testcase 'set -- "" a b; set -- "p$@"'		'3|p|a|b'
-testcase 'set -- "" a b; set -- p"$@"q'		'3|p|a|bq'
-testcase 'set -- "" a b; set -- "$@"q'		'3||a|bq'
-testcase 'set -- "" a b; set -- p"$@"'		'3|p|a|b'
-testcase 'set -- a; set -- p$@q'		'1|paq'
-testcase 'set -- a; set -- $@q'			'1|aq'
-testcase 'set -- a; set -- p$@'			'1|pa'
-testcase 'set -- a; set -- p$@q'		'1|paq'
-testcase 'set -- a; set -- $@q'			'1|aq'
-testcase 'set -- a; set -- p$@'			'1|pa'
-testcase 'set -- a; set -- p$*q'		'1|paq'
-testcase 'set -- a; set -- $*q'			'1|aq'
-testcase 'set -- a; set -- p$*'			'1|pa'
-testcase 'set -- a; set -- p$*q'		'1|paq'
-testcase 'set -- a; set -- $*q'			'1|aq'
-testcase 'set -- a; set -- p$*'			'1|pa'
-testcase 'set -- a; set -- "p$@q"'		'1|paq'
-testcase 'set -- a; set -- "$@q"'		'1|aq'
-testcase 'set -- a; set -- "p$@"'		'1|pa'
-testcase 'set -- a; set -- p"$@"q'		'1|paq'
-testcase 'set -- a; set -- "$@"q'		'1|aq'
-testcase 'set -- a; set -- p"$@"'		'1|pa'
-
-test "x$failures" = x
diff --git a/bin/cash/tests/parameters/positional3.0 b/bin/cash/tests/parameters/positional3.0
deleted file mode 100644
index 7baccacb..00000000
--- a/bin/cash/tests/parameters/positional3.0
+++ /dev/null
@@ -1,4 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional3.0 268436 2014-07-08 22:04:44Z jilles $
-
-r=$(${SH} -c 'echo ${01:+yes}${010:+yes}' '' a '' '' '' '' '' '' '' '' b)
-[ "$r" = yesyes ]
diff --git a/bin/cash/tests/parameters/positional4.0 b/bin/cash/tests/parameters/positional4.0
deleted file mode 100644
index 23e6222c..00000000
--- a/bin/cash/tests/parameters/positional4.0
+++ /dev/null
@@ -1,4 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional4.0 268568 2014-07-12 10:27:30Z jilles $
-
-set -- "x$0" 2 3 4 5 6 7 8 9 "y$0"
-[ "${01}.${010}" = "$1.${10}" ]
diff --git a/bin/cash/tests/parameters/positional5.0 b/bin/cash/tests/parameters/positional5.0
deleted file mode 100644
index 434a63f8..00000000
--- a/bin/cash/tests/parameters/positional5.0
+++ /dev/null
@@ -1,14 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional5.0 268576 2014-07-12 21:54:11Z jilles $
-
-i=1
-r=0
-while [ $i -lt $((0x100000000)) ]; do
-	t=
-	eval t=\${$i-x}
-	case $t in
-	x) ;;
-	*) echo "Problem with \${$i}" >&2; r=1 ;;
-	esac
-	i=$((i + 0x10000000))
-done
-exit $r
diff --git a/bin/cash/tests/parameters/positional6.0 b/bin/cash/tests/parameters/positional6.0
deleted file mode 100644
index ee0a53a9..00000000
--- a/bin/cash/tests/parameters/positional6.0
+++ /dev/null
@@ -1,7 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional6.0 273802 2014-10-28 22:14:31Z jilles $
-
-IFS=?
-set p r
-v=pqrs
-r=${v#"$*"}
-[ "$r" = pqrs ]
diff --git a/bin/cash/tests/parameters/positional7.0 b/bin/cash/tests/parameters/positional7.0
deleted file mode 100644
index 9db462b6..00000000
--- a/bin/cash/tests/parameters/positional7.0
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional7.0 273802 2014-10-28 22:14:31Z jilles $
-
-set -- / ''
-IFS=*
-set -- "$*"
-IFS=:
-args="$*"
-[ "$#:$args" = "1:/*" ]
diff --git a/bin/cash/tests/parameters/positional8.0 b/bin/cash/tests/parameters/positional8.0
deleted file mode 100644
index e04ec7c9..00000000
--- a/bin/cash/tests/parameters/positional8.0
+++ /dev/null
@@ -1,31 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional8.0 291025 2015-11-18 21:09:03Z jilles $
-
-failures=''
-ok=''
-
-testcase() {
-	code="$1"
-	expected="$2"
-	oIFS="$IFS"
-	eval "$code"
-	IFS='|'
-	result="$#|$*"
-	IFS="$oIFS"
-	if [ "x$result" = "x$expected" ]; then
-		ok=x$ok
-	else
-		failures=x$failures
-		echo "For $code, expected $expected actual $result"
-	fi
-}
-
-testcase 'shift $#; set -- ""$*'		'1|'
-testcase 'shift $#; set -- $*""'		'1|'
-testcase 'shift $#; set -- ""$@'		'1|'
-testcase 'shift $#; set -- $@""'		'1|'
-testcase 'shift $#; set -- """$*"'		'1|'
-testcase 'shift $#; set -- "$*"""'		'1|'
-testcase 'shift $#; set -- """$@"'		'1|'
-testcase 'shift $#; set -- "$@"""'		'1|'
-
-test "x$failures" = x
diff --git a/bin/cash/tests/parameters/positional9.0 b/bin/cash/tests/parameters/positional9.0
deleted file mode 100644
index 7bf09241..00000000
--- a/bin/cash/tests/parameters/positional9.0
+++ /dev/null
@@ -1,18 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/positional9.0 291903 2015-12-06 14:09:31Z jilles $
-# Although POSIX leaves the result of expanding ${#@} and ${#*} unspecified,
-# make sure it is at least numeric.
-
-set -- bb cc ddd
-set -f
-lengths=${#*}${#@}"${#*}${#@}"$(echo ${#*}${#@}"${#*}${#@}")
-IFS=
-lengths=$lengths${#*}${#@}"${#*}${#@}"$(echo ${#*}${#@}"${#*}${#@}")
-case $lengths in
-*[!0-9]*)
-	printf 'bad: %s\n' "$lengths"
-	exit 3 ;;
-????????????????*) ;;
-*)
-	printf 'too short: %s\n' "$lengths"
-	exit 3 ;;
-esac
diff --git a/bin/cash/tests/parameters/pwd1.0 b/bin/cash/tests/parameters/pwd1.0
deleted file mode 100644
index d06238f7..00000000
--- a/bin/cash/tests/parameters/pwd1.0
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/pwd1.0 213738 2010-10-12 18:20:38Z obrien $
-# Check that bogus PWD values are not accepted from the environment.
-
-cd / || exit 3
-failures=0
-[ "$(PWD=foo ${SH} -c 'pwd')" = / ] || : $((failures += 1))
-[ "$(PWD=/var/empty ${SH} -c 'pwd')" = / ] || : $((failures += 1))
-[ "$(PWD=/var/empty/foo ${SH} -c 'pwd')" = / ] || : $((failures += 1))
-[ "$(PWD=/bin/ls ${SH} -c 'pwd')" = / ] || : $((failures += 1))
-
-exit $((failures != 0))
diff --git a/bin/cash/tests/parameters/pwd2.0 b/bin/cash/tests/parameters/pwd2.0
deleted file mode 100644
index 29ffab46..00000000
--- a/bin/cash/tests/parameters/pwd2.0
+++ /dev/null
@@ -1,24 +0,0 @@
-# $FreeBSD: releng/12.0/bin/sh/tests/parameters/pwd2.0 213738 2010-10-12 18:20:38Z obrien $
-# Check that PWD is exported and accepted from the environment.
-set -e
-
-T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
-trap 'rm -rf $T' 0
-cd -P $T
-TP=$(pwd)
-mkdir test1
-ln -s test1 link
-cd link
-[ "$PWD" = "$TP/link" ]
-[ "$(pwd)" = "$TP/link" ]
-[ "$(pwd -P)" = "$TP/test1" ]
-[ "$(${SH} -c pwd)" = "$TP/link" ]
-[ "$(${SH} -c pwd\ -P)" = "$TP/test1" ]
-cd ..
-[ "$(pwd)" = "$TP" ]
-cd -P link
-[ "$PWD" = "$TP/test1" ]
-[ "$(pwd)" = "$TP/test1" ]
-[ "$(pwd -P)" = "$TP/test1" ]
-[ "$(${SH} -c pwd)" = "$TP/test1" ]
-[ "$(${SH} -c pwd\ -P)" = "$TP/test1" ]