Ilya Leoshkevich <i...@linux.ibm.com> writes: > Currently QEMU exits with code 0 on both panic an shutdown. For tests > it is useful to return 1 on panic, so that it counts as a test > failure. > > Introduce a new exit-failure PanicAction that makes main() return > EXIT_FAILURE. Tests can use -action panic=exit-failure option to > activate this behavior. > > Signed-off-by: Ilya Leoshkevich <i...@linux.ibm.com> > Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > Reviewed-by: David Hildenbrand <da...@redhat.com>
[...] > diff --git a/qapi/run-state.json b/qapi/run-state.json > index 6e2162d7b3..9273ea6516 100644 > --- a/qapi/run-state.json > +++ b/qapi/run-state.json > @@ -364,10 +364,13 @@ ## # @PanicAction: This is the type of set-action argument @panic, which is documented as "action taken on guest panic." # # @none: Continue VM execution I guess this is effectively "do nothing / ignore". # # @pause: Pause the VM Clear enough. > # > # @shutdown: Shutdown the VM and exit, according to the shutdown action I guess this is the value of set-action argument @shutdown, which is can be * @poweroff, documented as "Shutdown the VM and exit" Do we exit successfully, i.e. with zero status? * @pause, documented as "pause the VM" PanicAction's documentation claims "shutdown the VM and exit", but we don't, we pause instead. Not this patch's problem. > # > +# @exit-failure: Shutdown the VM and exit with nonzero status non-zero > +# (since 7.1) > +# > # Since: 6.0 > ## > { 'enum': 'PanicAction', > - 'data': [ 'pause', 'shutdown', 'none' ] } > + 'data': [ 'pause', 'shutdown', 'exit-failure', 'none' ] } > > ## > # @watchdog-set-action: Not this patch's problem, but here goes anyway: ## # @set-action: # # Set the actions that will be taken by the emulator in response to guest # events. # # @reboot: @RebootAction action taken on guest reboot. # # @shutdown: @ShutdownAction action taken on guest shutdown. # # @panic: @PanicAction action taken on guest panic. # # @watchdog: @WatchdogAction action taken when watchdog timer expires . # # Returns: Nothing on success. # # Since: 6.0 # # Example: # # -> { "execute": "set-action", # "arguments": { "reboot": "shutdown", # "shutdown" : "pause", # "panic": "pause", # "watchdog": "inject-nmi" } } # <- { "return": {} } ## The arguments are all optional, but the documentation neglects to spell out what "absent" means. I guess it means "no change". The documentation also neglects to spell out the initial settings, i.e. behavior when you don't configure an action with set-action. [...]