Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/bin/sh more robust ulimit test that works with most va...



details:   https://anonhg.NetBSD.org/src/rev/2a240b9b7379
branches:  trunk
changeset: 342593:2a240b9b7379
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 30 22:24:44 2015 +0000

description:
more robust ulimit test that works with most variants of bourne shells.

diffstat:

 tests/bin/sh/t_ulimit.sh |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 0e8c3dc0721f -r 2a240b9b7379 tests/bin/sh/t_ulimit.sh
--- a/tests/bin/sh/t_ulimit.sh  Wed Dec 30 22:23:38 2015 +0000
+++ b/tests/bin/sh/t_ulimit.sh  Wed Dec 30 22:24:44 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ulimit.sh,v 1.1 2012/06/11 18:32:59 njoly Exp $
+# $NetBSD: t_ulimit.sh,v 1.2 2015/12/30 22:24:44 christos Exp $
 #
 # Copyright (c) 2012 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,10 +31,21 @@
 limits_head() {
        atf_set "descr" "Checks for limits flags"
 }
+
+get_ulimits() {
+       local limits=$(ulimit -a |
+           sed -e 's/.*\(-[A-Za-z0-9]\)[^A-Za-z0-9].*/\1/' | sort -u)
+       if [ -z "$limits" ]; then
+               # grr ksh
+               limits="-a -b -c -d -f -l -m -n -p -r -s -t -v"
+       fi
+       echo "$limits"
+}
+
 limits_body() {
        atf_check -s eq:0 -o ignore -e empty \
            /bin/sh -c "ulimit -a"
-       for l in $(ulimit -a | sed 's,^.*(,,;s, .*$,,');
+       for l in $(get_ulimits)
        do
            atf_check -s eq:0 -o ignore -e empty \
                /bin/sh -c "ulimit $l"



Home | Main Index | Thread Index | Old Index