diff options
author | Jim Meyering <meyering@redhat.com> | 2007-11-01 12:06:11 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2007-11-01 12:06:11 +0100 |
commit | 094e533fadd92aa9c488d5c3ad8de11036798126 (patch) | |
tree | 52b97e725f2b0827bf4fc31d974dc340a321f190 /tests/test-lib.sh | |
parent | accad81d2beca73a1212f09564d36f86492e6c97 (diff) | |
download | coreutils-094e533fadd92aa9c488d5c3ad8de11036798126.tar.xz |
Make the new printf-surprise test more precise.
* tests/test-lib.sh (require_ulimit_): New function.
* tests/misc/printf-surprise: Use ulimit -v to trigger the fixed bug,
and rather than checking printf's exit status (which would go wrong
on FreeBSD 6.1, since their printf(3) function doesn't require
lots of memory in this case) simply test whether it outputs
the first 10 bytes.
Diffstat (limited to 'tests/test-lib.sh')
-rw-r--r-- | tests/test-lib.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 66fbc1dc4..495fd2a05 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -14,6 +14,21 @@ skip_test_() (exit 77); exit 77 } +require_ulimit_() +{ + ulimit_works=yes + # Expect to be able to exec a program in 10MB of virtual memory, + # but not in 20KB. I chose "date". It must not be a shell built-in + # function, so you can't use echo, printf, true, etc. + # Of course, in coreutils, I could use $top_builddir/src/true, + # but this should be able to work for other projects, too. + ( ulimit -v 10000; date ) > /dev/null 2>&1 || ulimit_works=no + ( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=no + + test $ulimit_works = no \ + && skip_test_ "this shell lacks ulimit support" +} + uid_is_privileged_() { # Make sure id -u succeeds. |