From 4a8750d93aabe2b0e76f2336c256c8aa2b47943e Mon Sep 17 00:00:00 2001 From: "Chengen, Du" Date: Mon, 3 Oct 2022 10:07:08 +0800 Subject: [PATCH] tests/int: add a "update cpuset cpus range via v2 unified map" test Add a test case for an issue fixed by the previous commit. The env should has more than 8 core CPU to meet the test requirement. Signed-off-by: Chengen, Du --- tests/integration/helpers.bash | 7 +++++++ tests/integration/update.bats | 27 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/tests/integration/helpers.bash b/tests/integration/helpers.bash index ee93c42b479..a9b70ffd887 100644 --- a/tests/integration/helpers.bash +++ b/tests/integration/helpers.bash @@ -457,6 +457,13 @@ function requires() { skip_me=1 fi ;; + more_than_8_core) + local cpus + cpus=$(grep -c '^processor' /proc/cpuinfo) + if [ "$cpus" -le 8 ]; then + skip_me=1 + fi + ;; *) fail "BUG: Invalid requires $var." ;; diff --git a/tests/integration/update.bats b/tests/integration/update.bats index 1937006fd00..d2489009304 100644 --- a/tests/integration/update.bats +++ b/tests/integration/update.bats @@ -557,6 +557,33 @@ EOF check_systemd_value "AllowedMemoryNodes" 1 } +@test "update cpuset cpus range via v2 unified map" { + # This test assumes systemd >= v244 + [ $EUID -ne 0 ] && requires rootless_cgroup + requires systemd cgroups_v2 more_than_8_core cgroups_cpuset + + update_config ' .linux.resources.unified |= { + "cpuset.cpus": "0-5", + }' + runc run -d --console-socket "$CONSOLE_SOCKET" test_update + [ "$status" -eq 0 ] + + # check that the initial value was properly set + check_systemd_value "AllowedCPUs" "0-5" + + runc update -r - test_update <