Skip to content

Commit

Permalink
[test] CPU affinity inheritance
Browse files Browse the repository at this point in the history
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Jan 9, 2025
1 parent 81b1317 commit 9f1df2f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/exec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,25 @@ EOF
[ ${#lines[@]} -eq 1 ]
[[ ${lines[0]} = *"exec /run.sh: no such file or directory"* ]]
}

@test "runc exec [CPU affinity inherited from runc]" {
requires root smp cgroups_cpuset

first=0 # First CPU

# Container's process CPU affinity is inherited from that of runc.
taskset -p -c "$first" $$

runc run -d --console-socket "$CONSOLE_SOCKET" ct1
[ "$status" -eq 0 ]

# Check init.
runc exec ct1 grep "Cpus_allowed_list:" /proc/1/status
[ "$status" -eq 0 ]
[[ "${lines[0]}" == "Cpus_allowed_list: $first" ]]

# Check exec.
runc exec ct1 grep "Cpus_allowed_list:" /proc/self/status
[ "$status" -eq 0 ]
[[ "${lines[0]}" == "Cpus_allowed_list: $first" ]]
}

0 comments on commit 9f1df2f

Please sign in to comment.