Patchwork [FYI,3/3] qtest: Add virtio-ccw test case

login
register
mail settings
Submitter Andreas Färber
Date Jan. 23, 2013, 10:01 a.m.
Message ID <1358935314-18768-4-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/214871/
State New
Headers show

Comments

Andreas Färber - Jan. 23, 2013, 10:01 a.m.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile          |    2 ++
 tests/virtio-ccw-test.c |   38 ++++++++++++++++++++++++++++++++++++++
 2 Dateien geändert, 40 Zeilen hinzugefügt(+)
 create mode 100644 tests/virtio-ccw-test.c

Patch

diff --git a/tests/Makefile b/tests/Makefile
index d86e95a..6ab4610 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -62,6 +62,7 @@  check-qtest-sparc64-y = tests/m48t59-test$(EXESUF)
 gcov-files-sparc-y += hw/m48t59.c
 check-qtest-arm-y = tests/tmp105-test$(EXESUF)
 qcov-files-arm-y += hw/tmp105.c
+check-qtest-s390x-y = tests/virtio-ccw-test$(EXESUF)
 
 GENERATED_HEADERS += tests/test-qapi-types.h tests/test-qapi-visit.h tests/test-qmp-commands.h
 
@@ -111,6 +112,7 @@  tests/m48t59-test$(EXESUF): tests/m48t59-test.o
 tests/fdc-test$(EXESUF): tests/fdc-test.o
 tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
 tests/tmp105-test$(EXESUF): tests/tmp105-test.o
+tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
 
 # QTest rules
 
diff --git a/tests/virtio-ccw-test.c b/tests/virtio-ccw-test.c
new file mode 100644
index 0000000..8abf8d9
--- /dev/null
+++ b/tests/virtio-ccw-test.c
@@ -0,0 +1,38 @@ 
+/*
+ * QTest testcase for virtio-ccw
+ *
+ * Copyright (c) 2013 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#include "libqtest.h"
+
+#include <glib.h>
+
+#define KVM_S390_VIRTIO_RESET           1
+
+static void test(void)
+{
+    hypercall(KVM_S390_VIRTIO_RESET, 1, 128 * 1024 * 1024);
+}
+
+int main(int argc, char **argv)
+{
+    QTestState *s = NULL;
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+
+    s = qtest_start("-display none -m 128M");
+
+    qtest_add_func("/virtio-ccw/dummy", test);
+
+    ret = g_test_run();
+
+    if (s) {
+        qtest_quit(s);
+    }
+
+    return ret;
+}