From fe95a2a06a7bfce160f3941930ba2564a62baddc Mon Sep 17 00:00:00 2001 From: Rodrigo Campos Date: Thu, 18 Jan 2024 17:46:43 +0100 Subject: [PATCH] tests/integration: Test exec failures Signed-off-by: Rodrigo Campos --- tests/integration/run.bats | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/integration/run.bats b/tests/integration/run.bats index f6bd3c865..bf23d22a1 100644 --- a/tests/integration/run.bats +++ b/tests/integration/run.bats @@ -230,3 +230,20 @@ function teardown() { grep -E '^monotonic\s+7881\s+2718281$' <<<"$output" grep -E '^boottime\s+1337\s+3141519$' <<<"$output" } + +@test "runc run [exec error]" { + cat <rootfs/run.sh +#!/mmnnttbb foo bar +sh +EOF + chmod +x rootfs/run.sh + update_config '.process.args = [ "/run.sh" ]' + runc run test_hello + + # Ensure that the output contains the right error message. For runc-dmz, both + # nolibc and libc have the same formatting string (but libc will print the + # errno description rather than just the number), and for runc_nodmz the error + # message from Go starts with the same string. + [ "$status" -ne 0 ] + [[ "$output" = *"exec /run.sh: "* ]] +}