mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
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 <chengen.du@canonical.com>
(cherry picked from commit 4a8750d93a)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
committed by
Kir Kolyshkin
parent
26a58fdb8b
commit
165d2323a0
@@ -455,6 +455,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."
|
||||
;;
|
||||
|
||||
@@ -559,6 +559,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 <<EOF
|
||||
{
|
||||
"unified": {
|
||||
"cpuset.cpus": "5-8"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
# check the updated systemd unit property, the value should not be affected by byte order
|
||||
check_systemd_value "AllowedCPUs" "5-8"
|
||||
}
|
||||
|
||||
@test "update rt period and runtime" {
|
||||
[[ "$ROOTLESS" -ne 0 ]] && requires rootless_cgroup
|
||||
requires cgroups_v1 cgroups_rt no_systemd
|
||||
|
||||
Reference in New Issue
Block a user