Received: from eggs.gnu.org ([2001:4830:134:3::10]:51442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjUK-0006uX-R0 for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUjU8-0006GE-2K for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:11:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49312 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjU7-0006Eb-Nv for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:11:12 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 31 Mar 2014 23:10:54 +0200 Message-Id: <1396300262-10430-9-git-send-email-afaerber@suse.de> In-Reply-To: <1396300262-10430-1-git-send-email-afaerber@suse.de> References: <1396300262-10430-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.0 08/16] tests: Add virtio-9p qtest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Aneesh Kumar K.V" Make it conditional to 9p availability. Create a temporary directory to share. Signed-off-by: Andreas F=C3=A4rber --- MAINTAINERS | 1 + tests/Makefile | 6 ++++++ tests/virtio-9p-test.c | 46 ++++++++++++++++++++++++++++++++++++++++++++= ++ 3 files changed, 53 insertions(+) create mode 100644 tests/virtio-9p-test.c diff --git a/MAINTAINERS b/MAINTAINERS index 4d8eefc..4923b0f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -623,6 +623,7 @@ M: Aneesh Kumar K.V S: Supported F: hw/9pfs/ F: fsdev/ +F: tests/virtio-9p-test.c T: git git://github.com/kvaneesh/QEMU.git =20 virtio-blk diff --git a/tests/Makefile b/tests/Makefile index 01a3463..843429b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -84,6 +84,11 @@ check-qtest-virtio-y +=3D tests/virtio-rng-test$(EXESU= F) gcov-files-virtio-y +=3D hw/virtio/virtio-rng.c check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/scsi/virtio-scsi.c +ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) +check-qtest-virtio-y +=3D tests/virtio-9p-test$(EXESUF) +gcov-files-virtio-y +=3D hw/9pfs/virtio-9p.c +gcov-files-virtio-y +=3D i386-softmmu/hw/9pfs/virtio-9p-device.c +endif check-qtest-virtio-y +=3D tests/virtio-serial-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/char/virtio-serial-bus.c check-qtest-virtio-y +=3D $(check-qtest-virtioserial-y) @@ -267,6 +272,7 @@ tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test= .o tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o +tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o tests/tpci200-test$(EXESUF): tests/tpci200-test.o diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c new file mode 100644 index 0000000..1fae477 --- /dev/null +++ b/tests/virtio-9p-test.c @@ -0,0 +1,46 @@ +/* + * QTest testcase for VirtIO 9P + * + * 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 "libqtest.h" +#include "qemu-common.h" +#include "qemu/osdep.h" + +/* Tests only initialization so far. TODO: Replace with functional tests= */ +static void pci_nop(void) +{ +} + +static char test_share[] =3D "/tmp/qtest.XXXXXX"; + +int main(int argc, char **argv) +{ + char *args; + int ret; + + g_test_init(&argc, &argv, NULL); + qtest_add_func("/virtio/9p/pci/nop", pci_nop); + + g_assert(mkdtemp(test_share)); + + args =3D g_strdup_printf("-fsdev local,id=3Dfsdev0,security_model=3D= none,path=3D%s " + "-device virtio-9p-pci,fsdev=3Dfsdev0,mount_t= ag=3Dqtest", + test_share); + qtest_start(args); + g_free(args); + + ret =3D g_test_run(); + + qtest_end(); + rmdir(test_share); + + return ret; +} --=20 1.8.4.5