Patchwork [RFC,1/1] Stupid test case to demonstrate flawed crash handling

login
register
mail settings
Submitter Markus Armbruster
Date June 27, 2012, 8:26 a.m.
Message ID <1340785560-1201-2-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/167563/
State New
Headers show

Comments

Markus Armbruster - June 27, 2012, 8:26 a.m.
Makes "make check" hang:

    QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 gtester -k --verbose -m=quick tests/crash-test tests/rtc-test
    TEST: tests/crash-test... (pid=972)
    qemu-system-x86_64: Device needs media, but drive is empty
[Nothing happens, wait a while, then hit ^C]
    make: *** [check-qtest-x86_64] Interrupt

Relies on the bug in "-drive if=ide" error handling I just
reported[*], because I'm lazy.

[*] Subject: Regression commit 6e008585 qdev: remove info from class

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 tests/Makefile     |    2 ++
 tests/crash-test.c |   18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 tests/crash-test.c

Patch

diff --git a/tests/Makefile b/tests/Makefile
index d66ab19..7fcf7a9 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -20,6 +20,7 @@  check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
 # All QTests for now are POSIX-only, but the dependencies are
 # really in libqtest, not in the testcases themselves.
 check-qtest-i386-y = tests/fdc-test$(EXESUF)
+check-qtest-i386-y = tests/crash-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
@@ -70,6 +71,7 @@  tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(
 tests/rtc-test$(EXESUF): tests/rtc-test.o $(trace-obj-y)
 tests/m48t59-test$(EXESUF): tests/m48t59-test.o $(trace-obj-y)
 tests/fdc-test$(EXESUF): tests/fdc-test.o tests/libqtest.o $(trace-obj-y)
+tests/crash-test$(EXESUF): tests/crash-test.o tests/libqtest.o $(trace-obj-y)
 
 # QTest rules
 
diff --git a/tests/crash-test.c b/tests/crash-test.c
new file mode 100644
index 0000000..d69dae0
--- /dev/null
+++ b/tests/crash-test.c
@@ -0,0 +1,18 @@ 
+#include <glib.h>
+#include "libqtest.h"
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+
+    qtest_start("-display none -drive if=ide");
+    qtest_irq_intercept_in(global_qtest, "ioapic");
+
+    ret = g_test_run();
+
+    qtest_quit(global_qtest);
+
+    return ret;
+}