Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
virtme-ng: return 255 on panic in script mode instead of hanging
If we trigger a kernel panic when running in script mode the guest would just hangs indefinitely. Test case: $ vng -vr -- "echo c > /proc/sysrq-trigger" This can be a bit problematic in a CI scenario, since the indefinite hang can block all the next tests or actions. A possible solution is to use the `timeout` command with `vng`, but we may also want to distinguish actual timeout conditions from kernel panics. For this reason always boot the guest with "panic=-1" when running in script mode; this, together with qemu`-no-reboot` will trigger an immediate exit, that can be detected by vng and report the special exit code 255. This allows to explicitly catch kernel panic conditions, by checking if the return code of vng is 255. Example: $ vng -vr -- "echo c > /proc/sysrq-trigger" 2>/tmp/kernel.log $ [ $? == 255 ] && grep "Kernel panic" /tmp/kernel.log [ 3.260927] Kernel panic - not syncing: sysrq triggered crash NOTE: we don't want to change the behavior with interactive mode. In that case it is fine to hang indefinitely by default, because we may want to attach a debugger, or trigger a memory dump, etc. So this change should only affect script mode for now. Link: linux-netdev/nipa#11 Signed-off-by: Andrea Righi <[email protected]>
- Loading branch information