[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC] tests: Add ivshmem qtest
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [RFC] tests: Add ivshmem qtest |
Date: |
Wed, 2 Apr 2014 16:57:48 +0200 |
Note that it launches two instances to as sharing memory is the purpose
of Nahanni/ivshmem.
Cc: Cam Macdonell <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
This test demonstrates a use case of running two QEMU instances in qtest.
However, similar to mst's proposed KVM acpi-test, it fails on systems
without KVM support, and we cannot use $(CONFIG_KVM) to make it conditional
since that is a per-target define rather than host-wide.
I wonder if libqtest should expose an API to start a QEMU instance and
inquire via QMP whether the executable supports KVM, returning true or false?
tests/Makefile | 3 +++
tests/ivshmem-test.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
create mode 100644 tests/ivshmem-test.c
diff --git a/tests/Makefile b/tests/Makefile
index 6086f68..e4c3b12 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -137,6 +137,8 @@ check-qtest-i386-y += tests/pvpanic-test$(EXESUF)
gcov-files-i386-y += i386-softmmu/hw/misc/pvpanic.c
check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
gcov-files-i386-y += hw/pci-bridge/i82801b11.c
+check-qtest-i386-y += tests/ivshmem-test$(EXESUF)
+gcov-files-i386-y += i386-softmmu/hw/misc/ivshmem.c
check-qtest-x86_64-y = $(check-qtest-i386-y)
gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
gcov-files-x86_64-y = $(subst
i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -287,6 +289,7 @@ tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o
$(libqos-pc-obj-y)
tests/nvme-test$(EXESUF): tests/nvme-test.o
tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
+tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o
tests/qemu-iotests/socket_scm_helper$(EXESUF):
tests/qemu-iotests/socket_scm_helper.o
# QTest rules
diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c
new file mode 100644
index 0000000..e981ad3
--- /dev/null
+++ b/tests/ivshmem-test.c
@@ -0,0 +1,40 @@
+/*
+ * QTest testcase for Nahanni
+ *
+ * Copyright (c) 2014 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 <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+/* Tests only initialization so far. TODO: Replace with functional tests */
+static void nop(void)
+{
+}
+
+int main(int argc, char **argv)
+{
+ QTestState *s1, *s2;
+ char *cmd;
+ int ret;
+
+ g_test_init(&argc, &argv, NULL);
+ qtest_add_func("/ivshmem/nop", nop);
+
+ cmd = g_strdup_printf("-device ivshmem,shm=%s,size=1M", "qtest");
+ s1 = qtest_start(cmd);
+ s2 = qtest_start(cmd);
+ g_free(cmd);
+
+ ret = g_test_run();
+
+ qtest_quit(s1);
+ qtest_quit(s2);
+
+ return ret;
+}
--
1.8.4.5
- [Qemu-devel] [RFC] tests: Add ivshmem qtest,
Andreas Färber <=
- Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Michael S. Tsirkin, 2014/04/02
- Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Andreas Färber, 2014/04/02
- Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Michael S. Tsirkin, 2014/04/02
- Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Paolo Bonzini, 2014/04/02
- Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Michael S. Tsirkin, 2014/04/03
- Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Andreas Färber, 2014/04/03
- Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Michael S. Tsirkin, 2014/04/03
Re: [Qemu-devel] [RFC] tests: Add ivshmem qtest, Stefan Hajnoczi, 2014/04/03