]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: nproc: ensure scheduler and OMP_NUM_THREADS are independent
authorPádraig Brady <P@draigBrady.com>
Sat, 13 Jun 2026 14:50:53 +0000 (23:50 +0900)
committerPádraig Brady <P@draigBrady.com>
Thu, 18 Jun 2026 14:38:18 +0000 (15:38 +0100)
* tests/nproc/nproc-quota-systemd.sh: Explicitly set OMP_NUM_THREADS
to an ignorable value, to ensure scheduler processing is independent.
* tests/nproc/nproc-quota.sh: Likewise for the SCHED_FIFO check.
https://github.com/coreutils/coreutils/pull/290

tests/nproc/nproc-quota-systemd.sh
tests/nproc/nproc-quota.sh

index 4d8add99380ef36b8c651ee54ad59b181a31d9e0..7b95dea55b0e3cd0d70fdea77615cec6035e5de8 100755 (executable)
@@ -31,7 +31,10 @@ check_sched_quota()
   pct=$1; shift
 
   if systemd-run --scope -q -p CPUQuota=$pct chrt $* true; then
-    test $(systemd-run --scope -q -p CPUQuota=$pct chrt $* nproc) = $cpu ||
+    test $(systemd-run --scope -q -p CPUQuota=$pct \
+           chrt $* \
+           env OMP_NUM_THREADS=0 \
+           nproc) = $cpu ||
      return 1
   fi
   return 0
index 0d49231338045bec1c86d22fca5869c1f6b22a8f..f5f67565f8789067fc22d05af42628c2facd8a19 100755 (executable)
@@ -116,7 +116,7 @@ test $(OMP_NUM_THREADS=$ncpus NPROC) -eq $ncpus || fail=1
 
 echo '100000 100000' > $ROOT/sys/fs/cgroup/cpu.max &&
 echo 'policy   :   1' > $ROOT/proc/self/sched && # No quota for SCHED_FIFO
-test $(NPROC) -eq $ncpus || fail=1
+test $(OMP_NUM_THREADS= NPROC) -eq $ncpus || fail=1
 echo 'policy   :   2' > $ROOT/proc/self/sched && # No quota for SCHED_RR
 test $(NPROC) -eq $ncpus || fail=1
 echo 'policy   :   6' > $ROOT/proc/self/sched && # No quota for SCHED_DEADLINE