]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: nice: ensure large values are clamped
authoroech3 <79379754+oech3@users.noreply.github.com>
Tue, 13 Jan 2026 14:10:23 +0000 (14:10 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 13 Jan 2026 14:20:13 +0000 (14:20 +0000)
* tests/nice/nice.sh: Ensure integers > UINTMAX_MAX are supported.
From https://github.com/coreutils/coreutils/pull/170

tests/nice/nice.sh

index 09c35adca8012787b5351e8cd36b68093f29331f..3badb01861dd7022648776989d49f30d94a1cc44 100755 (executable)
@@ -74,7 +74,7 @@ done
 if test x$(nice -n -1 nice 2> /dev/null) = x0 ; then
   # GNU/Hurd does not allow negative niceness even if we are a privileged user.
   if test "$(uname)" = GNU; then
-    max_nice=$(nice -n "$INT_MAX" nice) || framework_failure_
+    max_nice=$(nice -n "$INT_MAX" nice) || fail=1
     # Check that the lowest niceness is 0.
     nice -n -1 nice > out || fail=1
     echo '0' > exp || framework_failure_
@@ -120,4 +120,7 @@ else
   test x$(nice --1 nice) = x-1 || fail=1
 fi
 
+# Ensure large values are clamped
+nice -n $UINTMAX_OFLOW nice || fail=1
+
 Exit $fail