Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/bin/sh Finish TEST_SH - all tests should support it now.
details: https://anonhg.NetBSD.org/src/rev/e8bbbd48a1b8
branches: trunk
changeset: 344416:e8bbbd48a1b8
user: christos <christos%NetBSD.org@localhost>
date: Sun Mar 27 14:50:01 2016 +0000
description:
Finish TEST_SH - all tests should support it now.
Misc other KNF changes, minor bug fixes, and a few minor
extra tests added. (from kre@)
diffstat:
tests/bin/sh/t_evaltested.sh | 6 ++++--
tests/bin/sh/t_fsplit.sh | 7 ++++++-
tests/bin/sh/t_set_e.sh | 6 +++---
tests/bin/sh/t_ulimit.sh | 12 ++++++------
tests/bin/sh/t_varquote.sh | 3 +--
5 files changed, 20 insertions(+), 14 deletions(-)
diffs (127 lines):
diff -r 2ebe6cccc33a -r e8bbbd48a1b8 tests/bin/sh/t_evaltested.sh
--- a/tests/bin/sh/t_evaltested.sh Sun Mar 27 14:49:07 2016 +0000
+++ b/tests/bin/sh/t_evaltested.sh Sun Mar 27 14:50:01 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_evaltested.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
+# $NetBSD: t_evaltested.sh,v 1.2 2016/03/27 14:50:01 christos Exp $
#
# Copyright (c) 2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -24,6 +24,8 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
+# the implementation of "sh" to test
+: ${TEST_SH:="/bin/sh"}
atf_test_case evaltested
@@ -43,7 +45,7 @@
echo "passed"
exit 0
EOF
- output="$(/bin/sh helper.sh)"
+ output="$($TEST_SH helper.sh)"
[ $? = 0 ] && return
if [ -n "$output" ]
diff -r 2ebe6cccc33a -r e8bbbd48a1b8 tests/bin/sh/t_fsplit.sh
--- a/tests/bin/sh/t_fsplit.sh Sun Mar 27 14:49:07 2016 +0000
+++ b/tests/bin/sh/t_fsplit.sh Sun Mar 27 14:50:01 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_fsplit.sh,v 1.3 2016/03/10 22:30:57 christos Exp $
+# $NetBSD: t_fsplit.sh,v 1.4 2016/03/27 14:50:01 christos Exp $
#
# Copyright (c) 2007-2016 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -294,6 +294,11 @@
'zaz zbz zcz'
check 'set " a b " c; for i in "$@"; do echo "z${i}z"; done' \
'z a b z zcz'
+
+ check 'set a b c; for i in "$@$@"; do echo "z${i}z"; done' \
+ 'zaz zbz zcaz zbz zcz'
+ check 'set a b c; for i in "$@""$@";do echo "z${i}z"; done' \
+ 'zaz zbz zcaz zbz zcz'
}
atf_test_case ifs
diff -r 2ebe6cccc33a -r e8bbbd48a1b8 tests/bin/sh/t_set_e.sh
--- a/tests/bin/sh/t_set_e.sh Sun Mar 27 14:49:07 2016 +0000
+++ b/tests/bin/sh/t_set_e.sh Sun Mar 27 14:50:01 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_set_e.sh,v 1.2 2016/03/08 14:20:22 christos Exp $
+# $NetBSD: t_set_e.sh,v 1.3 2016/03/27 14:50:01 christos Exp $
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -81,8 +81,8 @@
# first, check basic functioning.
# The ERR shouldn't print; the result of the () should be 1.
# Henceforth we'll assume that we don't need to check $?.
- dcheck '(set -e; false; echo ERR$?); echo -n OK$?' 'OK1'
- echeck '(set -e; false; echo ERR$?); echo -n OK$?' 'OK1'
+ dcheck '(set -e; false; echo ERR$?); echo OK$?' 'OK1'
+ echeck '(set -e; false; echo ERR$?); echo OK$?' 'OK1'
# these cases should be equivalent to the preceding.
dcheck '(set -e; /nonexistent; echo ERR); echo OK' 'OK'
diff -r 2ebe6cccc33a -r e8bbbd48a1b8 tests/bin/sh/t_ulimit.sh
--- a/tests/bin/sh/t_ulimit.sh Sun Mar 27 14:49:07 2016 +0000
+++ b/tests/bin/sh/t_ulimit.sh Sun Mar 27 14:50:01 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ulimit.sh,v 1.2 2015/12/30 22:24:44 christos Exp $
+# $NetBSD: t_ulimit.sh,v 1.3 2016/03/27 14:50:01 christos Exp $
#
# Copyright (c) 2012 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -24,6 +24,8 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
+# the implementation of "sh" to test
+: ${TEST_SH:="/bin/sh"}
# ulimit builtin test.
@@ -33,7 +35,7 @@
}
get_ulimits() {
- local limits=$(ulimit -a |
+ local limits=$(${TEST_SH} -c 'ulimit -a' |
sed -e 's/.*\(-[A-Za-z0-9]\)[^A-Za-z0-9].*/\1/' | sort -u)
if [ -z "$limits" ]; then
# grr ksh
@@ -43,12 +45,10 @@
}
limits_body() {
- atf_check -s eq:0 -o ignore -e empty \
- /bin/sh -c "ulimit -a"
+ atf_check -s eq:0 -o ignore -e empty ${TEST_SH} -c "ulimit -a"
for l in $(get_ulimits)
do
- atf_check -s eq:0 -o ignore -e empty \
- /bin/sh -c "ulimit $l"
+ atf_check -s eq:0 -o ignore -e empty ${TEST_SH} -c "ulimit $l"
done
}
diff -r 2ebe6cccc33a -r e8bbbd48a1b8 tests/bin/sh/t_varquote.sh
--- a/tests/bin/sh/t_varquote.sh Sun Mar 27 14:49:07 2016 +0000
+++ b/tests/bin/sh/t_varquote.sh Sun Mar 27 14:50:01 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_varquote.sh,v 1.4 2016/03/12 14:58:03 christos Exp $
+# $NetBSD: t_varquote.sh,v 1.5 2016/03/27 14:50:01 christos Exp $
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -125,7 +125,6 @@
default_assignment_with_arith_body() {
atf_check -s eq:0 -o empty -e empty ${TEST_SH} -c ': "${x=$((1))}"'
atf_check -s eq:0 -o match:1 -e empty ${TEST_SH} -c 'echo "${x=$((1))}"'
-
}
atf_init_test_cases() {
Home |
Main Index |
Thread Index |
Old Index