From patchwork Fri Sep 16 17:43:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 670990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3sbN5v6GLLz9sCZ for ; Sat, 17 Sep 2016 03:47:31 +1000 (AEST) Received: from localhost ([::1]:42938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkxEW-0005N1-3M for incoming@patchwork.ozlabs.org; Fri, 16 Sep 2016 13:47:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkxB7-0002bc-Fn for qemu-devel@nongnu.org; Fri, 16 Sep 2016 13:43:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkxB3-0005CE-9e for qemu-devel@nongnu.org; Fri, 16 Sep 2016 13:43:56 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56839 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkxB3-0005C4-3T for qemu-devel@nongnu.org; Fri, 16 Sep 2016 13:43:53 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8GHhF4l140903 for ; Fri, 16 Sep 2016 13:43:52 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0b-001b2d01.pphosted.com with ESMTP id 25ghv82s8k-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 16 Sep 2016 13:43:52 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Sep 2016 13:43:52 -0400 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 16 Sep 2016 13:43:49 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id C03706E8041; Fri, 16 Sep 2016 13:43:23 -0400 (EDT) Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8GHhZqV14221684; Fri, 16 Sep 2016 17:43:45 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 732D2124050; Fri, 16 Sep 2016 13:43:45 -0400 (EDT) Received: from [192.168.66.108] (unknown [9.164.164.67]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP id D0A66124044; Fri, 16 Sep 2016 13:43:44 -0400 (EDT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 16 Sep 2016 19:43:43 +0200 In-Reply-To: <147404772702.11348.6148146353464564675.stgit@bahia> References: <147404772702.11348.6148146353464564675.stgit@bahia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091617-0040-0000-0000-0000015C7FBC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005772; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00758381; UDB=6.00359959; IPR=6.00532099; BA=6.00004731; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012695; XFM=3.00000011; UTC=2016-09-16 17:43:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091617-0041-0000-0000-0000054F8155 Message-Id: <147404782396.11348.15526194199219562858.stgit@bahia> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-16_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609160223 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v3 1/3] tests: virtio-9p: introduce start/stop functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz , "Aneesh Kumar K.V" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" First step to be able to run several functional steps. Signed-off-by: Greg Kurz Acked-by: Cornelia Huck --- v2: - moved "mount_tag" change from 2/3 to 1/3 (Cornelia) - added Cornelia's A-b tag --- tests/virtio-9p-test.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c index 1e39335a7945..45fc8041d7f3 100644 --- a/tests/virtio-9p-test.c +++ b/tests/virtio-9p-test.c @@ -11,33 +11,41 @@ #include "libqtest.h" #include "qemu-common.h" -/* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop(void) -{ -} +static const char mount_tag[] = "qtest"; +static char *test_share; -static char test_share[] = "/tmp/qtest.XXXXXX"; - -int main(int argc, char **argv) +static void qvirtio_9p_start(void) { char *args; - int ret; - g_test_init(&argc, &argv, NULL); - qtest_add_func("/virtio/9p/pci/nop", pci_nop); - - g_assert(mkdtemp(test_share)); + test_share = g_strdup("/tmp/qtest.XXXXXX"); + g_assert_nonnull(mkdtemp(test_share)); args = g_strdup_printf("-fsdev local,id=fsdev0,security_model=none,path=%s " - "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=qtest", - test_share); + "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s", + test_share, mount_tag); + qtest_start(args); g_free(args); +} - ret = g_test_run(); - +static void qvirtio_9p_stop(void) +{ qtest_end(); rmdir(test_share); + g_free(test_share); +} + +static void pci_nop(void) +{ + qvirtio_9p_start(); + qvirtio_9p_stop(); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + qtest_add_func("/virtio/9p/pci/nop", pci_nop); - return ret; + return g_test_run(); }