On 8/9/26 4:21 AM, Rui Qi wrote:
The cpuset selftests use awk -e to parse cgroup mount points. This
works with gawk, but mawk rejects the option. In test_cpuset_prs.sh,
this leaves CGROUP2 empty and causes the test to skip as if cgroup v2
were not mounted. The same non-portable invocation exists in the cpuset
v1 hotplug test.

The scripts only need to pass a single awk program. Use the standard awk
invocation without -e so mount point detection works with awk
implementations that do not support the gawk extension.

Fixes: a8c52eba880a ("kselftest/cgroup: Add cpuset v2 partition root state 
test")
Fixes: 812c5945bdb8 ("cgroup/cpuset: Add test_cpuset_v1_hp.sh")
Signed-off-by: Rui Qi <[email protected]>
---
  tools/testing/selftests/cgroup/test_cpuset_prs.sh   | 2 +-
  tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh 
b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 400a696a0d21..16c38eb11e63 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -20,7 +20,7 @@ skip_test() {
  WAIT_INOTIFY=$(cd $(dirname $0); pwd)/wait_inotify
# Find cgroup v2 mount point
-CGROUP2=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
+CGROUP2=$(mount -t cgroup2 | head -1 | awk '{print $3}')
  [[ -n "$CGROUP2" ]] || skip_test "Cgroup v2 mount point not found!"
  SUBPARTS_CPUS=$CGROUP2/.__DEBUG__.cpuset.cpus.subpartitions
  CPULIST=$(cat $CGROUP2/cpuset.cpus.effective)
diff --git a/tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh 
b/tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh
index 7406c24be1ac..da97f1643f9a 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh
@@ -14,7 +14,7 @@ skip_test() {
  [[ $(id -u) -eq 0 ]] || skip_test "Test must be run as root!"
# Find cpuset v1 mount point
-CPUSET=$(mount -t cgroup | grep cpuset | head -1 | awk -e '{print $3}')
+CPUSET=$(mount -t cgroup | grep cpuset | head -1 | awk '{print $3}')
  [[ -n "$CPUSET" ]] || skip_test "cpuset v1 mount point not found!"
#

The test systems that I used have gawk. That is why I don't have this problem. Anyway, I support to make it more usable with other systems that use mawk.

Acked-by: Waiman Long <[email protected]>


Reply via email to