From patchwork Fri Oct 30 12:46:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B416C00A89 for ; Fri, 30 Oct 2020 14:47:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CA9020724 for ; Fri, 30 Oct 2020 14:47:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="A6NHo2sk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CA9020724 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVgE-0002Z0-87 for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:47:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6dc7aa8023ad597322dabc58451b6f6dbd5bfb2e@lizzy.crudebyte.com>) id 1kYVeO-0000el-UW for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:09 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:34255) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <6dc7aa8023ad597322dabc58451b6f6dbd5bfb2e@lizzy.crudebyte.com>) id 1kYVeN-00036D-38 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=7v/iiCvm1jBrFlOXnQcg1EXergBd4Rt7l38qeLSKKGU=; b=A6NHo 2sksuieQe02lXXlrCLBSY/QFa7H6vCdly8GZUKBX3ZeRd6g/elJnCk3C82UVt8XqX+Wz7QzcFgzwx RDIcdwAE5tCb2qGoO5RK+aZYy8wjWUHqc1jRVvvEz4gXYoqDy1Is4djCDkYa06ZZFDdRFC4ilIpQw CAprwmPefUKAmoL9rH/ROWLBTJJ86l83R4MNCDBpPXegEormeY7Rgu77Q/rAliyW27Ym9GZrIxBrF zRlAG+62fDDlKtj+j0lalI8L0q3GEh4JwzSh+H91eiLet3mNOI6LXqv9UtJPZniF0EDiFQ/srf0IF +ePjQG41C3hMhnqWsiK5yo9OvJM2Q==; Message-Id: <6dc7aa8023ad597322dabc58451b6f6dbd5bfb2e.1604067568.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Fri, 30 Oct 2020 13:46:34 +0100 Subject: [PULL v2 03/16] tests/9pfs: Force removing of local 9pfs test directory To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=6dc7aa8023ad597322dabc58451b6f6dbd5bfb2e@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz No need to get a complaint from "rm" if some path disappeared for some reason. Signed-off-by: Greg Kurz Message-Id: <160406199444.312256.8319835906008559151.stgit@bahia.lan> Signed-off-by: Christian Schoenebeck --- tests/qtest/libqos/virtio-9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/libqos/virtio-9p.c b/tests/qtest/libqos/virtio-9p.c index 8459a3ee58..580ad09a2f 100644 --- a/tests/qtest/libqos/virtio-9p.c +++ b/tests/qtest/libqos/virtio-9p.c @@ -67,7 +67,7 @@ static void create_local_test_dir(void) static void remove_local_test_dir(void) { g_assert(local_test_path != NULL); - char *cmd = g_strdup_printf("rm -r '%s'\n", local_test_path); + char *cmd = g_strdup_printf("rm -fr '%s'\n", local_test_path); int res = system(cmd); if (res < 0) { /* ignore error, dummy check to prevent compiler error */ From patchwork Tue Oct 20 16:09:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B83CC4363A for ; Fri, 30 Oct 2020 14:49:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C14F820724 for ; Fri, 30 Oct 2020 14:49:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="EE4MCwE0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C14F820724 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVik-0005nt-M9 for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:49:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <850207b415781436af3af7deeae72bc9d74af749@lizzy.crudebyte.com>) id 1kYVeW-0000k5-L9 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:16 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:40599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <850207b415781436af3af7deeae72bc9d74af749@lizzy.crudebyte.com>) id 1kYVeU-00036e-Q0 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=aoWMVpHvg2rHeMMDy40wr05kM1klAVxUGDEzPDTlgyg=; b=EE4MC wE0a/MAaCS2FyuVAHD/pTaV4UBwlirMSRUZPTUH4WHDeQRtLonoA7srD9aYjha7Rw3lHrGkhDEPqy SXH+QNdXJGBgodVG9mN4tSsqSS3jZQAy1sKR2Xt1f5lrBN9JnY74uotwez+Omqd6C2JGnQPn63/OS LzUD3VEGG46C8FnE9qJ4y8l48+r1ogmqoetVsmagUL6sGhfnflYITDqt/c4+iJC1V3xpQ9qU7Q1uK U8oj7Eefp0amzDpIAT97oQknVh3aM6E3QJtsLuvukiLclahsPv4wvmn5rKpRcLlzWR/Yg51V7NT5w G+5xxiAk9LRmIXJTFW4aSmSa1ayZQ==; Message-Id: <850207b415781436af3af7deeae72bc9d74af749.1604067568.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Tue, 20 Oct 2020 18:09:14 +0200 Subject: [PULL v2 04/16] tests/9pfs: Factor out do_version() helper To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=850207b415781436af3af7deeae72bc9d74af749@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz fs_version() is a top level test function. Factor out the reusable code to a separate helper instead of hijacking it in other tests. Signed-off-by: Greg Kurz Message-Id: <160321015403.266767.4533967728943968456.stgit@bahia.lan> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index c15908f27b..59bcea4c30 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -567,10 +567,8 @@ static void v9fs_rflush(P9Req *req) v9fs_req_free(req); } -static void fs_version(void *obj, void *data, QGuestAllocator *t_alloc) +static void do_version(QVirtio9P *v9p) { - QVirtio9P *v9p = obj; - alloc = t_alloc; const char *version = "9P2000.L"; uint16_t server_len; char *server_version; @@ -585,13 +583,19 @@ static void fs_version(void *obj, void *data, QGuestAllocator *t_alloc) g_free(server_version); } +static void fs_version(void *obj, void *data, QGuestAllocator *t_alloc) +{ + alloc = t_alloc; + do_version(obj); +} + static void fs_attach(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtio9P *v9p = obj; alloc = t_alloc; P9Req *req; - fs_version(v9p, NULL, t_alloc); + do_version(v9p); req = v9fs_tattach(v9p, 0, getuid(), 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rattach(req, NULL); @@ -831,7 +835,7 @@ static void fs_walk_dotdot(void *obj, void *data, QGuestAllocator *t_alloc) v9fs_qid root_qid, *wqid; P9Req *req; - fs_version(v9p, NULL, t_alloc); + do_version(v9p); req = v9fs_tattach(v9p, 0, getuid(), 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rattach(req, &root_qid); From patchwork Tue Oct 20 16:09:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 443EBC4363A for ; Fri, 30 Oct 2020 14:51:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E2E420724 for ; Fri, 30 Oct 2020 14:51:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="CJpuABko" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E2E420724 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVkr-000102-6o for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:51:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVee-0000yJ-IT for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:24 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:48181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVec-00037D-1K for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=SZ1nQMn8oa+srNc/3IYZzRo1jg+81bKQghHy2wmTYYk=; b=CJpuA BkoSnrf+nyOjpIPg4+AIVzMI/Pz6lpq5H1tOdOoF0ZhSRAOXfm7/9IHcGIB4a/RmobcQB4qEIhsmG vrp2OY6YRZ/0fqSdzrUL9ahkVa++EXREh6uCRhD9MiE7VkmWckYP0yCWqGL6N7jZ+okLL3w1wPb2J zM2/bsD2w75ILCOpc9DclVBD9FRDEf8pksxS0VXVudWPDhnojviG0xzBQQF4ThFWRKXyTmmZXfQOF 5ElzpwCQOzEXz2b5LxM6gtMxvj6kN+dGY76Ur+smbX2ULxy115ubAdmUfsga2+9XuPMoASDmaczoI XUfrUQHiLDqUx6w7FXsia5JYgYfRw==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Tue, 20 Oct 2020 18:09:27 +0200 Subject: [PULL v2 05/16] tests/9pfs: Set alloc in fs_create_dir() To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=b103dd70c775d6c449cff186f663b3c61d161a98@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz fs_create_dir() is a top level test function. It should set alloc. Signed-off-by: Greg Kurz Message-Id: <160321016764.266767.3763279057643874020.stgit@bahia.lan> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 59bcea4c30..93a2a4cd76 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -1019,6 +1019,7 @@ static void fs_readdir_split_512(void *obj, void *data, static void fs_create_dir(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtio9P *v9p = obj; + alloc = t_alloc; struct stat st; char *root_path = virtio_9p_test_path(""); char *new_dir = virtio_9p_test_path("01"); From patchwork Tue Oct 20 16:09:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C2C9C4363A for ; Fri, 30 Oct 2020 14:54:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1D0C20578 for ; Fri, 30 Oct 2020 14:54:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="bjJWIBmS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1D0C20578 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVnV-0004aW-Kw for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:54:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <791b4a190c14e1d85dbeb457b242fe6837f6c446@lizzy.crudebyte.com>) id 1kYVek-0001DF-M0 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:30 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:55145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <791b4a190c14e1d85dbeb457b242fe6837f6c446@lizzy.crudebyte.com>) id 1kYVej-00037W-0b for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=eeuqH5oLjRogQTrznzf5l9BTjeSWCCwATfx/A0TEzns=; b=bjJWI BmS7ruoFdXCxw7sZo2GYqx63knlwcTYEjzNtKDJgrnZXSDtZfNJKW0vNRVIqrOkE532HHGJ52AhOq naQ5fYmj5Pn7WA8kt1Q/uXG+pUllrdZV7mQ2YYSbmrvBDbwa6YUMRhfecRtIjqPMoDkIIaJLeyk/B RO0WVOZ3eu4S5uaupt5e6rs14EJ8avYWUS+kZnrVS1unllLpWrr9yBLcCGkspdiXmPw/Q+ao9yV7E EXPhtKDVbiklfAvoI599/V0zcJneZFG+uzSjIB6TUywWDtuH6OylpQAGg0tiFplU2p5lLxze5b3vH t3ko3aA6kaMssLd9MqrLDXQenmsPw==; Message-Id: <791b4a190c14e1d85dbeb457b242fe6837f6c446.1604067568.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Tue, 20 Oct 2020 18:09:34 +0200 Subject: [PULL v2 06/16] tests/9pfs: Factor out do_attach() helper To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=791b4a190c14e1d85dbeb457b242fe6837f6c446@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz fs_attach() is a top level test function. Factor out the reusable code to a separate helper instead of hijacking it in other tests. Signed-off-by: Greg Kurz Message-Id: <160321017450.266767.17377192504263871186.stgit@bahia.lan> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 93a2a4cd76..e07292bdb8 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -589,10 +589,8 @@ static void fs_version(void *obj, void *data, QGuestAllocator *t_alloc) do_version(obj); } -static void fs_attach(void *obj, void *data, QGuestAllocator *t_alloc) +static void do_attach(QVirtio9P *v9p) { - QVirtio9P *v9p = obj; - alloc = t_alloc; P9Req *req; do_version(v9p); @@ -601,6 +599,12 @@ static void fs_attach(void *obj, void *data, QGuestAllocator *t_alloc) v9fs_rattach(req, NULL); } +static void fs_attach(void *obj, void *data, QGuestAllocator *t_alloc) +{ + alloc = t_alloc; + do_attach(obj); +} + static void fs_walk(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtio9P *v9p = obj; @@ -615,7 +619,7 @@ static void fs_walk(void *obj, void *data, QGuestAllocator *t_alloc) wnames[i] = g_strdup_printf(QTEST_V9FS_SYNTH_WALK_FILE, i); } - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); req = v9fs_twalk(v9p, 0, 1, P9_MAXWELEM, wnames, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rwalk(req, &nwqid, &wqid); @@ -684,7 +688,7 @@ static void fs_readdir(void *obj, void *data, QGuestAllocator *t_alloc) struct V9fsDirent *entries = NULL; P9Req *req; - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); req = v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rwalk(req, &nqid, NULL); @@ -741,7 +745,7 @@ static void fs_readdir_split(void *obj, void *data, QGuestAllocator *t_alloc, int fid; uint64_t offset; - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); fid = 1; offset = 0; @@ -817,7 +821,7 @@ static void fs_walk_no_slash(void *obj, void *data, QGuestAllocator *t_alloc) P9Req *req; uint32_t err; - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); req = v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rlerror(req, &err); @@ -857,7 +861,7 @@ static void fs_lopen(void *obj, void *data, QGuestAllocator *t_alloc) char *const wnames[] = { g_strdup(QTEST_V9FS_SYNTH_LOPEN_FILE) }; P9Req *req; - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); req = v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rwalk(req, NULL, NULL); @@ -879,7 +883,7 @@ static void fs_write(void *obj, void *data, QGuestAllocator *t_alloc) uint32_t count; P9Req *req; - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); req = v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rwalk(req, NULL, NULL); @@ -906,7 +910,7 @@ static void fs_flush_success(void *obj, void *data, QGuestAllocator *t_alloc) uint32_t reply_len; uint8_t should_block; - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); req = v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rwalk(req, NULL, NULL); @@ -943,7 +947,7 @@ static void fs_flush_ignored(void *obj, void *data, QGuestAllocator *t_alloc) uint32_t count; uint8_t should_block; - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); req = v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rwalk(req, NULL, NULL); @@ -1026,7 +1030,7 @@ static void fs_create_dir(void *obj, void *data, QGuestAllocator *t_alloc) g_assert(root_path != NULL); - fs_attach(v9p, NULL, t_alloc); + do_attach(v9p); fs_mkdir(v9p, data, t_alloc, "/", "01"); /* check if created directory really exists now ... */ From patchwork Tue Oct 20 16:09:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F4E1C00A89 for ; Fri, 30 Oct 2020 14:49:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D4E22075E for ; Fri, 30 Oct 2020 14:49:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="lv64FwYm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D4E22075E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVip-00065a-Jd for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:49:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <0364a281a649eb6eb2ef1e5c92c700fb1d1ad1dc@lizzy.crudebyte.com>) id 1kYVf2-0001gA-LY for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:48 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:55991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <0364a281a649eb6eb2ef1e5c92c700fb1d1ad1dc@lizzy.crudebyte.com>) id 1kYVez-00038v-M1 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:45:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=9wx9tN7qlWoS6hALtpkXOw4Corur4LktIe88EM4Me8A=; b=lv64F wYmJps2siisHE5ramtXEUUTtZT9bP3xqR4uzSSEGJ8bTQ1VB0G11h/K7ns5EsYqxx4bSJvFfek/8f YVXwtD0svoPBQ8Xetp2wQpVmKoz7k+9LThS5AKyzmg49iKU8MIuMB+U6zS50rExQ06VTj9c0K/m5D xVfqKCJ+arQoOSCWAF2wQ9yYPviCbT2K4zvY/eXZa/WJzp5CwjrQJRQk4wmnqgRp2M0FA8OOoiacL O5ScDOYqmKCLKJsyh9OhHE2Ep4hxALN7kutOa5FGbE0bD4jvXpO5Nlxc03lv6WAuLLaNd0H18NHD/ qiHguFXUmG3eRiFZ0MemmZT5ib/Yw==; Message-Id: <0364a281a649eb6eb2ef1e5c92c700fb1d1ad1dc.1604067568.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Tue, 20 Oct 2020 18:09:41 +0200 Subject: [PULL v2 08/16] tests/9pfs: Turn fs_mkdir() into a helper To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=0364a281a649eb6eb2ef1e5c92c700fb1d1ad1dc@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz fs_mkdir() isn't a top level test function and thus shouldn't take the "void *obj, void *data, QGuestAllocator *t_alloc" arguments. Turn it into a helper to be used by test functions. Signed-off-by: Greg Kurz Message-Id: <160321018148.266767.15959608711038504029.stgit@bahia.lan> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 3c187cdc08..2ea555fa04 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -972,11 +972,8 @@ static void fs_flush_ignored(void *obj, void *data, QGuestAllocator *t_alloc) g_free(wnames[0]); } -static void fs_mkdir(void *obj, void *data, QGuestAllocator *t_alloc, - const char *path, const char *cname) +static void do_mkdir(QVirtio9P *v9p, const char *path, const char *cname) { - QVirtio9P *v9p = obj; - alloc = t_alloc; char **wnames; char *const name = g_strdup(cname); P9Req *req; @@ -1031,7 +1028,7 @@ static void fs_create_dir(void *obj, void *data, QGuestAllocator *t_alloc) g_assert(root_path != NULL); do_attach(v9p); - fs_mkdir(v9p, data, t_alloc, "/", "01"); + do_mkdir(v9p, "/", "01"); /* check if created directory really exists now ... */ g_assert(stat(new_dir, &st) == 0); From patchwork Wed Oct 21 12:17:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7B3AC00A89 for ; Fri, 30 Oct 2020 14:51:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1975120724 for ; Fri, 30 Oct 2020 14:51:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="Wg4DFYDN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1975120724 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVky-0001HK-0B for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:51:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVfF-0001mL-3k for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:06 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:42623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVfC-0003BC-7R for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=phItk4QZiksuHmENHHPRlyMGsHv4X7a/4BRC5vPMnvE=; b=Wg4DF YDNY6DfdQm4PwHFV1YOlU+g2RaWqDHUMOjdBrNpi8G7LW8KEnA3fkmi/4S8J13zFVYoagq669ir5L u5vplUddRwEYPqCIhie0Mwb0NT+WVvA+E2KrzDhu5QGc+4ZX+wJb9E65492XdLr7llDz7zjyK6BgU ltJyC9hkwHWUERXASIfCmSeq4PmffiElyYgGrUWOh58WK/IdKShuxcysWDJDCRHy3RySnb4pJYqxg UhCfhuN9/kQXpO6GP8PqlH7kWJDlmg4OFUWs7XF811WHv97jBvVCdOo76+h2X0HfOfGENDUGm7/Jk BNYQARqcX699SG4Nq2SIKDknTpSBQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Wed, 21 Oct 2020 14:17:01 +0200 Subject: [PULL v2 10/16] tests/9pfs: add local Tunlinkat directory test To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=ee178188f2e942b3b079b6c56dd42e068b692f00@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This test case uses a Tunlinkat 9p request with flag AT_REMOVEDIR (see 'man 2 unlink') to remove a directory from host's test directory. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <3c7c65b476ba44bea6afd0b378b5287e1c671a32.1603285620.git.qemu_oss@crudebyte.com> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 21807037df..abd7e44648 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -258,6 +258,7 @@ static const char *rmessage_name(uint8_t id) id == P9_RLOPEN ? "RLOPEN" : id == P9_RWRITE ? "RWRITE" : id == P9_RMKDIR ? "RMKDIR" : + id == P9_RUNLINKAT ? "RUNLINKAT" : id == P9_RFLUSH ? "RFLUSH" : id == P9_RREADDIR ? "READDIR" : ""; @@ -693,6 +694,33 @@ static void v9fs_rmkdir(P9Req *req, v9fs_qid *qid) v9fs_req_free(req); } +/* size[4] Tunlinkat tag[2] dirfd[4] name[s] flags[4] */ +static P9Req *v9fs_tunlinkat(QVirtio9P *v9p, uint32_t dirfd, const char *name, + uint32_t flags, uint16_t tag) +{ + P9Req *req; + + uint32_t body_size = 4 + 4; + uint16_t string_size = v9fs_string_size(name); + + g_assert_cmpint(body_size, <=, UINT32_MAX - string_size); + body_size += string_size; + + req = v9fs_req_init(v9p, body_size, P9_TUNLINKAT, tag); + v9fs_uint32_write(req, dirfd); + v9fs_string_write(req, name); + v9fs_uint32_write(req, flags); + v9fs_req_send(req); + return req; +} + +/* size[4] Runlinkat tag[2] */ +static void v9fs_runlinkat(P9Req *req) +{ + v9fs_req_recv(req, P9_RUNLINKAT); + v9fs_req_free(req); +} + /* basic readdir test where reply fits into a single response message */ static void fs_readdir(void *obj, void *data, QGuestAllocator *t_alloc) { @@ -1004,6 +1032,22 @@ static void do_mkdir(QVirtio9P *v9p, const char *path, const char *cname) g_free(name); } +static void do_unlinkat(QVirtio9P *v9p, const char *atpath, const char *rpath, + uint32_t flags) +{ + char *const name = g_strdup(rpath); + uint32_t fid; + P9Req *req; + + fid = do_walk(v9p, atpath); + + req = v9fs_tunlinkat(v9p, fid, name, flags, 0); + v9fs_req_wait_for_reply(req, NULL); + v9fs_runlinkat(req); + + g_free(name); +} + static void fs_readdir_split_128(void *obj, void *data, QGuestAllocator *t_alloc) { @@ -1050,6 +1094,32 @@ static void fs_create_dir(void *obj, void *data, QGuestAllocator *t_alloc) g_free(root_path); } +static void fs_unlinkat_dir(void *obj, void *data, QGuestAllocator *t_alloc) +{ + QVirtio9P *v9p = obj; + alloc = t_alloc; + struct stat st; + char *root_path = virtio_9p_test_path(""); + char *new_dir = virtio_9p_test_path("02"); + + g_assert(root_path != NULL); + + do_attach(v9p); + do_mkdir(v9p, "/", "02"); + + /* check if created directory really exists now ... */ + g_assert(stat(new_dir, &st) == 0); + /* ... and is actually a directory */ + g_assert((st.st_mode & S_IFMT) == S_IFDIR); + + do_unlinkat(v9p, "/", "02", AT_REMOVEDIR); + /* directory should be gone now */ + g_assert(stat(new_dir, &st) != 0); + + g_free(new_dir); + g_free(root_path); +} + static void *assign_9p_local_driver(GString *cmd_line, void *arg) { virtio_9p_assign_local_driver(cmd_line, "security_model=mapped-xattr"); @@ -1090,6 +1160,7 @@ static void register_virtio_9p_test(void) opts.before = assign_9p_local_driver; qos_add_test("local/config", "virtio-9p", pci_config, &opts); qos_add_test("local/create_dir", "virtio-9p", fs_create_dir, &opts); + qos_add_test("local/unlinkat_dir", "virtio-9p", fs_unlinkat_dir, &opts); } libqos_init(register_virtio_9p_test); From patchwork Wed Oct 21 12:25:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D2BBC4363A for ; Fri, 30 Oct 2020 14:54:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93EF720578 for ; Fri, 30 Oct 2020 14:54:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="Iis+k5qk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93EF720578 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVnk-0004ry-FJ for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:54:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVfK-0001nN-Lp for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:06 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:52639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVfI-0003Ca-Sw for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=7F7Z+yXYLuM3MjkIbqlf4UwiBRT7dXMX22Ht94r12PE=; b=Iis+k 5qkAjOcyXxi7UoYM8Ey7/7sS4Kc1p7toUWGsKs5je4PT+Gx9NUakbDWpqeJC5IYsSAdRbXNZhKDCR d9Ah6rrW7i0E6e9075ZtffVwYr65joymQcQBs1i3tFTPF6IrOjueTS1TO+FtuQkb9YjIiIJQ6tLpT frsh5Y8yTwxuF+cWzG9SbizZMlw4S6QJC4wyfSPSud5l8Er0tQWCUJHcIG+2qWfdu4H5EqeGWlrau d5EEMYd518OqgXklX+/O2T5FhfBUUy5tA7Ekgv2jLJ1n0fHxfitdi2LHeDOrad/BjlgE81YgAIlRg c+r7/Z/IWHd7pICjei/6q2KdcZ9zw==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Wed, 21 Oct 2020 14:25:33 +0200 Subject: [PULL v2 11/16] tests/9pfs: add local Tlcreate test To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=bf7adaa3d133f81daf2bdf68546a3c1072ce28a5@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This test case uses a Tlcreate 9p request to create a regular file inside host's test directory. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <269cae0c00af941a3a4ae78f1e319f93462a7eb4.1603285620.git.qemu_oss@crudebyte.com> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index abd7e44648..c030bc2a6c 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -258,6 +258,7 @@ static const char *rmessage_name(uint8_t id) id == P9_RLOPEN ? "RLOPEN" : id == P9_RWRITE ? "RWRITE" : id == P9_RMKDIR ? "RMKDIR" : + id == P9_RLCREATE ? "RLCREATE" : id == P9_RUNLINKAT ? "RUNLINKAT" : id == P9_RFLUSH ? "RFLUSH" : id == P9_RREADDIR ? "READDIR" : @@ -694,6 +695,44 @@ static void v9fs_rmkdir(P9Req *req, v9fs_qid *qid) v9fs_req_free(req); } +/* size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4] */ +static P9Req *v9fs_tlcreate(QVirtio9P *v9p, uint32_t fid, const char *name, + uint32_t flags, uint32_t mode, uint32_t gid, + uint16_t tag) +{ + P9Req *req; + + uint32_t body_size = 4 + 4 + 4 + 4; + uint16_t string_size = v9fs_string_size(name); + + g_assert_cmpint(body_size, <=, UINT32_MAX - string_size); + body_size += string_size; + + req = v9fs_req_init(v9p, body_size, P9_TLCREATE, tag); + v9fs_uint32_write(req, fid); + v9fs_string_write(req, name); + v9fs_uint32_write(req, flags); + v9fs_uint32_write(req, mode); + v9fs_uint32_write(req, gid); + v9fs_req_send(req); + return req; +} + +/* size[4] Rlcreate tag[2] qid[13] iounit[4] */ +static void v9fs_rlcreate(P9Req *req, v9fs_qid *qid, uint32_t *iounit) +{ + v9fs_req_recv(req, P9_RLCREATE); + if (qid) { + v9fs_memread(req, qid, 13); + } else { + v9fs_memskip(req, 13); + } + if (iounit) { + v9fs_uint32_read(req, iounit); + } + v9fs_req_free(req); +} + /* size[4] Tunlinkat tag[2] dirfd[4] name[s] flags[4] */ static P9Req *v9fs_tunlinkat(QVirtio9P *v9p, uint32_t dirfd, const char *name, uint32_t flags, uint16_t tag) @@ -1032,6 +1071,24 @@ static void do_mkdir(QVirtio9P *v9p, const char *path, const char *cname) g_free(name); } +/* create a regular file with Tlcreate and return file's fid */ +static uint32_t do_lcreate(QVirtio9P *v9p, const char *path, + const char *cname) +{ + char *const name = g_strdup(cname); + uint32_t fid; + P9Req *req; + + fid = do_walk(v9p, path); + + req = v9fs_tlcreate(v9p, fid, name, 0, 0750, 0, 0); + v9fs_req_wait_for_reply(req, NULL); + v9fs_rlcreate(req, NULL, NULL); + + g_free(name); + return fid; +} + static void do_unlinkat(QVirtio9P *v9p, const char *atpath, const char *rpath, uint32_t flags) { @@ -1120,6 +1177,25 @@ static void fs_unlinkat_dir(void *obj, void *data, QGuestAllocator *t_alloc) g_free(root_path); } +static void fs_create_file(void *obj, void *data, QGuestAllocator *t_alloc) +{ + QVirtio9P *v9p = obj; + alloc = t_alloc; + struct stat st; + char *new_file = virtio_9p_test_path("03/1st_file"); + + do_attach(v9p); + do_mkdir(v9p, "/", "03"); + do_lcreate(v9p, "03", "1st_file"); + + /* check if created file exists now ... */ + g_assert(stat(new_file, &st) == 0); + /* ... and is a regular file */ + g_assert((st.st_mode & S_IFMT) == S_IFREG); + + g_free(new_file); +} + static void *assign_9p_local_driver(GString *cmd_line, void *arg) { virtio_9p_assign_local_driver(cmd_line, "security_model=mapped-xattr"); @@ -1161,6 +1237,7 @@ static void register_virtio_9p_test(void) qos_add_test("local/config", "virtio-9p", pci_config, &opts); qos_add_test("local/create_dir", "virtio-9p", fs_create_dir, &opts); qos_add_test("local/unlinkat_dir", "virtio-9p", fs_unlinkat_dir, &opts); + qos_add_test("local/create_file", "virtio-9p", fs_create_file, &opts); } libqos_init(register_virtio_9p_test); From patchwork Wed Oct 21 12:28:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71A79C4363A for ; Fri, 30 Oct 2020 14:58:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C56CA20727 for ; Fri, 30 Oct 2020 14:58:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="XaiDGNla" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C56CA20727 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVra-0002aO-PN for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 10:58:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVfQ-0001sJ-OX for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:13 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:57505) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYVfP-0003DE-A6 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=7iFIBZ5NpaoP5l93o3hNP52+z8dbWVQ86vHcSLemKEc=; b=XaiDG NlaDNfp6k+TdvzJU6mV0YVVJsYK9sEJzTqE9a1ZuYuI39ZX689ncsQ8I+t4v1qgfAvHIE1uXgyphO 7waIkOJXC8yZ2UsYYHFRavpUGcgKHSBfH8BOXTS4yyuYVfV9AqWWQhoEoILAckdp9nnzoE5AG62+a DGXt+8bNKit+d7HRGrx7iYI76vQVpb9P9cZcIrnLWcDCpodsdKs/mfq+BqpxQmutpX2LP3swlKizM eQcnDzf73TnZDJ6RoO4WOXkayNpPCy5TLeJBFRiuD+/RxDuC2rs0nIBdwXbUUUIe6zpfRqUnFfAO7 CX3vXHGjNpqEdKESZvKaPuuLnmOpQ==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Wed, 21 Oct 2020 14:28:37 +0200 Subject: [PULL v2 12/16] tests/9pfs: add local Tunlinkat file test To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=f088b18a7aff977f070ad6be5656ad8932c3c814@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This test case uses a Tunlinkat request to remove a regular file using the 9pfs 'local' fs driver. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <4eabeed7f662721dd5664cb77fe36ea0aa08b1ec.1603285620.git.qemu_oss@crudebyte.com> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index c030bc2a6c..6b74a1fd7e 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -1196,6 +1196,29 @@ static void fs_create_file(void *obj, void *data, QGuestAllocator *t_alloc) g_free(new_file); } +static void fs_unlinkat_file(void *obj, void *data, QGuestAllocator *t_alloc) +{ + QVirtio9P *v9p = obj; + alloc = t_alloc; + struct stat st; + char *new_file = virtio_9p_test_path("04/doa_file"); + + do_attach(v9p); + do_mkdir(v9p, "/", "04"); + do_lcreate(v9p, "04", "doa_file"); + + /* check if created file exists now ... */ + g_assert(stat(new_file, &st) == 0); + /* ... and is a regular file */ + g_assert((st.st_mode & S_IFMT) == S_IFREG); + + do_unlinkat(v9p, "04", "doa_file", 0); + /* file should be gone now */ + g_assert(stat(new_file, &st) != 0); + + g_free(new_file); +} + static void *assign_9p_local_driver(GString *cmd_line, void *arg) { virtio_9p_assign_local_driver(cmd_line, "security_model=mapped-xattr"); @@ -1238,6 +1261,7 @@ static void register_virtio_9p_test(void) qos_add_test("local/create_dir", "virtio-9p", fs_create_dir, &opts); qos_add_test("local/unlinkat_dir", "virtio-9p", fs_unlinkat_dir, &opts); qos_add_test("local/create_file", "virtio-9p", fs_create_file, &opts); + qos_add_test("local/unlinkat_file", "virtio-9p", fs_unlinkat_file, &opts); } libqos_init(register_virtio_9p_test); From patchwork Wed Oct 21 12:36:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 316485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EA24C4363A for ; Fri, 30 Oct 2020 15:01:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 80B242075E for ; Fri, 30 Oct 2020 15:01:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=crudebyte.com header.i=@crudebyte.com header.b="NTGK882n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80B242075E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVu9-0005Vc-Fg for qemu-devel@archiver.kernel.org; Fri, 30 Oct 2020 11:01:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <96b8ba44336e37f6fc641b36fdff0a960a3d0869@lizzy.crudebyte.com>) id 1kYVff-0002Gl-2J for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:27 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:47715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <96b8ba44336e37f6fc641b36fdff0a960a3d0869@lizzy.crudebyte.com>) id 1kYVfd-0003KY-Di for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:46:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=RRYV2V8efYiYdm3SDBKXqfdnY+J0tgfzztDfqmMM+x4=; b=NTGK8 82nVFoYWs1KOI3aLrtkHrFwdHdw6wRykKKo+19S4D06gAdSfGipDuU/oc4ZwOEg1FDaaN37wDC/Fv lITT9Bt58PH2Y9L7mgTFHXzbhkDPz/jlbaoHTkJ9YEJR3wAmCBZbHRP+1XvhA7DvPZQzqurBzyP+m 8Hpun2Xye1vDYGViaioxUCgGxYZyAJ6dmZKu9g1eXqMtCZsw6GMHk5MvoA3r5fe+O0nBa7EQHawEN Yi9AOVlQgEMnidsRrnm3obUJb8je30X9Wjt4ToPZACqQ6jY208UhDXru6mc9m/VAWIYwJqR+12mTh 7JdG+2oFFXuXNXVwANjXujdyJUtYQ==; Message-Id: <96b8ba44336e37f6fc641b36fdff0a960a3d0869.1604067568.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Wed, 21 Oct 2020 14:36:23 +0200 Subject: [PULL v2 14/16] tests/9pfs: add local Tunlinkat symlink test To: qemu-devel@nongnu.org, Peter Maydell Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=96b8ba44336e37f6fc641b36fdff0a960a3d0869@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 07:59:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This test case uses a Tunlinkat request to remove a symlink using the 9pfs 'local' fs driver. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 0c11417236..33cba24b18 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -1295,6 +1295,32 @@ static void fs_symlink_file(void *obj, void *data, QGuestAllocator *t_alloc) g_free(real_file); } +static void fs_unlinkat_symlink(void *obj, void *data, + QGuestAllocator *t_alloc) +{ + QVirtio9P *v9p = obj; + alloc = t_alloc; + struct stat st; + char *real_file = virtio_9p_test_path("06/real_file"); + char *symlink_file = virtio_9p_test_path("06/symlink_file"); + + do_attach(v9p); + do_mkdir(v9p, "/", "06"); + do_lcreate(v9p, "06", "real_file"); + g_assert(stat(real_file, &st) == 0); + g_assert((st.st_mode & S_IFMT) == S_IFREG); + + do_symlink(v9p, "06", "symlink_file", "real_file"); + g_assert(stat(symlink_file, &st) == 0); + + do_unlinkat(v9p, "06", "symlink_file", 0); + /* symlink should be gone now */ + g_assert(stat(symlink_file, &st) != 0); + + g_free(symlink_file); + g_free(real_file); +} + static void *assign_9p_local_driver(GString *cmd_line, void *arg) { virtio_9p_assign_local_driver(cmd_line, "security_model=mapped-xattr"); @@ -1339,6 +1365,8 @@ static void register_virtio_9p_test(void) qos_add_test("local/create_file", "virtio-9p", fs_create_file, &opts); qos_add_test("local/unlinkat_file", "virtio-9p", fs_unlinkat_file, &opts); qos_add_test("local/symlink_file", "virtio-9p", fs_symlink_file, &opts); + qos_add_test("local/unlinkat_symlink", "virtio-9p", fs_unlinkat_symlink, + &opts); } libqos_init(register_virtio_9p_test);