From: Pádraig Brady Date: Sat, 13 Jun 2026 14:50:53 +0000 (+0900) Subject: tests: nproc: ensure scheduler and OMP_NUM_THREADS are independent X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5800d917210de320bc884cd45b176a7f6864192b;p=thirdparty%2Fcoreutils.git tests: nproc: ensure scheduler and OMP_NUM_THREADS are independent * 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 --- diff --git a/tests/nproc/nproc-quota-systemd.sh b/tests/nproc/nproc-quota-systemd.sh index 4d8add9938..7b95dea55b 100755 --- a/tests/nproc/nproc-quota-systemd.sh +++ b/tests/nproc/nproc-quota-systemd.sh @@ -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 diff --git a/tests/nproc/nproc-quota.sh b/tests/nproc/nproc-quota.sh index 0d49231338..f5f67565f8 100755 --- a/tests/nproc/nproc-quota.sh +++ b/tests/nproc/nproc-quota.sh @@ -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