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 22, 2024
1 parent 19b1170 commit 417ca41
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/integration/exec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<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 ]
[ ${#lines[@]} -eq 1 ]
[[ ${lines[0]} = *"exec failed: unable to start container process: exec /run.sh: no such file or directory"* ]]
}
13 changes: 13 additions & 0 deletions tests/integration/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,16 @@ function teardown() {
grep -E '^monotonic\s+7881\s+2718281$' <<<"$output"
grep -E '^boottime\s+1337\s+3141519$' <<<"$output"
}

@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 ]
[ ${#lines[@]} -eq 1 ]
[[ ${lines[0]} = "exec /run.sh: no such file or directory" ]]
}

0 comments on commit 417ca41

Please sign in to comment.