Skip to content

Commit 0bc4732

Browse files
committed
test for execve error without runc-dmz
Signed-off-by: lfbzhm <[email protected]>
1 parent 35aa63e commit 0bc4732

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tests/integration/exec.bats

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,21 @@ function check_exec_debug() {
322322
runc exec --cgroup second test_busybox grep -w second /proc/self/cgroup
323323
[ "$status" -eq 0 ]
324324
}
325+
326+
@test "RUNC_DMZ=legacy runc exec [execve error]" {
327+
cat <<EOF >rootfs/run.sh
328+
#!/mmnnttbb foo bar
329+
sh
330+
EOF
331+
chmod +x rootfs/run.sh
332+
RUNC_DMZ=legacy runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
333+
RUNC_DMZ=legacy runc exec -t test_busybox /run.sh
334+
[ "$status" -ne 0 ]
335+
336+
# After the sync socket closed, we should not send error to parent
337+
# process, or else we will get a unnecessary error log(#4171).
338+
# Although we never close the sync socket when doing exec,
339+
# but we need to keep this test to ensure this behavior is always right.
340+
[ ${#lines[@]} -eq 1 ]
341+
[[ ${lines[0]} = *"exec failed: unable to start container process: exec /run.sh: no such file or directory"* ]]
342+
}

tests/integration/run.bats

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,19 @@ EOF
247247
[ "$status" -ne 0 ]
248248
[[ "$output" = *"exec /run.sh: "* ]]
249249
}
250+
251+
@test "RUNC_DMZ=legacy runc run [execve error]" {
252+
cat <<EOF >rootfs/run.sh
253+
#!/mmnnttbb foo bar
254+
sh
255+
EOF
256+
chmod +x rootfs/run.sh
257+
update_config '.process.args = [ "/run.sh" ]'
258+
RUNC_DMZ=legacy runc run test_hello
259+
[ "$status" -ne 0 ]
260+
261+
# After the sync socket closed, we should not send error to parent
262+
# process, or else we will get a unnecessary error log(#4171).
263+
[ ${#lines[@]} -eq 1 ]
264+
[[ ${lines[0]} = "exec /run.sh: no such file or directory" ]]
265+
}

0 commit comments

Comments
 (0)