Module Name: src Committed By: christos Date: Wed Dec 30 22:24:44 UTC 2015
Modified Files: src/tests/bin/sh: t_ulimit.sh Log Message: more robust ulimit test that works with most variants of bourne shells. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/bin/sh/t_ulimit.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/bin/sh/t_ulimit.sh diff -u src/tests/bin/sh/t_ulimit.sh:1.1 src/tests/bin/sh/t_ulimit.sh:1.2 --- src/tests/bin/sh/t_ulimit.sh:1.1 Mon Jun 11 14:32:59 2012 +++ src/tests/bin/sh/t_ulimit.sh Wed Dec 30 17:24:44 2015 @@ -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 @@ atf_test_case limits 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"