Skip to content

Commit

Permalink
test for execve error without runc-dmz
Browse files Browse the repository at this point in the history
Signed-off-by: lfbzhm <lifubang@acmcoder.com>
  • Loading branch information
lifubang committed Jan 24, 2024
1 parent 139d4c7 commit 79f3d6a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/integration/exec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,21 @@ 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 <<EOF >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 ]

# After the sync socket closed, we should not send error to parent
# process, or else we will get a unnecessary error log(#4171).
# Although we never close the sync socket when doing exec,
# but we need to keep this test to ensure this behavior is always right.
[ ${#lines[@]} -eq 1 ]
[[ ${lines[0]} = *"exec failed: unable to start container process: exec /run.sh: no such file or directory"* ]]
}
16 changes: 16 additions & 0 deletions tests/integration/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,19 @@ EOF
[ "$status" -ne 0 ]
[[ "$output" = *"exec /run.sh: "* ]]
}

@test "RUNC_DMZ=legacy runc run [execve error]" {
cat <<EOF >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 ]

# After the sync socket closed, we should not send error to parent
# process, or else we will get a unnecessary error log(#4171).
[ ${#lines[@]} -eq 1 ]
[[ ${lines[0]} = "exec /run.sh: no such file or directory" ]]
}

0 comments on commit 79f3d6a

Please sign in to comment.