[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/2] tests: Add ivshmem qtest
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 1/2] tests: Add ivshmem qtest |
Date: |
Sun, 11 Oct 2015 00:18:32 +0200 |
Note that it launches two instances, as sharing memory is the purpose
of Nahanni/ivshmem.
Cc: Cam Macdonell <address@hidden>
Cc: Marc-André Lureau <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
tests/Makefile | 3 +++
tests/ivshmem-test.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 tests/ivshmem-test.c
diff --git a/tests/Makefile b/tests/Makefile
index e6474ba..3b7e6ac 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -191,6 +191,8 @@ gcov-files-i386-y += hw/pci-host/q35.c
ifeq ($(CONFIG_VHOST_NET),y)
check-qtest-i386-$(CONFIG_LINUX) += tests/vhost-user-test$(EXESUF)
endif
+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))
@@ -434,6 +436,7 @@ tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o
$(libqos-usb-obj-y)
tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o
qemu-timer.o $(qtest-obj-y)
+tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o
tests/qemu-iotests/socket_scm_helper$(EXESUF):
tests/qemu-iotests/socket_scm_helper.o
tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o
$(test-block-obj-y)
diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c
new file mode 100644
index 0000000..45fe2ae
--- /dev/null
+++ b/tests/ivshmem-test.c
@@ -0,0 +1,51 @@
+/*
+ * 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+static char dev_shm_path[] = "/dev/shm/qtest.XXXXXX";
+
+/* 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, fd;
+
+ g_test_init(&argc, &argv, NULL);
+ qtest_add_func("/ivshmem/nop", nop);
+
+ fd = mkstemp(dev_shm_path);
+ g_assert(fd >= 0);
+ close(fd);
+ unlink(dev_shm_path);
+
+ cmd = g_strdup_printf("-device ivshmem,shm=%s,size=1M", &dev_shm_path[9]);
+ s1 = qtest_start(cmd);
+ s2 = qtest_start(cmd);
+ g_free(cmd);
+
+ ret = g_test_run();
+
+ qtest_quit(s1);
+ qtest_quit(s2);
+
+ unlink(dev_shm_path);
+
+ return ret;
+}
--
2.1.4
- [Qemu-devel] [PULL 31/48] contrib: add ivshmem client and server, (continued)
- [Qemu-devel] [PULL 31/48] contrib: add ivshmem client and server, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PULL 20/48] ivshmem: simplify a bit the code, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PULL 22/48] ivshmem: use common is_power_of_2(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PULL 42/48] ivshmem: do not keep shm_fd open, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PULL 16/48] ivshmem: remove max_peer field, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PULL 36/48] ivshmem: add check on protocol version in QEMU, marcandre . lureau, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Andreas Färber, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Marc-André Lureau, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Andreas Färber, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Marc-André Lureau, 2015/10/08
- [Qemu-devel] [PATCH 1/2] tests: Add ivshmem qtest,
Andreas Färber <=
- Re: [Qemu-devel] [PATCH 1/2] tests: Add ivshmem qtest, Marc-André Lureau, 2015/10/10
- [Qemu-devel] [PATCH 2/2] ivshmem-test: Implement tests, Andreas Färber, 2015/10/11
- Re: [Qemu-devel] [PATCH 2/2] ivshmem-test: Implement tests, Andreas Färber, 2015/10/11
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Paolo Bonzini, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Andrew Jones, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Andreas Färber, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Peter Maydell, 2015/10/08
- Re: [Qemu-devel] [PULL 00/48] ivshmem series, Marc-André Lureau, 2015/10/08
[Qemu-devel] [PULL 01/48] char: add qemu_chr_free(), marcandre . lureau, 2015/10/08
[Qemu-devel] [PULL 03/48] ivhsmem: read do not accept more than sizeof(long), marcandre . lureau, 2015/10/08