diff --git a/test/suites/exec.sh b/test/suites/exec.sh index 9e2c83f04ea5..013bcdbe8688 100644 --- a/test/suites/exec.sh +++ b/test/suites/exec.sh @@ -93,5 +93,15 @@ test_exec_exit_code() { lxc exec x1 -- invalid-command || exitCode=$? [ "${exitCode:-0}" -eq 127 ] + # Try disconnecting a container stopping forcefully and gracefully to make sure they differ appropriately. + (sleep 1 && lxc restart -f x1) & + lxc exec x1 -- sleep 10 || exitCode=$? + [ "${exitCode:-0}" -eq 137 ] + + (sleep 1 && lxc stop x1) & + lxc exec x1 -- sleep 10 || exitCode=$? + # Both 129 and 143 have been seen and both make sense here. + [ "${exitCode:-0}" -eq 129 ] + lxc delete --force x1 }