Received: from eggs.gnu.org ([2001:4830:134:3::10]:54004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zl2TT-0005Ro-Q8 for qemu-devel@nongnu.org; Sat, 10 Oct 2015 18:18:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zl2TO-0004zT-Rw for qemu-devel@nongnu.org; Sat, 10 Oct 2015 18:18:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:43038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zl2TO-0004zN-MK for qemu-devel@nongnu.org; Sat, 10 Oct 2015 18:18:38 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 11 Oct 2015 00:18:32 +0200 Message-Id: <1444515513-3418-1-git-send-email-afaerber@suse.de> In-Reply-To: <1146125127.26155100.1444221853707.JavaMail.zimbra@redhat.com> References: <1146125127.26155100.1444221853707.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 1/2] tests: Add ivshmem qtest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cam Macdonell , =?UTF-8?q?Andreas=20F=C3=A4rber?= Note that it launches two instances, as sharing memory is the purpose of Nahanni/ivshmem. Cc: Cam Macdonell Cc: Marc-Andr=C3=A9 Lureau Signed-off-by: Andreas F=C3=A4rber --- 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 +=3D hw/pci-host/q35.c ifeq ($(CONFIG_VHOST_NET),y) check-qtest-i386-$(CONFIG_LINUX) +=3D tests/vhost-user-test$(EXESUF) endif +check-qtest-i386-y +=3D tests/ivshmem-test$(EXESUF) +gcov-files-i386-y +=3D i386-softmmu/hw/misc/ivshmem.c check-qtest-x86_64-y =3D $(check-qtest-i386-y) gcov-files-i386-y +=3D i386-softmmu/hw/timer/mc146818rtc.c gcov-files-x86_64-y =3D $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-fil= es-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 la= ter. + * See the COPYING file in the top-level directory. + */ + +#include +#include +#include +#include +#include "libqtest.h" +#include "qemu/osdep.h" + +static char dev_shm_path[] =3D "/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 =3D mkstemp(dev_shm_path); + g_assert(fd >=3D 0); + close(fd); + unlink(dev_shm_path); + + cmd =3D g_strdup_printf("-device ivshmem,shm=3D%s,size=3D1M", &dev_s= hm_path[9]); + s1 =3D qtest_start(cmd); + s2 =3D qtest_start(cmd); + g_free(cmd); + + ret =3D g_test_run(); + + qtest_quit(s1); + qtest_quit(s2); + + unlink(dev_shm_path); + + return ret; +} --=20 2.1.4