From 1c3b06721812a8a70dd05d645e52131382b3d849 Mon Sep 17 00:00:00 2001 From: lfbzhm Date: Thu, 18 Jan 2024 15:31:57 +0000 Subject: [PATCH] test for execve error without runc-dmz Signed-off-by: lfbzhm --- tests/integration/exec.bats | 13 +++++++++++++ tests/integration/run.bats | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/integration/exec.bats b/tests/integration/exec.bats index 069214cc956..9cfcaf1d886 100644 --- a/tests/integration/exec.bats +++ b/tests/integration/exec.bats @@ -322,3 +322,16 @@ function check_exec_debug() { runc exec --cgroup second test_busybox grep -w second /proc/self/cgroup [ "$status" -eq 0 ] } + +@test "RUNC_DMZ=legacy runc exec [execve error]" { + cat <rootfs/run.sh +#!/mmnnttbb foo bar +sh +EOF + chmod +x rootfs/run.sh + RUNC_DMZ=legacy runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox + RUNC_DMZ=legacy runc exec -t test_busybox /run.sh + [ "$status" -ne 0 ] + [ ${#lines[@]} -eq 1 ] + [[ ${lines[0]} = *"exec failed: unable to start container process: exec /run.sh: no such file or directory"* ]] +} diff --git a/tests/integration/run.bats b/tests/integration/run.bats index bf23d22a103..f0eb283040a 100644 --- a/tests/integration/run.bats +++ b/tests/integration/run.bats @@ -247,3 +247,16 @@ EOF [ "$status" -ne 0 ] [[ "$output" = *"exec /run.sh: "* ]] } + +@test "RUNC_DMZ=legacy runc run [execve error]" { + cat <rootfs/run.sh +#!/mmnnttbb foo bar +sh +EOF + chmod +x rootfs/run.sh + update_config '.process.args = [ "/run.sh" ]' + RUNC_DMZ=legacy runc run test_hello + [ "$status" -ne 0 ] + [ ${#lines[@]} -eq 1 ] + [[ ${lines[0]} = "exec /run.sh: no such file or directory" ]] +}