diff options
author | Eric Blake <ebb9@byu.net> | 2009-10-23 11:01:25 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-10-23 16:32:26 -0600 |
commit | 30e4b6e84b7e478121a645515ce891d29cc75105 (patch) | |
tree | 57e06495031b200089de106fbf28ac611554eb4f /tests/misc/nice | |
parent | 2122247acae6672e2dcfba095dc84cf84bc8ef41 (diff) | |
download | coreutils-30e4b6e84b7e478121a645515ce891d29cc75105.tar.xz |
tests: test recent status changes
* tests/misc/nice: Enhance test.
* tests/misc/chroot-fail: New test.
* tests/misc/env: Likewise.
* tests/misc/nice-fail: Likewise.
* tests/misc/su-fail: Likewise.
* tests/Makefile.am (TESTS): Run new tests.
Diffstat (limited to 'tests/misc/nice')
-rwxr-xr-x | tests/misc/nice | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/misc/nice b/tests/misc/nice index 1cdd56a10..f271eb446 100755 --- a/tests/misc/nice +++ b/tests/misc/nice @@ -48,11 +48,6 @@ NA LAST NA ' set $tests -if test "$VERBOSE" = yes; then - nice --version - set -x -fi - # Require that this test be run at `nice' level 0. niceness=`nice` if test "$niceness" = 0; then @@ -76,8 +71,23 @@ while :; do test x`nice $args nice 2> /dev/null` = x$expected_result \ && ok=ok || ok=FAIL fail=1 test "$VERBOSE" = yes && echo $ok - test x`nice $args nice 2> /dev/null` = x$expected_result || fail=1 shift; shift; shift done +# Test negative niceness - command must be run whether or not change happens. +if test `nice -n -1 nice 2> /dev/null` = 0 ; then + # unprivileged user - warn about failure to change + nice -n -1 true 2> err || fail=1 + test -s err || fail=1 + mv err exp || framework_failure + nice --1 true 2> err || fail=1 + compare exp err || fail=1 +else + # superuser - change succeeds + nice -n -1 nice 2> err || fail=1 + test -s err && fail=1 + test `nice -n -1 nice` = -1 || fail=1 + test `nice --1 nice` = -1 || fail=1 +fi + Exit $fail |