summaryrefslogtreecommitdiff
path: root/tests/misc/nice
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc/nice')
-rwxr-xr-xtests/misc/nice22
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