Files
runc/tests/integration/personality.bats
T
Zheao.Li 98511bb40e linux: Support setting execution domain via linux personality
carry #3126

Co-authored-by: Aditya R <arajan@redhat.com>
Signed-off-by: Zheao.Li <me@manjusaka.me>
2023-10-27 19:33:37 +08:00

65 lines
1.3 KiB
Bash

#!/usr/bin/env bats
load helpers
function setup() {
requires arch_x86_64
setup_busybox
}
function teardown() {
teardown_bundle
}
@test "runc run personality for i686" {
update_config '
.process.args = ["/bin/sh", "-c", "uname -a"]
| .linux.personality = {
"domain": "LINUX32",
"flags": []
}'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "$output" == *"i686"* ]]
}
@test "runc run personality with exec for i686" {
update_config '
.linux.personality = {
"domain": "LINUX32",
}'
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]
runc exec test_busybox /bin/sh -c "uname -a"
[ "$status" -eq 0 ]
[[ "$output" == *"i686"* ]]
}
@test "runc run personality for x86_64" {
update_config '
.process.args = ["/bin/sh", "-c", "uname -a"]
| .linux.personality = {
"domain": "LINUX",
"flags": []
}'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "$output" == *"x86_64"* ]]
}
@test "runc run personality with exec for x86_64" {
update_config '
.linux.personality = {
"domain": "LINUX",
}'
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]
runc exec test_busybox /bin/sh -c "uname -a"
[ "$status" -eq 0 ]
[[ "$output" == *"x86_64"* ]]
}