]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: nproc: support referencing of external command
authoroech3 <79379754+oech3@users.noreply.github.com>
Fri, 3 Jul 2026 01:00:30 +0000 (10:00 +0900)
committerPádraig Brady <P@draigBrady.com>
Fri, 3 Jul 2026 09:51:57 +0000 (10:51 +0100)
* tests/nproc/nproc-quota.sh: Use command -v nproc instead of
$abs_top_builddir for external usage of tests.
Also quote "$nproc" usage, to support spaces in path.

Link: https://github.com/coreutils/coreutils/pull/310
tests/nproc/nproc-quota.sh

index e8c24bcde07cae73da71ceb747f6c9caf7b61fa8..c950ecae939e5bee51159b097d7a8f9357ebed7f 100755 (executable)
@@ -44,10 +44,10 @@ ROOT=cgroup
   echo 'max 100000' > $ROOT/sys/fs/cgroup/foo/cpu.max  # ignored
 } || framework_failure_
 
-nproc=$abs_top_builddir/src/nproc$EXEEXT
-cp --parents $(ldd $nproc | grep -o '/[^ ]*') $ROOT ||
+nproc=$(command -v nproc)
+cp --parents $(ldd "$nproc" | grep -o '/[^ ]*') $ROOT ||
   skip_ 'Failed to copy nproc libs to chroot'
-cp $nproc $ROOT || framework_failure_
+cp "$nproc" $ROOT || framework_failure_
 
 NPROC() {
   IFS=': ' read key policy < $ROOT/proc/self/sched