Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/bin/sh Avoid relying on the test shell correctly imple...
details: https://anonhg.NetBSD.org/src/rev/2ebe6cccc33a
branches: trunk
changeset: 344415:2ebe6cccc33a
user: christos <christos%NetBSD.org@localhost>
date: Sun Mar 27 14:49:07 2016 +0000
description:
Avoid relying on the test shell correctly implementing $(( ))
in order for some of the redirect tests to terminate. (from kre@)
diffstat:
tests/bin/sh/t_redir.sh | 35 ++++++++++++++---------------------
1 files changed, 14 insertions(+), 21 deletions(-)
diffs (108 lines):
diff -r 68b966fda4b0 -r 2ebe6cccc33a tests/bin/sh/t_redir.sh
--- a/tests/bin/sh/t_redir.sh Sun Mar 27 14:40:20 2016 +0000
+++ b/tests/bin/sh/t_redir.sh Sun Mar 27 14:49:07 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_redir.sh,v 1.4 2016/03/08 14:26:54 christos Exp $
+# $NetBSD: t_redir.sh,v 1.5 2016/03/27 14:49:07 christos Exp $
#
# Copyright (c) 2016 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -122,9 +122,7 @@
cat <<- 'EOF' |
- i=0
- while [ "$i" -lt 3 ]; do
- i=$((i + 1))
+ for l in 1 2 3; do
read line < File
echo "$line"
done
@@ -134,9 +132,7 @@
${TEST_SH}
cat <<- 'EOF' |
- i=0
- while [ "$i" -lt 3 ]; do
- i=$((i + 1))
+ for l in 1 2 3; do
read line
echo "$line"
done <File
@@ -146,9 +142,7 @@
${TEST_SH}
cat <<- 'EOF' |
- i=0
- while [ "$i" -lt 3 ]; do
- i=$((i + 1))
+ for l in 1 2 3; do
read line < File
echo "$line"
done <File
@@ -179,12 +173,12 @@
${TEST_SH}
cat <<- 'EOF' |
- i=0
+ l=''
while read line < File
do
echo "$line"
- i=$((i + 1))
- [ ${i} -ge 3 ] && break
+ l="${l}x"
+ [ ${#l} -ge 3 ] && break
done
echo DONE
EOF
@@ -193,7 +187,6 @@
${TEST_SH}
cat <<- 'EOF' |
- i=0
while read line
do
echo "$line"
@@ -205,12 +198,12 @@
${TEST_SH}
cat <<- 'EOF' |
- i=0
+ l=''
while read line
do
echo "$line"
- i=$((i + 1))
- [ ${i} -ge 3 ] && break
+ l="${l}x"
+ [ ${#l} -ge 3 ] && break
done <File
echo DONE
EOF
@@ -218,13 +211,13 @@
-o inline:'First Line\nSecond Line\nLine 3\nDONE\n' ${TEST_SH}
cat <<- 'EOF' |
- i=0
+ l=''
while read line1 <File
do
read line2
echo "$line1":"$line2"
- i=$((i + 1))
- [ ${i} -ge 2 ] && break
+ l="${l}x"
+ [ ${#l} -ge 2 ] && break
done <File
echo DONE
EOF
@@ -243,7 +236,7 @@
nl='
'
T=0
- i() { T=$(($T + 1)); }
+ i() { T=$(expr "$T" + 1); }
rm -f Output 2>/dev/null || :
test -f Output && atf_fail "Unable to remove Output file"
Home |
Main Index |
Thread Index |
Old Index