Bruno Haible via GNU coreutils Bug Reports <bug-coreutils@gnu.org> writes:
> Today's CI run produces a > FAIL: tests/nproc/nproc-quota > on CentOS 7 and on Alpine Linux. > > Here are the two relevant log file portions. Thanks. The Alpine one fails because sched_getscheduler is a stub that always fails. I'm fine with just skipping that one with the attached patch. This causes cpu_quota to always return ULONG_MAX. The CentOS 7 one fails because SCHED_DEADLINE is not defined by sched.h. But it is defined in linux/sched.h. The second patch, which is for Gnulib, fixed it in my CentOS 7 container. Will let others check before pushing. I don't know much about cgroups and whether CentOS 7 is too old for this test to matter. Collin
>From f1839652a52d3fd3e66b92800e41c0a8dbc0d9e0 Mon Sep 17 00:00:00 2001 Message-ID: <f1839652a52d3fd3e66b92800e41c0a8dbc0d9e0.1756029169.git.collin.fu...@gmail.com> From: Collin Funk <collin.fu...@gmail.com> Date: Sun, 24 Aug 2025 02:03:51 -0700 Subject: [PATCH] tests: nproc: skip test for cgroup quotas on systems using musl * tests/nproc/nproc-quota.sh: Skip the test on systems using musl. --- tests/nproc/nproc-quota.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/nproc/nproc-quota.sh b/tests/nproc/nproc-quota.sh index 236a1a83b..51eb68226 100755 --- a/tests/nproc/nproc-quota.sh +++ b/tests/nproc/nproc-quota.sh @@ -20,6 +20,11 @@ print_ver_ nproc require_root_ +case $host_triplet in + *-musl*) skip_ 'cannot determine the scheduling policy on this platform' ;; + *) ;; +esac + # We could look for modifiable cgroup quotas on the current system, # but that would be dangerous to modify and restore robustly. # Instead simulate the queried cgroup files in a chroot. -- 2.51.0
>From 0e55287144d5caa41b46dc99e314197a65d6b2f1 Mon Sep 17 00:00:00 2001 Message-ID: <0e55287144d5caa41b46dc99e314197a65d6b2f1.1756029192.git.collin.fu...@gmail.com> From: Collin Funk <collin.fu...@gmail.com> Date: Sun, 24 Aug 2025 02:51:40 -0700 Subject: [PATCH] nproc: Fix missing SCHED_DEADLINE definition on CentOS 7. Reported by Bruno Haible in: <https://bugs.gnu.org/79299>. * nproc [__linux__]: Include linux/sched.h. --- ChangeLog | 7 +++++++ lib/nproc.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5f36b7a186..892d671d04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-08-24 Collin Funk <collin.fu...@gmail.com> + + nproc: Fix missing SCHED_DEADLINE definition on CentOS 7. + Reported by Bruno Haible in: + <https://bugs.gnu.org/79299>. + * nproc [__linux__]: Include linux/sched.h. + 2024-08-23 Bruno Haible <br...@clisp.org> gen-uni-tables: Update a comment. diff --git a/lib/nproc.c b/lib/nproc.c index 7c5ae3acf9..427b25260f 100644 --- a/lib/nproc.c +++ b/lib/nproc.c @@ -35,6 +35,9 @@ # include <sched.h> #endif #if HAVE_SCHED_GETAFFINITY_LIKE_GLIBC || HAVE_SCHED_GETAFFINITY_NP +# if defined __linux__ +# include <linux/sched.h> +# endif # include <sched.h> #endif -- 2.51.0