From patchwork Thu Feb 18 17:05:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Kaplansky X-Patchwork-Id: 8352281 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 64B859F727 for ; Thu, 18 Feb 2016 17:06:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1D96203A0 for ; Thu, 18 Feb 2016 17:06:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DFE2920375 for ; Thu, 18 Feb 2016 17:06:16 +0000 (UTC) Received: from localhost ([::1]:43416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWS1w-0006XZ-9r for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Feb 2016 12:06:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWS1a-0006K8-RV for qemu-devel@nongnu.org; Thu, 18 Feb 2016 12:05:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWS1W-0006lc-Mr for qemu-devel@nongnu.org; Thu, 18 Feb 2016 12:05:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53655) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWS1W-0006lT-F8 for qemu-devel@nongnu.org; Thu, 18 Feb 2016 12:05:50 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 2904F70D6B for ; Thu, 18 Feb 2016 17:05:50 +0000 (UTC) Received: from redhat.com (vpn-200-60.tlv.redhat.com [10.35.200.60]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u1IH5m1v009082; Thu, 18 Feb 2016 12:05:48 -0500 Date: Thu, 18 Feb 2016 19:05:47 +0200 From: Victor Kaplansky To: qemu-devel@nongnu.org Message-ID: <1455814799-19691-1-git-send-email-victork@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jason Wang , Eduardo Habkost , "Michael S. Tsirkin" Subject: [Qemu-devel] [RFC PATCH] tests/pxe-test: add pxe vhost user test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add one more testcase to pxe-test for checking vhost-user interface. The test is based on spawning vhost-user-bridge process in addition to qemu under test. Suggested-by: Michael S. Tsirkin Signed-off-by: Victor Kaplansky --- The patch is a quick and dirty, but working implementation of Michal's idea. It is based on latest vhost-user-bridge test and latest change in rules: "[PATCH] rules: filter out irrelevant files". tests/pxe-test.c | 39 +++++++++++++++++++++++++++++++++++++++ tests/Makefile | 4 +++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/tests/pxe-test.c b/tests/pxe-test.c index fa430958..d01965f8 100644 --- a/tests/pxe-test.c +++ b/tests/pxe-test.c @@ -48,6 +48,44 @@ static void test_pxe_virtio_pci(void) test_pxe_one("-device virtio-net-pci,netdev=" NETNAME); } +static void test_pxe_vhost_user(void) +{ + pid_t pid; + int status; + + pid = fork(); + if (!pid) { + char *vubr_binary; + char *args; + + vubr_binary = getenv("QTEST_VUBR_BINARY"); + assert(vubr_binary); + + args = + g_strdup_printf("%s -u /tmp/vubr.sock -l 127.0.0.1:4444 " + "-r 127.0.0.1:5555 1> /dev/null 2>&1", + vubr_binary); + system(args); + free(args); + exit(0); + } + + g_usleep(1 * G_USEC_PER_SEC); + qtest_start( + "-enable-kvm " + "-m 1024 " + "-object memory-backend-file,id=mem,size=1024M,mem-path=/tmp/hugepages,share=on " + "-numa node,memdev=mem -mem-prealloc " + "-device virtio-net-pci,netdev=net0 " + "-chardev socket,id=char0,path=/tmp/vubr.sock " + "-netdev type=vhost-user,id=net0,chardev=char0,vhostforce " + "-net user,vlan=5,tftp=./,bootfile=tests/pxe-test-disk.raw " + "-net socket,vlan=5,udp=localhost:4444,localaddr=localhost:5555 "); + boot_sector_test(); + qtest_quit(global_qtest); + waitpid(pid, &status, 0); +} + int main(int argc, char *argv[]) { int ret; @@ -60,6 +98,7 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + qtest_add_func("pxe/vhost-user", test_pxe_vhost_user); qtest_add_func("pxe/e1000", test_pxe_e1000); qtest_add_func("pxe/virtio", test_pxe_virtio_pci); } diff --git a/tests/Makefile b/tests/Makefile index 839d357d..40d9d8cc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -521,7 +521,8 @@ tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y) tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o \ tests/boot-sector.o $(libqos-obj-y) -tests/pxe-test$(EXESUF): tests/pxe-test.o tests/boot-sector.o $(libqos-obj-y) +tests/pxe-test$(EXESUF): tests/pxe-test.o tests/boot-sector.o \ + tests/vhost-user-bridge$(EXESUF) $(libqos-obj-y) tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y) tests/ds1338-test$(EXESUF): tests/ds1338-test.o $(libqos-imx-obj-y) tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) @@ -620,6 +621,7 @@ $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y) $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,) $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ QTEST_QEMU_IMG=qemu-img$(EXESUF) \ + QTEST_VUBR_BINARY=./tests/vhost-user-bridge$(EXESUF) \ MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \ gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER $@") $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y) $(gcov-files-generic-y); do \