diff options
author | Chris Laplante <chris@laplante.io> | 2023-08-22 17:31:01 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2023-08-22 17:31:01 +0100 |
commit | c7bb6fa6afb427f9538bf2f95ea55e8a1ce8da60 (patch) | |
tree | 0ab4c8859932c0a998ff1d9bcba434d2e388cd71 /softmmu/qtest.c | |
parent | fe692f7c8c477dd794a45b18148e248c3c327931 (diff) | |
download | qemu-c7bb6fa6afb427f9538bf2f95ea55e8a1ce8da60.zip qemu-c7bb6fa6afb427f9538bf2f95ea55e8a1ce8da60.tar.gz qemu-c7bb6fa6afb427f9538bf2f95ea55e8a1ce8da60.tar.bz2 |
qtest: irq_intercept_[out/in]: return FAIL if no intercepts are installed
This is much better than just silently failing with OK.
Signed-off-by: Chris Laplante <chris@laplante.io>
Message-id: 20230728160324.1159090-6-chris@laplante.io
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'softmmu/qtest.c')
-rw-r--r-- | softmmu/qtest.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/softmmu/qtest.c b/softmmu/qtest.c index 66757ba..35b643a 100644 --- a/softmmu/qtest.c +++ b/softmmu/qtest.c @@ -399,6 +399,7 @@ static void qtest_process_command(CharBackend *chr, gchar **words) NamedGPIOList *ngl; bool is_named; bool is_outbound; + bool interception_succeeded = false; g_assert(words[1]); is_named = words[2] != NULL; @@ -435,15 +436,22 @@ static void qtest_process_command(CharBackend *chr, gchar **words) for (i = 0; i < ngl->num_out; ++i) { qtest_install_gpio_out_intercept(dev, ngl->name, i); } + interception_succeeded = true; } } else { qemu_irq_intercept_in(ngl->in, qtest_irq_handler, ngl->num_in); + interception_succeeded = true; } } - irq_intercept_dev = dev; + qtest_send_prefix(chr); - qtest_send(chr, "OK\n"); + if (interception_succeeded) { + irq_intercept_dev = dev; + qtest_send(chr, "OK\n"); + } else { + qtest_send(chr, "FAIL No intercepts installed\n"); + } } else if (strcmp(words[0], "set_irq_in") == 0) { DeviceState *dev; qemu_irq irq; |