From nobody Thu May 16 03:52:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1711532004; cv=none; d=zohomail.com; s=zohoarc; b=YT96AMXQHymcJoBtQJvkDbWklo8hBcTcOV8YsfWcpNNtPj9ha9Dxsb8/MUkXLyB6A4FEBx1siaVsvrnSm41OVxdecTVWxVk73M9cqdiGBBbUHk9RNc+wPHU180zD+0P05OcZpBjgg7lkCbEP+RiyDbPkMUTU0/0MQZUbJTB10+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711532004; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cr2RMbcAw0+JQljknmBuPqVal2V2vcT8l1MqfVteyqg=; b=jjjR0d0np3EBa6oA6+AxkCSA1qZgbgIAaX/WH57QIi0PGGp3y9fEqFlxBz3EcjbR4SvGBe9HnVQlIUjU5F52ruUdYIVy6LJv4sZcD5yVoeZ5lE9/Za/mawb3z9hhPhyaEXZofZUMFOggsZ6Jqkg/bkR2a70IivOQyIxHiFKnM6c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711532004417775.1237405013372; Wed, 27 Mar 2024 02:33:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPdm-0006Aa-7n; Wed, 27 Mar 2024 05:32:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpPda-00067b-O3 for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:08 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPdU-0007dY-Kb for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:00 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e6f69e850bso5885522b3a.0 for ; Wed, 27 Mar 2024 02:31:55 -0700 (PDT) Received: from grind.. ([177.45.186.241]) by smtp.gmail.com with ESMTPSA id fm23-20020a056a002f9700b006e6b41511fdsm7628760pfb.94.2024.03.27.02.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711531914; x=1712136714; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cr2RMbcAw0+JQljknmBuPqVal2V2vcT8l1MqfVteyqg=; b=E+7NVQW2bC3huOxCR+7ursnoOzjJKlhpyFLB+dA25HFpePR6hj+J8z+JonlGAZ0C2/ hN80c6P40Cq6bomuO7eClaM7+1wQyeVzlPj3jAk1jKJiV/fVP7+gPbZXT/aUpHWDq+9U ZolR7yx9z0IQNyPj4Kziar2O1zej1C58UVz9t2LorIO38RRm7gfDr+lWCCneDB9xd9os fRj5D5TslDYEIjBVlJ+3qWJYyzVm9QY4ygA5pbpKuZ5dxcyYQAQOu23FCkFWvHnblxe7 M1KiAdf1+wB45rKhBW1F2iLVXqKarwxUq0W/jRlU0EBLmQ9mFLqSLirPxs5N4ycnvIfT kP0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711531914; x=1712136714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cr2RMbcAw0+JQljknmBuPqVal2V2vcT8l1MqfVteyqg=; b=M6YKxfmevum3U7n3M/iPBHNI0gxAAht0f64+4rhHP4VHvZnV2JbargRoHojQOfU6As AXvQNmR3BlxWUop4tOs2bZAvArVhEsEs9hJnb78CTAH8Ha2XnbbxfIJjdNF/MFM7oWYe Ov706WJpVI1h4hTqqQSdkrZvudSvWUimCRB7ZZVHwy86YUg/wAtVuwJXpmi9xVI2kGtt p5Mnrm5dBoNfdPr49QVcfLmyp8JTUHOsXICAY6W7gDO46DQTI96mv7SvCznDCLfp69cm FXJkIf0BAAp1nRSb8waRRrPiV+rQtfgFabRRWZo/Y8mecvZDU+PhiTJwwKuo6AwUlpmo zxAQ== X-Gm-Message-State: AOJu0Yy9f24FJiQaziy4/EqsEfOOjKXE633ICc15/4emie8oo5sE6efd 4okaTNcq+tlm0xPKq10kt2QN0NmmdXtO+ch8huv4zHTfJqjS8oiEtptcKYb2/WwuUHsk2F8D7TS g X-Google-Smtp-Source: AGHT+IEDwg25E0KBHXl7/65jGZC6Bjj0ZbX0uKR6UZEPXcK7VLqYs3mZBd0rfkXcrrxRDhGw5oQlhA== X-Received: by 2002:a05:6a00:178e:b0:6ea:b1f5:1146 with SMTP id s14-20020a056a00178e00b006eab1f51146mr4458179pfg.21.1711531913729; Wed, 27 Mar 2024 02:31:53 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: thuth@redhat.com, alistair.francis@wdc.com, groug@kaod.org, peter.maydell@linaro.org, qemu_oss@crudebyte.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 1/7] qtest/virtio-9p-test.c: add '_path' in path vars Date: Wed, 27 Mar 2024 06:31:38 -0300 Message-ID: <20240327093144.781701-2-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327093144.781701-1-dbarboza@ventanamicro.com> References: <20240327093144.781701-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x429.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1711532006730100007 Content-Type: text/plain; charset="utf-8" Add a '_path' call in all variables that are receiving a full path via virtio_9p_test_path(). Aside from being more accurate with what the variable represents, this will allow us to use 'new_dir' and 'real_path' and so on to parametrize test values in the next patch. Signed-off-by: Daniel Henrique Barboza Tested-by. You're more than welcome to give this version a try :) --- tests/qtest/virtio-9p-test.c | 64 ++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 65e69491e5..23edca05c5 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -512,7 +512,7 @@ static void fs_create_dir(void *obj, void *data, QGuest= Allocator *t_alloc) v9fs_set_allocator(t_alloc); struct stat st; g_autofree char *root_path =3D virtio_9p_test_path(""); - g_autofree char *new_dir =3D virtio_9p_test_path("01"); + g_autofree char *new_dir_path =3D virtio_9p_test_path("01"); =20 g_assert(root_path !=3D NULL); =20 @@ -520,7 +520,7 @@ static void fs_create_dir(void *obj, void *data, QGuest= Allocator *t_alloc) tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "01" }); =20 /* check if created directory really exists now ... */ - g_assert(stat(new_dir, &st) =3D=3D 0); + g_assert(stat(new_dir_path, &st) =3D=3D 0); /* ... and is actually a directory */ g_assert((st.st_mode & S_IFMT) =3D=3D S_IFDIR); } @@ -531,7 +531,7 @@ static void fs_unlinkat_dir(void *obj, void *data, QGue= stAllocator *t_alloc) v9fs_set_allocator(t_alloc); struct stat st; g_autofree char *root_path =3D virtio_9p_test_path(""); - g_autofree char *new_dir =3D virtio_9p_test_path("02"); + g_autofree char *new_dir_path =3D virtio_9p_test_path("02"); =20 g_assert(root_path !=3D NULL); =20 @@ -539,7 +539,7 @@ static void fs_unlinkat_dir(void *obj, void *data, QGue= stAllocator *t_alloc) tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "02" }); =20 /* check if created directory really exists now ... */ - g_assert(stat(new_dir, &st) =3D=3D 0); + g_assert(stat(new_dir_path, &st) =3D=3D 0); /* ... and is actually a directory */ g_assert((st.st_mode & S_IFMT) =3D=3D S_IFDIR); =20 @@ -548,7 +548,7 @@ static void fs_unlinkat_dir(void *obj, void *data, QGue= stAllocator *t_alloc) .flags =3D P9_DOTL_AT_REMOVEDIR }); /* directory should be gone now */ - g_assert(stat(new_dir, &st) !=3D 0); + g_assert(stat(new_dir_path, &st) !=3D 0); } =20 static void fs_create_file(void *obj, void *data, QGuestAllocator *t_alloc) @@ -556,14 +556,14 @@ static void fs_create_file(void *obj, void *data, QGu= estAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *new_file =3D virtio_9p_test_path("03/1st_file"); + g_autofree char *new_file_path =3D virtio_9p_test_path("03/1st_file"); =20 tattach({ .client =3D v9p }); tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "03" }); tlcreate({ .client =3D v9p, .atPath =3D "03", .name =3D "1st_file" }); =20 /* check if created file exists now ... */ - g_assert(stat(new_file, &st) =3D=3D 0); + g_assert(stat(new_file_path, &st) =3D=3D 0); /* ... and is a regular file */ g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); } @@ -573,20 +573,20 @@ static void fs_unlinkat_file(void *obj, void *data, Q= GuestAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *new_file =3D virtio_9p_test_path("04/doa_file"); + g_autofree char *new_file_path =3D virtio_9p_test_path("04/doa_file"); =20 tattach({ .client =3D v9p }); tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "04" }); tlcreate({ .client =3D v9p, .atPath =3D "04", .name =3D "doa_file" }); =20 /* check if created file exists now ... */ - g_assert(stat(new_file, &st) =3D=3D 0); + g_assert(stat(new_file_path, &st) =3D=3D 0); /* ... and is a regular file */ g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tunlinkat({ .client =3D v9p, .atPath =3D "04", .name =3D "doa_file" }); /* file should be gone now */ - g_assert(stat(new_file, &st) !=3D 0); + g_assert(stat(new_file_path, &st) !=3D 0); } =20 static void fs_symlink_file(void *obj, void *data, QGuestAllocator *t_allo= c) @@ -594,13 +594,13 @@ static void fs_symlink_file(void *obj, void *data, QG= uestAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *real_file =3D virtio_9p_test_path("05/real_file"); - g_autofree char *symlink_file =3D virtio_9p_test_path("05/symlink_file= "); + g_autofree char *real_file_path =3D virtio_9p_test_path("05/real_file"= ); + g_autofree char *symlink_file_path =3D virtio_9p_test_path("05/symlink= _file"); =20 tattach({ .client =3D v9p }); tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "05" }); tlcreate({ .client =3D v9p, .atPath =3D "05", .name =3D "real_file" }); - g_assert(stat(real_file, &st) =3D=3D 0); + g_assert(stat(real_file_path, &st) =3D=3D 0); g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tsymlink({ @@ -609,7 +609,7 @@ static void fs_symlink_file(void *obj, void *data, QGue= stAllocator *t_alloc) }); =20 /* check if created link exists now */ - g_assert(stat(symlink_file, &st) =3D=3D 0); + g_assert(stat(symlink_file_path, &st) =3D=3D 0); } =20 static void fs_unlinkat_symlink(void *obj, void *data, @@ -618,24 +618,24 @@ static void fs_unlinkat_symlink(void *obj, void *data, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *real_file =3D virtio_9p_test_path("06/real_file"); - g_autofree char *symlink_file =3D virtio_9p_test_path("06/symlink_file= "); + g_autofree char *real_file_path =3D virtio_9p_test_path("06/real_file"= ); + g_autofree char *symlink_file_path =3D virtio_9p_test_path("06/symlink= _file"); =20 tattach({ .client =3D v9p }); tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "06" }); tlcreate({ .client =3D v9p, .atPath =3D "06", .name =3D "real_file" }); - g_assert(stat(real_file, &st) =3D=3D 0); + g_assert(stat(real_file_path, &st) =3D=3D 0); g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tsymlink({ .client =3D v9p, .atPath =3D "06", .name =3D "symlink_file", .symtgt =3D "real_file" }); - g_assert(stat(symlink_file, &st) =3D=3D 0); + g_assert(stat(symlink_file_path, &st) =3D=3D 0); =20 tunlinkat({ .client =3D v9p, .atPath =3D "06", .name =3D "symlink_file= " }); /* symlink should be gone now */ - g_assert(stat(symlink_file, &st) !=3D 0); + g_assert(stat(symlink_file_path, &st) !=3D 0); } =20 static void fs_hardlink_file(void *obj, void *data, QGuestAllocator *t_all= oc) @@ -643,13 +643,16 @@ static void fs_hardlink_file(void *obj, void *data, Q= GuestAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - g_autofree char *real_file =3D virtio_9p_test_path("07/real_file"); - g_autofree char *hardlink_file =3D virtio_9p_test_path("07/hardlink_fi= le"); + g_autofree char *real_file_path =3D NULL; + g_autofree char *hardlink_file_path =3D NULL; + + real_file_path =3D virtio_9p_test_path("07/real_file"); + hardlink_file_path =3D virtio_9p_test_path("07/hardlink_file"); =20 tattach({ .client =3D v9p }); tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "07" }); tlcreate({ .client =3D v9p, .atPath =3D "07", .name =3D "real_file" }); - g_assert(stat(real_file, &st_real) =3D=3D 0); + g_assert(stat(real_file_path, &st_real) =3D=3D 0); g_assert((st_real.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tlink({ @@ -658,7 +661,7 @@ static void fs_hardlink_file(void *obj, void *data, QGu= estAllocator *t_alloc) }); =20 /* check if link exists now ... */ - g_assert(stat(hardlink_file, &st_link) =3D=3D 0); + g_assert(stat(hardlink_file_path, &st_link) =3D=3D 0); /* ... and it's a hard link, right? */ g_assert((st_link.st_mode & S_IFMT) =3D=3D S_IFREG); g_assert(st_link.st_dev =3D=3D st_real.st_dev); @@ -671,26 +674,29 @@ static void fs_unlinkat_hardlink(void *obj, void *dat= a, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - g_autofree char *real_file =3D virtio_9p_test_path("08/real_file"); - g_autofree char *hardlink_file =3D virtio_9p_test_path("08/hardlink_fi= le"); + g_autofree char *real_file_path =3D NULL; + g_autofree char *hardlink_file_path =3D NULL; + + real_file_path =3D virtio_9p_test_path("08/real_file"); + hardlink_file_path =3D virtio_9p_test_path("08/hardlink_file"); =20 tattach({ .client =3D v9p }); tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "08" }); tlcreate({ .client =3D v9p, .atPath =3D "08", .name =3D "real_file" }); - g_assert(stat(real_file, &st_real) =3D=3D 0); + g_assert(stat(real_file_path, &st_real) =3D=3D 0); g_assert((st_real.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tlink({ .client =3D v9p, .atPath =3D "08", .name =3D "hardlink_file", .toPath =3D "08/real_file" }); - g_assert(stat(hardlink_file, &st_link) =3D=3D 0); + g_assert(stat(hardlink_file_path, &st_link) =3D=3D 0); =20 tunlinkat({ .client =3D v9p, .atPath =3D "08", .name =3D "hardlink_fil= e" }); /* symlink should be gone now */ - g_assert(stat(hardlink_file, &st_link) !=3D 0); + g_assert(stat(hardlink_file_path, &st_link) !=3D 0); /* and old file should still exist */ - g_assert(stat(real_file, &st_real) =3D=3D 0); + g_assert(stat(real_file_path, &st_real) =3D=3D 0); } =20 static void *assign_9p_local_driver(GString *cmd_line, void *arg) --=20 2.44.0 From nobody Thu May 16 03:52:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1711532043; cv=none; d=zohomail.com; s=zohoarc; b=E0KZ8sTSbX0QWQEVhxM6RUMk5M8RKs3dIPO+wDv/Exol2sOBhQBmQTXbTu7UNZAegK8dfrEK+Ndc+H1Cil89T2CrJGOl7XWRpbO2COXZSDvmnPpCtR3zqCd64mlXkVxEvKaRY3zXmMq8Tm+s4kJohm5SXm18XKBCL8EAzheg1J4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711532043; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1rCi//3DuQeWhizcKM3Yysq2ZSYZlpAxINwDElJYRZA=; b=kyh0I9LC9/TdDMyu4QnLBtxVgMBYiXut8HEKp+Dg7gfoinmjhAlVK+cM2W4jcpXuLpozifnMtT8DNYiifAX7KfgPTDN6lHm04mnHKZUJnGh57A/LGAUZl9S/XKttoMjLFoxKTR4ZHAN7A/qBi6kfntsPfvFjzB80RVmVDzET/jo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711532043424305.7294081681523; Wed, 27 Mar 2024 02:34:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPdn-0006At-9S; Wed, 27 Mar 2024 05:32:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpPda-00067c-SV for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:08 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPdW-0007fU-Fu for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:02 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6ea838bf357so3735532b3a.0 for ; Wed, 27 Mar 2024 02:31:58 -0700 (PDT) Received: from grind.. ([177.45.186.241]) by smtp.gmail.com with ESMTPSA id fm23-20020a056a002f9700b006e6b41511fdsm7628760pfb.94.2024.03.27.02.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711531916; x=1712136716; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1rCi//3DuQeWhizcKM3Yysq2ZSYZlpAxINwDElJYRZA=; b=QZJpRW1ONv9TFvtE4RSXIyYMR9iRjrjWuuIGEBZnB71KvZc2jG8II8u5AN9hhVOGxI xDcxsXKRxzANQayosZj2syRxt7WTj2U2ULC0Wf++7kFMl0S0uTonzJlX97Iu0f0X5k4l 4qMRTSD1RuHyeoriEYtRL3+gZmziM5WhJClcWePzsx9634HJfvhiC9SVX3nyS7Khc03Z nh8YE30zBck4vBmq7Cw9y2Vq5Vcv03pgd1CAl+7ywlJjrR8P5RSCvm3qd0tOawy/T1GA sp2TuFSXqLyyIenITBlp8fEQ2MW9N3J30skB7QDbgyeqoA7FEu3tmnqkBlswfYhFy+Sd 2+Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711531916; x=1712136716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1rCi//3DuQeWhizcKM3Yysq2ZSYZlpAxINwDElJYRZA=; b=A1KrV/1bNK94Y/n4jAP1XHiIQ/LdMq04oZtN8r4zSn4K8c4IBQ6PMwdR13TlerQUQH E7ENwRqONhYh3o3LJS8Ly6TGqUexGS+Jtp5dgi7oaqIQaLlz3hiROMjZoEeclMZn4Uuj YrCYFkwE7lOwNaOTKRLi/wFyuGdP5jZ3I0416MztIxQiA/VDwyWsiWqXCS3LDpN1igCt J3gEQVim9pjZHRXNOQkXwx1iHVTwXZTl/4tztm7BbCn1pXwmOJHDkLXclX9L1CrBzutS n7GCVpjoHLUFBY1uzCXb+wdZWYlxmYfdjFaBwCT01a9w3i9WlahC9U4o8zPiDLEZDllz aU7A== X-Gm-Message-State: AOJu0YzbSPN7I/w1/+zzKXR7BDZ3m+1/wJd6jDPfXWrf3pu/s6N3W30P QPwbpKMRtysO0KpyxcoiFyFNlM+1wMMHw+8sfdLhqxZ8FN7OYcZnVXlwgdnX982uBzVdzQT+9g2 w X-Google-Smtp-Source: AGHT+IGphlMuBTEXdnzWJ5LvppfwIgjWinWInp9O3bKarX2iCsBtCXOzczHFUHIKHpybBIrmWSv6BA== X-Received: by 2002:a05:6a20:2446:b0:1a3:e2ed:62af with SMTP id t6-20020a056a20244600b001a3e2ed62afmr1709034pzc.34.1711531916505; Wed, 27 Mar 2024 02:31:56 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: thuth@redhat.com, alistair.francis@wdc.com, groug@kaod.org, peter.maydell@linaro.org, qemu_oss@crudebyte.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 2/7] qtest/virtio-9p-test.c: parametrize 'dir' name in local tests Date: Wed, 27 Mar 2024 06:31:39 -0300 Message-ID: <20240327093144.781701-3-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327093144.781701-1-dbarboza@ventanamicro.com> References: <20240327093144.781701-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42a.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1711532044818100003 Content-Type: text/plain; charset="utf-8" All local 9p tests creates a different dir inside tempdir, where '01' is the dir for the first test, '02' the dir fot the second test and so on. We want to make tests autoclean themselves while also consolidating them in fewer tests, but this will incur a lot of dir changes that will be unpleasant to deal with at it is today - the dir name is hard coded in every 9p API call. Add a 'new_dir' var in each test that will hold the created dir name. If the test also creates new files/symlinks, parametrize them as well since they also use the dir name. After these changes, changing the val of "new_dir" will change all dir references the test uses. Signed-off-by: Daniel Henrique Barboza Tested-by. You're more than welcome to give this version a try :) --- tests/qtest/virtio-9p-test.c | 108 +++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 36 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 23edca05c5..be031abc17 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -511,13 +511,14 @@ static void fs_create_dir(void *obj, void *data, QGue= stAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; + const char *new_dir =3D "01"; g_autofree char *root_path =3D virtio_9p_test_path(""); - g_autofree char *new_dir_path =3D virtio_9p_test_path("01"); + g_autofree char *new_dir_path =3D virtio_9p_test_path(new_dir); =20 g_assert(root_path !=3D NULL); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "01" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); =20 /* check if created directory really exists now ... */ g_assert(stat(new_dir_path, &st) =3D=3D 0); @@ -530,13 +531,14 @@ static void fs_unlinkat_dir(void *obj, void *data, QG= uestAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; + const char *new_dir =3D "02"; g_autofree char *root_path =3D virtio_9p_test_path(""); - g_autofree char *new_dir_path =3D virtio_9p_test_path("02"); + g_autofree char *new_dir_path =3D virtio_9p_test_path(new_dir); =20 g_assert(root_path !=3D NULL); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "02" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); =20 /* check if created directory really exists now ... */ g_assert(stat(new_dir_path, &st) =3D=3D 0); @@ -544,7 +546,7 @@ static void fs_unlinkat_dir(void *obj, void *data, QGue= stAllocator *t_alloc) g_assert((st.st_mode & S_IFMT) =3D=3D S_IFDIR); =20 tunlinkat({ - .client =3D v9p, .atPath =3D "/", .name =3D "02", + .client =3D v9p, .atPath =3D "/", .name =3D new_dir, .flags =3D P9_DOTL_AT_REMOVEDIR }); /* directory should be gone now */ @@ -556,11 +558,13 @@ static void fs_create_file(void *obj, void *data, QGu= estAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *new_file_path =3D virtio_9p_test_path("03/1st_file"); + const char *new_dir =3D "03"; + g_autofree char *new_file =3D g_strdup_printf("%s/%s", new_dir, "1st_f= ile"); + g_autofree char *new_file_path =3D virtio_9p_test_path(new_file); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "03" }); - tlcreate({ .client =3D v9p, .atPath =3D "03", .name =3D "1st_file" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); + tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "1st_file" = }); =20 /* check if created file exists now ... */ g_assert(stat(new_file_path, &st) =3D=3D 0); @@ -573,18 +577,20 @@ static void fs_unlinkat_file(void *obj, void *data, Q= GuestAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *new_file_path =3D virtio_9p_test_path("04/doa_file"); + const char *new_dir =3D "04"; + g_autofree char *new_file =3D g_strdup_printf("%s/%s", new_dir, "doa_f= ile"); + g_autofree char *new_file_path =3D virtio_9p_test_path(new_file); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "04" }); - tlcreate({ .client =3D v9p, .atPath =3D "04", .name =3D "doa_file" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); + tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "doa_file" = }); =20 /* check if created file exists now ... */ g_assert(stat(new_file_path, &st) =3D=3D 0); /* ... and is a regular file */ g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); =20 - tunlinkat({ .client =3D v9p, .atPath =3D "04", .name =3D "doa_file" }); + tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "doa_file"= }); /* file should be gone now */ g_assert(stat(new_file_path, &st) !=3D 0); } @@ -594,17 +600,26 @@ static void fs_symlink_file(void *obj, void *data, QG= uestAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *real_file_path =3D virtio_9p_test_path("05/real_file"= ); - g_autofree char *symlink_file_path =3D virtio_9p_test_path("05/symlink= _file"); + const char *new_dir =3D "05"; + g_autofree char *real_file =3D NULL; + g_autofree char *real_file_path =3D NULL; + g_autofree char *symlink_file =3D NULL; + g_autofree char *symlink_file_path =3D NULL; + + real_file =3D g_strdup_printf("%s/%s", new_dir, "real_file"); + real_file_path =3D virtio_9p_test_path(real_file); + + symlink_file =3D g_strdup_printf("%s/%s", new_dir, "symlink_file"); + symlink_file_path =3D virtio_9p_test_path(symlink_file); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "05" }); - tlcreate({ .client =3D v9p, .atPath =3D "05", .name =3D "real_file" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); + tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file"= }); g_assert(stat(real_file_path, &st) =3D=3D 0); g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tsymlink({ - .client =3D v9p, .atPath =3D "05", .name =3D "symlink_file", + .client =3D v9p, .atPath =3D new_dir, .name =3D "symlink_file", .symtgt =3D "real_file" }); =20 @@ -618,22 +633,31 @@ static void fs_unlinkat_symlink(void *obj, void *data, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - g_autofree char *real_file_path =3D virtio_9p_test_path("06/real_file"= ); - g_autofree char *symlink_file_path =3D virtio_9p_test_path("06/symlink= _file"); + const char *new_dir =3D "06"; + g_autofree char *real_file =3D NULL; + g_autofree char *real_file_path =3D NULL; + g_autofree char *symlink_file =3D NULL; + g_autofree char *symlink_file_path =3D NULL; + + real_file =3D g_strdup_printf("%s/%s", new_dir, "real_file"); + real_file_path =3D virtio_9p_test_path(real_file); + + symlink_file =3D g_strdup_printf("%s/%s", new_dir, "symlink_file"); + symlink_file_path =3D virtio_9p_test_path(symlink_file); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "06" }); - tlcreate({ .client =3D v9p, .atPath =3D "06", .name =3D "real_file" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); + tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file"= }); g_assert(stat(real_file_path, &st) =3D=3D 0); g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tsymlink({ - .client =3D v9p, .atPath =3D "06", .name =3D "symlink_file", + .client =3D v9p, .atPath =3D new_dir, .name =3D "symlink_file", .symtgt =3D "real_file" }); g_assert(stat(symlink_file_path, &st) =3D=3D 0); =20 - tunlinkat({ .client =3D v9p, .atPath =3D "06", .name =3D "symlink_file= " }); + tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "symlink_f= ile" }); /* symlink should be gone now */ g_assert(stat(symlink_file_path, &st) !=3D 0); } @@ -643,21 +667,27 @@ static void fs_hardlink_file(void *obj, void *data, Q= GuestAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; + const char *new_dir =3D "07"; + g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; + g_autofree char *hardlink_file =3D NULL; g_autofree char *hardlink_file_path =3D NULL; =20 - real_file_path =3D virtio_9p_test_path("07/real_file"); - hardlink_file_path =3D virtio_9p_test_path("07/hardlink_file"); + real_file =3D g_strdup_printf("%s/%s", new_dir, "real_file"); + real_file_path =3D virtio_9p_test_path(real_file); + + hardlink_file =3D g_strdup_printf("%s/%s", new_dir, "hardlink_file"); + hardlink_file_path =3D virtio_9p_test_path(hardlink_file); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "07" }); - tlcreate({ .client =3D v9p, .atPath =3D "07", .name =3D "real_file" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); + tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file"= }); g_assert(stat(real_file_path, &st_real) =3D=3D 0); g_assert((st_real.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tlink({ - .client =3D v9p, .atPath =3D "07", .name =3D "hardlink_file", - .toPath =3D "07/real_file" + .client =3D v9p, .atPath =3D new_dir, .name =3D "hardlink_file", + .toPath =3D real_file }); =20 /* check if link exists now ... */ @@ -674,25 +704,31 @@ static void fs_unlinkat_hardlink(void *obj, void *dat= a, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; + const char *new_dir =3D "08"; + g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; + g_autofree char *hardlink_file =3D NULL; g_autofree char *hardlink_file_path =3D NULL; =20 - real_file_path =3D virtio_9p_test_path("08/real_file"); - hardlink_file_path =3D virtio_9p_test_path("08/hardlink_file"); + real_file =3D g_strdup_printf("%s/%s", new_dir, "real_file"); + real_file_path =3D virtio_9p_test_path(real_file); + + hardlink_file =3D g_strdup_printf("%s/%s", new_dir, "hardlink_file"); + hardlink_file_path =3D virtio_9p_test_path(hardlink_file); =20 tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D "08" }); - tlcreate({ .client =3D v9p, .atPath =3D "08", .name =3D "real_file" }); + tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); + tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file"= }); g_assert(stat(real_file_path, &st_real) =3D=3D 0); g_assert((st_real.st_mode & S_IFMT) =3D=3D S_IFREG); =20 tlink({ - .client =3D v9p, .atPath =3D "08", .name =3D "hardlink_file", - .toPath =3D "08/real_file" + .client =3D v9p, .atPath =3D new_dir, .name =3D "hardlink_file", + .toPath =3D real_file }); g_assert(stat(hardlink_file_path, &st_link) =3D=3D 0); =20 - tunlinkat({ .client =3D v9p, .atPath =3D "08", .name =3D "hardlink_fil= e" }); + tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "hardlink_= file" }); /* symlink should be gone now */ g_assert(stat(hardlink_file_path, &st_link) !=3D 0); /* and old file should still exist */ --=20 2.44.0 From nobody Thu May 16 03:52:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1711532035; cv=none; d=zohomail.com; s=zohoarc; b=VEmBK2kRcBP5oGz+6ps99yLdUW7J1tLx5Xxi5frRwSwG1nN1Mdn1X4so637buAoJkKwZhmRiGf1+2MWOd2vzpS2/RGOgY/dcIOJQmvby8XQNFbP9LlC9SYjNSYTj70hyrTP5zasaUO6dY2+O5ZD1k8/Aj9fzLHNUbZchY0Vh35k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711532035; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WyRw4RpAUjMROWRxa8n83txCjmXC/d2qLnvcFPrpXT0=; b=C5MI3CtLOS+llj8zlRQ6OUBtvENuykTMC6bHeIzWEMfrpcZ/VhAPOOoICHhgZBuNj78YZWa7iaB8EGVdRHNokh56dP+9jkFxJAHz0+1FMAagUk1ACzIXS6DHP9TBBhaqmP07sUyFNg6MO2FT8Ob7nynR1b1op2BG8YsuhHoFYH0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711532035899871.1872623890497; Wed, 27 Mar 2024 02:33:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPdo-0006Bh-TQ; Wed, 27 Mar 2024 05:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpPdc-00067v-L0 for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:08 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPda-0007gK-7Z for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:04 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-22a353217c3so1560549fac.1 for ; Wed, 27 Mar 2024 02:32:01 -0700 (PDT) Received: from grind.. ([177.45.186.241]) by smtp.gmail.com with ESMTPSA id fm23-20020a056a002f9700b006e6b41511fdsm7628760pfb.94.2024.03.27.02.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711531919; x=1712136719; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WyRw4RpAUjMROWRxa8n83txCjmXC/d2qLnvcFPrpXT0=; b=IoKPvo7KI7JQQ6FO9i70YZOdabMQB80CL+Gc6EIfd1//uMbsrlhGgLHTlqfo8klCeQ uiqY6Pln2dZq3RJndFqvVvdZtMYYF276x5sE5V2vSogQ5wJUdE/qeX9jszHI6mVBA+4r o+kVvQF7umJPDYuy2n/83F0Y45s2Z/SZRRSqwBCd6UUguIdsiKywP5dxWEsg+4YDqIAg xMUvvCivxvZNhGCZBJPxo5kWreBWXBCBlojprv57s6xu7kFqQFfHFzbt/S0T5vvEKVd5 Hq24ciE4lTn18UDmE0T9RmKMG0zxsm7kxkFFJYBDFz7KWS7JDV7jsWyi5hnYJwkySXU/ MYNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711531919; x=1712136719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WyRw4RpAUjMROWRxa8n83txCjmXC/d2qLnvcFPrpXT0=; b=pRab/aYFNaJGiSspz+L8851GdNWHY35X9KHtYJlHBd4+ldYey2/TFUo+0D+5eSnTkT dMph7iwOraXnt2Ok56lKIt73IetTmvqJATD0rluMlapFrODdse2VmohFZTy5QekZ3Fef pgzfdVYT8l+NBoSbII338kvEdKb8T6HoOgE0m5AuweTSOzd6h1oSVSDh18qQLqvYRryg nhoKn5kcVc453187NFVrSSla/aiJ8VLbWsvdmGRdZ/O83QdIzLmogenjjzzXy2nQI8vz vKrpyWBKpGr9wXbYP6UCf6hlncI0e35nYhPlK/zsNZRltgvPdvKMuyB++Oi8YocS76MQ wIEw== X-Gm-Message-State: AOJu0YzDzF32IjRYPp6szAARr0EsxJwUIYpunTwGCytSmyZkxIWJ/Xm+ H3QSbTz1goEiw2ZgSc2gK6Yec1rDNFq7dGiyU23LCTCuO57PUkFapH+QcTnc3LlW1Ou82KJGrpR P X-Google-Smtp-Source: AGHT+IG8YgU7L/GJNGMP5fw6uZ/FLqPFN9SAVIFv53bDx8dyHLlotZwzEZoscFQuzpf6Ri9TYGcBzg== X-Received: by 2002:a05:6870:b14c:b0:229:fe3c:b096 with SMTP id a12-20020a056870b14c00b00229fe3cb096mr2271071oal.32.1711531919139; Wed, 27 Mar 2024 02:31:59 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: thuth@redhat.com, alistair.francis@wdc.com, groug@kaod.org, peter.maydell@linaro.org, qemu_oss@crudebyte.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 3/7] qtest/virtio-9p-test.c: consolidate create dir tests Date: Wed, 27 Mar 2024 06:31:40 -0300 Message-ID: <20240327093144.781701-4-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327093144.781701-1-dbarboza@ventanamicro.com> References: <20240327093144.781701-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::35; envelope-from=dbarboza@ventanamicro.com; helo=mail-oa1-x35.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1711532036765100002 Content-Type: text/plain; charset="utf-8" The local 9p driver in virtio-9p-test.c its temporary dir right at the start of qos-test (via virtio_9p_create_local_test_dir()) and only deletes it after qos-test is finished (via virtio_9p_remove_local_test_dir()). This means that any qos-test machine that ends up running virtio-9p-test local tests more than once will end up re-using the same temp dir. This is what's happening in [1] after we introduced the riscv machine nodes: if we enable slow tests with the '-m slow' flag using qemu-system-riscv64, this is what happens: - a temp dir is created; - virtio-9p-device tests will run virtio-9p-test successfully; - virtio-9p-pci tests will run virtio-9p-test, and fail right at the first slow test at fs_create_dir() because the "01" file was already created by fs_create_dir() test when running with the virtio-9p-device. We can fix it by making every test clean up their changes in the filesystem after they're done. But we don't need every test either: what fs_create_file() does is already exercised in fs_unlinkat_dir(), i.e. a dir is created, verified to be created, and then removed. Fixing fs_create_file() would turn it into fs_unlinkat_dir(), so we don't need both. The same idea applies to every test in virtio-9p-test.c, where the 'unlinkat' variant does the same thing the 'create' does but with some cleaning in the end. But we'll start with fs_create_dir() and fs_unlinkat_dir() only: - fs_create_dir() is removed. s_unlinkat_dir() is renamed to fs_create_unlinkat_dir(); - update the dir names for every other test since we have 1 less test. [1] https://mail.gnu.org/archive/html/qemu-devel/2024-03/msg05807.html Reported-by: Thomas Huth Signed-off-by: Daniel Henrique Barboza Tested-by. You're more than welcome to give this version a try :) --- tests/qtest/virtio-9p-test.c | 39 +++++++++--------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index be031abc17..2cea1b4189 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -506,7 +506,8 @@ static void fs_readdir_split_512(void *obj, void *data, =20 /* tests using the 9pfs 'local' fs driver */ =20 -static void fs_create_dir(void *obj, void *data, QGuestAllocator *t_alloc) +static void fs_create_unlinkat_dir(void *obj, void *data, + QGuestAllocator *t_alloc) { QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); @@ -524,26 +525,6 @@ static void fs_create_dir(void *obj, void *data, QGues= tAllocator *t_alloc) g_assert(stat(new_dir_path, &st) =3D=3D 0); /* ... and is actually a directory */ g_assert((st.st_mode & S_IFMT) =3D=3D S_IFDIR); -} - -static void fs_unlinkat_dir(void *obj, void *data, QGuestAllocator *t_allo= c) -{ - QVirtio9P *v9p =3D obj; - v9fs_set_allocator(t_alloc); - struct stat st; - const char *new_dir =3D "02"; - g_autofree char *root_path =3D virtio_9p_test_path(""); - g_autofree char *new_dir_path =3D virtio_9p_test_path(new_dir); - - g_assert(root_path !=3D NULL); - - tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); - - /* check if created directory really exists now ... */ - g_assert(stat(new_dir_path, &st) =3D=3D 0); - /* ... and is actually a directory */ - g_assert((st.st_mode & S_IFMT) =3D=3D S_IFDIR); =20 tunlinkat({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir, @@ -558,7 +539,7 @@ static void fs_create_file(void *obj, void *data, QGues= tAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - const char *new_dir =3D "03"; + const char *new_dir =3D "02"; g_autofree char *new_file =3D g_strdup_printf("%s/%s", new_dir, "1st_f= ile"); g_autofree char *new_file_path =3D virtio_9p_test_path(new_file); =20 @@ -577,7 +558,7 @@ static void fs_unlinkat_file(void *obj, void *data, QGu= estAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - const char *new_dir =3D "04"; + const char *new_dir =3D "03"; g_autofree char *new_file =3D g_strdup_printf("%s/%s", new_dir, "doa_f= ile"); g_autofree char *new_file_path =3D virtio_9p_test_path(new_file); =20 @@ -600,7 +581,7 @@ static void fs_symlink_file(void *obj, void *data, QGue= stAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - const char *new_dir =3D "05"; + const char *new_dir =3D "04"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *symlink_file =3D NULL; @@ -633,7 +614,7 @@ static void fs_unlinkat_symlink(void *obj, void *data, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - const char *new_dir =3D "06"; + const char *new_dir =3D "05"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *symlink_file =3D NULL; @@ -667,7 +648,7 @@ static void fs_hardlink_file(void *obj, void *data, QGu= estAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - const char *new_dir =3D "07"; + const char *new_dir =3D "06"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *hardlink_file =3D NULL; @@ -704,7 +685,7 @@ static void fs_unlinkat_hardlink(void *obj, void *data, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - const char *new_dir =3D "08"; + const char *new_dir =3D "07"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *hardlink_file =3D NULL; @@ -788,8 +769,8 @@ static void register_virtio_9p_test(void) =20 opts.before =3D 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= ); + qos_add_test("local/create_unlinkat_dir", "virtio-9p", + fs_create_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, &op= ts); qos_add_test("local/symlink_file", "virtio-9p", fs_symlink_file, &opts= ); --=20 2.44.0 From nobody Thu May 16 03:52:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1711532012; cv=none; d=zohomail.com; s=zohoarc; b=eos/ir7D5Qy1oRKYMhmXz8jxO10B5HGpGxZTpmDj6gpRIJPdVqdF80P/8qbdMSJ0HR+Kd1Hzbd8h5Y5lwAEF0mgX07mYBRsdr0ZDiAd+HnTJCsg7lJmiiQV17Qv8DReDMkkBmbdtZZ4h0ddH7S16uY4r03R7Mi+6l5B6iY50NS4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711532012; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AZpweT3nmK6wwpDDzMjiVrCdC5R/qvdKZcUMpNV2zdM=; b=Gap2jGYNuzX6qTrkCV/UVzTIrkG1J+6pD5KikoRk2lh75uwL4EfnRRQVVhATz+Xlq0YANscWZ2NmTuOeIXN6PQ4TNrY7iARFCsFmMfy0GfH4wYrUdDhkH/YWTJtfdRULGtzht+Xr/YEzJO/e85Q2aRbn3HdwvymyEptW1UKB0Cc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711532012412304.5938983539718; Wed, 27 Mar 2024 02:33:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPdo-0006BA-5l; Wed, 27 Mar 2024 05:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpPdd-00067x-VX for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:08 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPdb-0007hQ-Hp for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:05 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6da202aa138so3253778b3a.2 for ; Wed, 27 Mar 2024 02:32:03 -0700 (PDT) Received: from grind.. ([177.45.186.241]) by smtp.gmail.com with ESMTPSA id fm23-20020a056a002f9700b006e6b41511fdsm7628760pfb.94.2024.03.27.02.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711531922; x=1712136722; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AZpweT3nmK6wwpDDzMjiVrCdC5R/qvdKZcUMpNV2zdM=; b=lP8PjhSzu4ha8Ey9xuvW8+1cl7DU9XkNyFgurO5OADsl27T0S+7P6BHNwnw0M4s3qq HE2nmQSGg/0Uvpwz61kqBItoqGcBoKVlNsLxT5pd7qxUhGJmXRF+4a0i9RyG5bx3kee/ QYxhxjCLTeQYDL0JsWgQ7obTHZMnpIFONmmNWnD+OqU1Uq759jE6p0bD/rJ+5IcGUOlq QjT3Fw4zTB+wb4AkSBunU8n3hWV3NZlPl9uXywrJJG7Rs8MaKP662M6eq4XMn4iUrymh eKOUQz+fr52FS7C4fxAoCFotd3v7MO8BAO8rCBLpF0Al/UWXXy6TLAEpzlDK8Li0gmjL GOMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711531922; x=1712136722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AZpweT3nmK6wwpDDzMjiVrCdC5R/qvdKZcUMpNV2zdM=; b=B/Q97jZHtW8YPuzPV1BZnDFqty8iAqZaefsj0kZQZ25P9980vc7w72CrjJDFrFhnVX IcIKwUutX1ImhqO++YttGadAi0q2esFG0VTnLW51HXbtT2gf2VksW8ZrkPMLRldrwxzQ ZnzZDnHnMkRFbc3oCH650GdICqbO2yORa7F70cOZv9xTNMA8VOX2efudCscvVe4cuBxf yH2k4hWpwbTHxgnwkhRLzR576vOP5nyDhAEni9eLttFFBP5E8HmMCn0QS4scOpjLelDy XUpz7CEyfhuKFgDcxA8+7utnTM1roSeMovNlkwZOzd9XsKMbL03AUR5Ub8N/NjQXlaQC wi9g== X-Gm-Message-State: AOJu0YzOb5Ul+3N31tIk5A/IsaMuDEHIFeP26hJIpgcSrhKAqAw0RBWL 2Qy9n/SJK7s+NnMSItdZVh6zhvYiW0ccJMGnp8IxnRDoiL4n+CJof8IPKvq1peLrhYL5EyZVHM2 Q X-Google-Smtp-Source: AGHT+IE8gNWMuqBsTHHCCGlyOS35JWmvZsCSfHIeFxVG+ylOzo4nXhyeTaO33yd/lbvNP01g+CLpnA== X-Received: by 2002:a05:6a21:7896:b0:1a1:6803:69a3 with SMTP id bf22-20020a056a21789600b001a1680369a3mr2397973pzc.0.1711531921856; Wed, 27 Mar 2024 02:32:01 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: thuth@redhat.com, alistair.francis@wdc.com, groug@kaod.org, peter.maydell@linaro.org, qemu_oss@crudebyte.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 4/7] qtest/virtio-9p-test.c: consolidate create file tests Date: Wed, 27 Mar 2024 06:31:41 -0300 Message-ID: <20240327093144.781701-5-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327093144.781701-1-dbarboza@ventanamicro.com> References: <20240327093144.781701-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x429.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1711532012738100001 Content-Type: text/plain; charset="utf-8" Similar to what was done with fs_create_dir() in the previous patch, and for the same reasons, let's consolidate fs_create_file() and fs_unlinkat_file() in a single test that has the same coverage: - fs_create_file() is removed; - rename fs_unlinkat_file() to fs_create_unlinkat_file(); - change fs_create_unlinkat_file() to also remove the created dir. The remaining tests got their dir changed to reflect that we're now with one less test. Reported-by: Thomas Huth Signed-off-by: Daniel Henrique Barboza Tested-by. You're more than welcome to give this version a try :) --- tests/qtest/virtio-9p-test.c | 42 ++++++++++++++---------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 2cea1b4189..75d4d1cf4b 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -534,31 +534,14 @@ static void fs_create_unlinkat_dir(void *obj, void *d= ata, g_assert(stat(new_dir_path, &st) !=3D 0); } =20 -static void fs_create_file(void *obj, void *data, QGuestAllocator *t_alloc) +static void fs_create_unlinkat_file(void *obj, void *data, + QGuestAllocator *t_alloc) { QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; const char *new_dir =3D "02"; - g_autofree char *new_file =3D g_strdup_printf("%s/%s", new_dir, "1st_f= ile"); - g_autofree char *new_file_path =3D virtio_9p_test_path(new_file); - - tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); - tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "1st_file" = }); - - /* check if created file exists now ... */ - g_assert(stat(new_file_path, &st) =3D=3D 0); - /* ... and is a regular file */ - g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); -} - -static void fs_unlinkat_file(void *obj, void *data, QGuestAllocator *t_all= oc) -{ - QVirtio9P *v9p =3D obj; - v9fs_set_allocator(t_alloc); - struct stat st; - const char *new_dir =3D "03"; + g_autofree char *new_dir_path =3D virtio_9p_test_path(new_dir); g_autofree char *new_file =3D g_strdup_printf("%s/%s", new_dir, "doa_f= ile"); g_autofree char *new_file_path =3D virtio_9p_test_path(new_file); =20 @@ -574,6 +557,13 @@ static void fs_unlinkat_file(void *obj, void *data, QG= uestAllocator *t_alloc) tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "doa_file"= }); /* file should be gone now */ g_assert(stat(new_file_path, &st) !=3D 0); + + /* cleanup: remove the created dir */ + tunlinkat({ + .client =3D v9p, .atPath =3D "/", .name =3D new_dir, + .flags =3D P9_DOTL_AT_REMOVEDIR + }); + g_assert(stat(new_dir_path, &st) !=3D 0); } =20 static void fs_symlink_file(void *obj, void *data, QGuestAllocator *t_allo= c) @@ -581,7 +571,7 @@ static void fs_symlink_file(void *obj, void *data, QGue= stAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - const char *new_dir =3D "04"; + const char *new_dir =3D "03"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *symlink_file =3D NULL; @@ -614,7 +604,7 @@ static void fs_unlinkat_symlink(void *obj, void *data, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; - const char *new_dir =3D "05"; + const char *new_dir =3D "04"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *symlink_file =3D NULL; @@ -648,7 +638,7 @@ static void fs_hardlink_file(void *obj, void *data, QGu= estAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - const char *new_dir =3D "06"; + const char *new_dir =3D "05"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *hardlink_file =3D NULL; @@ -685,7 +675,7 @@ static void fs_unlinkat_hardlink(void *obj, void *data, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - const char *new_dir =3D "07"; + const char *new_dir =3D "06"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *hardlink_file =3D NULL; @@ -771,8 +761,8 @@ static void register_virtio_9p_test(void) qos_add_test("local/config", "virtio-9p", pci_config, &opts); qos_add_test("local/create_unlinkat_dir", "virtio-9p", fs_create_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, &op= ts); + qos_add_test("local/create_unlinkat_file", "virtio-9p", + fs_create_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_symlin= k, &opts); --=20 2.44.0 From nobody Thu May 16 03:52:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1711532019; cv=none; d=zohomail.com; s=zohoarc; b=NwR/uAPuMK3JHy26vzOE5nyBOisC77c0yfvjTdUXTsNvRK6gWBvz9RmzRi4gwgTqGnXC+VvygPn4u9Sy1VvH9siIx1fCarnMScJ3yhQX6VbGQ/xsGHvgLUzVM130B47siv+lur+kROvx9QSVrPKXfQIGc4iM4tdGRTwKn14dnd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711532019; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HZk8Q5ZMP3H348YFajK/KsGoIsIEqBXjitss5B3q9oM=; b=R5a6u26fuAK8th+//z1j+iTgICoIyFYpWe2eeLtMEcVBjNo6aOVMTA+xVenyX4sCkS97HASVEC38pPYzyPrghSRoZagslt8r+cCpFUsvqoBA4h4pI3EsfpCstcoRPPTtzP9NwyHgqzd3fr3jCwlSbDWw7e/RZiTAWqZ+gAo930g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711532019804673.9818557196614; Wed, 27 Mar 2024 02:33:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPdo-0006BH-Ha; Wed, 27 Mar 2024 05:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpPdi-00069v-6L for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:11 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPdf-0007l6-5t for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:08 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6ea8ee55812so4011362b3a.0 for ; Wed, 27 Mar 2024 02:32:05 -0700 (PDT) Received: from grind.. ([177.45.186.241]) by smtp.gmail.com with ESMTPSA id fm23-20020a056a002f9700b006e6b41511fdsm7628760pfb.94.2024.03.27.02.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711531924; x=1712136724; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HZk8Q5ZMP3H348YFajK/KsGoIsIEqBXjitss5B3q9oM=; b=C84grWLNiYnarXvKavRUZHV8AY051ILUYxszZyhWQ6z/wOT9TNq9PLpriv8QhlEz36 DUGSbTQnh1ZD7+8nltZLkg1DWvm8qgv00UpPCHmQZ4etzJxRjguC51MDwfMKABCmQpu7 pVvmSjcSzKzV76X1rvmAW+E0aFRR/Ii+ju7IKHG8ipwEoeEuJmp77KHoHllQ6/T9FpKO 5DO/+BC6rChzOyw6lYANkT8zB95TFFeLz6EzLHsR38Ii9hSkv0w5uxWuB9NnavEswrXi 9V9HIKFcQ1p+OdSaexeYt48hWRc6scOcUy/+8EU8XanHVbFDA3NhaonjoCU3tEVvjhCa ZiYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711531924; x=1712136724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HZk8Q5ZMP3H348YFajK/KsGoIsIEqBXjitss5B3q9oM=; b=iNCqS3fDqCtpvDRO8zxmJLc9mCzSpWEIKqbYg3z4XETNvNd3TCfhgd+j1EHPk76vvs STd0ZHeMCK8Ut+8e0HTAkujvoEJJveecijw8xEk9s7LNchCmkhPQfAsM4XtjoD5eovUv WOqPiTsT7ae6OoJc5CXFjZO3bAf596GXV6CR1BAHE5tQos+oRp6Osq+f6u0fghlzfP+4 0j2aIBMxAmzrVhjGpqAUC4XdeZZ5aUA67OsLl2mScXbGrbyjzgj1iSfHi4TE33NDGLiN hC5j9C4aG/pLYpgRNlyLJFL8BxNxkk2YKteh0wqboOrUkeT8ngOfTv0zgn1VMWwNf+tw HaXw== X-Gm-Message-State: AOJu0YxQMLEZJhRPvSfg5qr0jEvM1ce00RAwwu40sjyap3mMvpdLs2+C UkEKyMvy50mv3WJLGjTCtr/7OTWWehWVFFik2+565Us9nkF74AcV8ikKF4Z+iGFXVMPg/XG4atu A X-Google-Smtp-Source: AGHT+IHcghAAR0NtsQDisW+TA9jKAiNbhCPGw4C+73Ao3z82iqPe93IXUluamfuqBLCxGtkzvudaFg== X-Received: by 2002:a05:6a00:22c4:b0:6ea:92de:3603 with SMTP id f4-20020a056a0022c400b006ea92de3603mr865523pfj.16.1711531924412; Wed, 27 Mar 2024 02:32:04 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: thuth@redhat.com, alistair.francis@wdc.com, groug@kaod.org, peter.maydell@linaro.org, qemu_oss@crudebyte.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 5/7] qtest/virtio-9p-test.c: consolidate create symlink tests Date: Wed, 27 Mar 2024 06:31:42 -0300 Message-ID: <20240327093144.781701-6-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327093144.781701-1-dbarboza@ventanamicro.com> References: <20240327093144.781701-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x430.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1711532020760100001 Content-Type: text/plain; charset="utf-8" fs_unlinkat_symlink() does the same thing as fs_symlink_file() while also removing the created symlink. We also want every test to not leave stuff behind after each run to avoid subsequential runs to fail. We can achieve all that by: - remove fs_unlinkat_symlink(). fs_unlinkat_symlink() is now named fs_create_unlinkat_symlink(); - remove 'real_file' and the created dir at the end of fs_create_unlinkat_symlink(). The hardlink tests dir names were updated because now we have one less test. Reported-by: Thomas Huth Signed-off-by: Daniel Henrique Barboza Tested-by. You're more than welcome to give this version a try :) --- tests/qtest/virtio-9p-test.c | 54 ++++++++++++------------------------ 1 file changed, 17 insertions(+), 37 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 75d4d1cf4b..222d11037d 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -566,12 +566,14 @@ static void fs_create_unlinkat_file(void *obj, void *= data, g_assert(stat(new_dir_path, &st) !=3D 0); } =20 -static void fs_symlink_file(void *obj, void *data, QGuestAllocator *t_allo= c) +static void fs_create_unlinkat_symlink(void *obj, void *data, + QGuestAllocator *t_alloc) { QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st; const char *new_dir =3D "03"; + g_autofree char *new_dir_path =3D virtio_9p_test_path(new_dir); g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *symlink_file =3D NULL; @@ -596,41 +598,20 @@ static void fs_symlink_file(void *obj, void *data, QG= uestAllocator *t_alloc) =20 /* check if created link exists now */ g_assert(stat(symlink_file_path, &st) =3D=3D 0); -} - -static void fs_unlinkat_symlink(void *obj, void *data, - QGuestAllocator *t_alloc) -{ - QVirtio9P *v9p =3D obj; - v9fs_set_allocator(t_alloc); - struct stat st; - const char *new_dir =3D "04"; - g_autofree char *real_file =3D NULL; - g_autofree char *real_file_path =3D NULL; - g_autofree char *symlink_file =3D NULL; - g_autofree char *symlink_file_path =3D NULL; - - real_file =3D g_strdup_printf("%s/%s", new_dir, "real_file"); - real_file_path =3D virtio_9p_test_path(real_file); - - symlink_file =3D g_strdup_printf("%s/%s", new_dir, "symlink_file"); - symlink_file_path =3D virtio_9p_test_path(symlink_file); - - tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); - tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file"= }); - g_assert(stat(real_file_path, &st) =3D=3D 0); - g_assert((st.st_mode & S_IFMT) =3D=3D S_IFREG); - - tsymlink({ - .client =3D v9p, .atPath =3D new_dir, .name =3D "symlink_file", - .symtgt =3D "real_file" - }); - g_assert(stat(symlink_file_path, &st) =3D=3D 0); =20 tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "symlink_f= ile" }); /* symlink should be gone now */ g_assert(stat(symlink_file_path, &st) !=3D 0); + + /* cleanup: remove created file and dir */ + tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file= " }); + g_assert(stat(real_file_path, &st) !=3D 0); + + tunlinkat({ + .client =3D v9p, .atPath =3D "/", .name =3D new_dir, + .flags =3D P9_DOTL_AT_REMOVEDIR + }); + g_assert(stat(new_dir_path, &st) !=3D 0); } =20 static void fs_hardlink_file(void *obj, void *data, QGuestAllocator *t_all= oc) @@ -638,7 +619,7 @@ static void fs_hardlink_file(void *obj, void *data, QGu= estAllocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - const char *new_dir =3D "05"; + const char *new_dir =3D "04"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *hardlink_file =3D NULL; @@ -675,7 +656,7 @@ static void fs_unlinkat_hardlink(void *obj, void *data, QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); struct stat st_real, st_link; - const char *new_dir =3D "06"; + const char *new_dir =3D "05"; g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *hardlink_file =3D NULL; @@ -763,9 +744,8 @@ static void register_virtio_9p_test(void) fs_create_unlinkat_dir, &opts); qos_add_test("local/create_unlinkat_file", "virtio-9p", fs_create_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_symlin= k, - &opts); + qos_add_test("local/create_unlinkat_symlink", "virtio-9p", + fs_create_unlinkat_symlink, &opts); qos_add_test("local/hardlink_file", "virtio-9p", fs_hardlink_file, &op= ts); qos_add_test("local/unlinkat_hardlink", "virtio-9p", fs_unlinkat_hardl= ink, &opts); --=20 2.44.0 From nobody Thu May 16 03:52:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1711532051; cv=none; d=zohomail.com; s=zohoarc; b=VCP2TEWBja+8GPeUhFO/ScYfTX2K0Lvw/kw83287LuQ3Nj+DJAU/zZMv3bjtNx9NMugEFd52mHuDRj5VeHmnxK+q0aYQb9PleQUJ7UTAgefzQPA2PHqe8gfno/RNON4JzpgQJF75m8k1euz4FlBLfUzvWioe+1fqBLMglWKf6TE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711532051; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7nMAeHd1FtL+QcrNG1cSxDeodNP8yzWlHRCdD7o0fyk=; b=kr8wf9CZSxt7IiLZEzFjSqtqBMZVj++o5o9Kig5baKOCrI0lFN1ecAE9VelCmY+hHcYaKXiTkTamhsAzFN/tl5BD89Wg6ezJetxzDQBFpUsYmWDE9KpLjUfwCyaOCN5KEAt+DcwEX1U9MB2SAl360IrZ85gBtQ5Lny/XKhIKHtw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711532051262503.56865630860466; Wed, 27 Mar 2024 02:34:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPdo-0006Be-Ph; Wed, 27 Mar 2024 05:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpPdl-0006AR-4W for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:14 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPdh-0007nT-T8 for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:11 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6e6c0098328so4513206b3a.3 for ; Wed, 27 Mar 2024 02:32:08 -0700 (PDT) Received: from grind.. ([177.45.186.241]) by smtp.gmail.com with ESMTPSA id fm23-20020a056a002f9700b006e6b41511fdsm7628760pfb.94.2024.03.27.02.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711531927; x=1712136727; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7nMAeHd1FtL+QcrNG1cSxDeodNP8yzWlHRCdD7o0fyk=; b=IyXf0o6xFU3kS/zo+Di2mObD6iAtTuj99lJzyZyvPy9G6L3bvG48IbIh3FG6zSGyuy MLDhFkm62dyCFdK1Jlr6dpfjp2N6uGEm5+13E/MAeVIMznI7KjwM0PapXHgxn9WDshbz E2gqMZA6GABul4MTflNcVkBoCPikoGeYmozShgULNuC1U5kycnKnpvUCAfu5GrO73Hy/ wthUsv/LjxFOYWCofAP1X0KKQlqc4JAyJ5oOHfMmk7bO9N2r5ea9ScA4p7NdEk+ModQC vKD86zigqJ/CHZZ/CjkMFx++eNSS/pCbvaoU5WBbA9pjfAP8ZAz8udQRX6bysBpd+ZZh eNOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711531927; x=1712136727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7nMAeHd1FtL+QcrNG1cSxDeodNP8yzWlHRCdD7o0fyk=; b=qfgz1EIA6GWBoC1c8plZHyK7hL8oENNdJm5JxeG7NJS4Icp6x4zX04uPIbfPamSIMI rRxWjAhLICcR873H5yljpx4e22XyU1FZYpqez1nMKZTmwUpRxBie2BNavqJfzIjE6c7G r1r0lJeu91fG1eHOgoasURU7VzkGAT2Tb8IcZRF6ZDT4p/njngDiErVqbiHcrNIC+Anx HUqZc7fsHa5veiyy9HMCyF10fd6iQM1h0rROPNZoKXLv5S/Lpz2AxkwVcgHofsU8JLZR 9GizE7nSOm9XNOgpLCvOcGX+TqM3CdKkpOmknLLdBuhwpW1b3QaUq9jrVoqHIHw4vFU5 eTeg== X-Gm-Message-State: AOJu0YyEhe1zuO2cof+WfVgaHuhxQSKpyqOF7puZM6pfqf6QfmLD+dvv LtS62Nl0fAN87f0CTWh4lVedidSclLjHyzzPC10razO/hnHAEq20r1467nMCrkD0neEaAvjSu+z b X-Google-Smtp-Source: AGHT+IFkp44CPWb4Lx3V1/2p1zgSyGsW0tUNvsNHd0oFcI8Ws22xz6d643IRvRbLnaYleOXzmbWCYA== X-Received: by 2002:a05:6a00:2d92:b0:6ea:8775:a66d with SMTP id fb18-20020a056a002d9200b006ea8775a66dmr732031pfb.1.1711531927017; Wed, 27 Mar 2024 02:32:07 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: thuth@redhat.com, alistair.francis@wdc.com, groug@kaod.org, peter.maydell@linaro.org, qemu_oss@crudebyte.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 6/7] qtest/virtio-9p-test.c: consolidate hardlink tests Date: Wed, 27 Mar 2024 06:31:43 -0300 Message-ID: <20240327093144.781701-7-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327093144.781701-1-dbarboza@ventanamicro.com> References: <20240327093144.781701-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x434.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1711532052811100003 Content-Type: text/plain; charset="utf-8" We've consolidated all local 9p tests but the hardlink ones. To make fs_unlinkat_hardlink() to act exactly like fs_hardlink_file() we added the g_assert(st_link...) checks in fs_unlinkat_hardlink() as well. After that: - remove fs_hardlink_file(). Rename fs_unlinkat_hardlink() to fs_create_unlinkat_hardlink(); - remove the created dir and 'real_file' at the end of fs_create_unlinkat_hardlink(). After this patch all local 9p tests are now cleaning themselves up after execution and we shouldn't experience errors like the one reported in [1]. [1] https://mail.gnu.org/archive/html/qemu-devel/2024-03/msg05807.html Reported-by: Thomas Huth Signed-off-by: Daniel Henrique Barboza Tested-by. You're more than welcome to give this version a try :) --- tests/qtest/virtio-9p-test.c | 52 +++++++++++------------------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 222d11037d..f85f4ef407 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -614,12 +614,14 @@ static void fs_create_unlinkat_symlink(void *obj, voi= d *data, g_assert(stat(new_dir_path, &st) !=3D 0); } =20 -static void fs_hardlink_file(void *obj, void *data, QGuestAllocator *t_all= oc) +static void fs_create_unlinkat_hardlink(void *obj, void *data, + QGuestAllocator *t_alloc) { QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); - struct stat st_real, st_link; + struct stat st_real, st_link, st; const char *new_dir =3D "04"; + g_autofree char *new_dir_path =3D virtio_9p_test_path(new_dir); g_autofree char *real_file =3D NULL; g_autofree char *real_file_path =3D NULL; g_autofree char *hardlink_file =3D NULL; @@ -648,43 +650,22 @@ static void fs_hardlink_file(void *obj, void *data, Q= GuestAllocator *t_alloc) g_assert((st_link.st_mode & S_IFMT) =3D=3D S_IFREG); g_assert(st_link.st_dev =3D=3D st_real.st_dev); g_assert(st_link.st_ino =3D=3D st_real.st_ino); -} - -static void fs_unlinkat_hardlink(void *obj, void *data, - QGuestAllocator *t_alloc) -{ - QVirtio9P *v9p =3D obj; - v9fs_set_allocator(t_alloc); - struct stat st_real, st_link; - const char *new_dir =3D "05"; - g_autofree char *real_file =3D NULL; - g_autofree char *real_file_path =3D NULL; - g_autofree char *hardlink_file =3D NULL; - g_autofree char *hardlink_file_path =3D NULL; - - real_file =3D g_strdup_printf("%s/%s", new_dir, "real_file"); - real_file_path =3D virtio_9p_test_path(real_file); - - hardlink_file =3D g_strdup_printf("%s/%s", new_dir, "hardlink_file"); - hardlink_file_path =3D virtio_9p_test_path(hardlink_file); - - tattach({ .client =3D v9p }); - tmkdir({ .client =3D v9p, .atPath =3D "/", .name =3D new_dir }); - tlcreate({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file"= }); - g_assert(stat(real_file_path, &st_real) =3D=3D 0); - g_assert((st_real.st_mode & S_IFMT) =3D=3D S_IFREG); - - tlink({ - .client =3D v9p, .atPath =3D new_dir, .name =3D "hardlink_file", - .toPath =3D real_file - }); - g_assert(stat(hardlink_file_path, &st_link) =3D=3D 0); =20 tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "hardlink_= file" }); /* symlink should be gone now */ g_assert(stat(hardlink_file_path, &st_link) !=3D 0); /* and old file should still exist */ g_assert(stat(real_file_path, &st_real) =3D=3D 0); + + /* cleanup: remove created file and dir */ + tunlinkat({ .client =3D v9p, .atPath =3D new_dir, .name =3D "real_file= " }); + g_assert(stat(real_file_path, &st_real) !=3D 0); + + tunlinkat({ + .client =3D v9p, .atPath =3D "/", .name =3D new_dir, + .flags =3D P9_DOTL_AT_REMOVEDIR + }); + g_assert(stat(new_dir_path, &st) !=3D 0); } =20 static void *assign_9p_local_driver(GString *cmd_line, void *arg) @@ -746,9 +727,8 @@ static void register_virtio_9p_test(void) fs_create_unlinkat_file, &opts); qos_add_test("local/create_unlinkat_symlink", "virtio-9p", fs_create_unlinkat_symlink, &opts); - qos_add_test("local/hardlink_file", "virtio-9p", fs_hardlink_file, &op= ts); - qos_add_test("local/unlinkat_hardlink", "virtio-9p", fs_unlinkat_hardl= ink, - &opts); + qos_add_test("local/create_unlinkat_hardlink", "virtio-9p", + fs_create_unlinkat_hardlink, &opts); } =20 libqos_init(register_virtio_9p_test); --=20 2.44.0 From nobody Thu May 16 03:52:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1711532004; cv=none; d=zohomail.com; s=zohoarc; b=n9oPxSkyx3GHQMOxj83/5kp91FjU3K6PvNLB/LMZCHqTKRb6yiBtIbMgwBs93S3wkIVMmVF9q1NaYp6ADidLEuY+fZUMKjTXwun55MFlhV2GpyRDJaYWMX6x/hQb7JKiKmSF+DTRuUGWOYCubO8Tf6yrBAZFYbRqTMq1xX2Up2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711532004; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WqrZPMitGEHrImvOZFbV4c6XxRh57v1JSDYD00D/pSY=; b=PjxVITWxRQErt0LdMKq+TE/sq7OMfOB+tHrMBYhavCbj/Oo6eEEjZFIrkqPqF3H/Qusmkxz3GN7GOfiCI1ffg62iZuvLHu5lW2nhG1ShJD7s5FsY11ygUNJus6n43VKIgSFgiMVUqHIMjm0VDxJDC48eZ0E1YTEq/CGqsN+slbQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1711532004349977.3855603400407; Wed, 27 Mar 2024 02:33:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpPdt-0006EO-In; Wed, 27 Mar 2024 05:32:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rpPdr-0006DS-Ln for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:20 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rpPdj-0007pk-VZ for qemu-devel@nongnu.org; Wed, 27 Mar 2024 05:32:19 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6e74bd85f26so5215526b3a.1 for ; Wed, 27 Mar 2024 02:32:11 -0700 (PDT) Received: from grind.. ([177.45.186.241]) by smtp.gmail.com with ESMTPSA id fm23-20020a056a002f9700b006e6b41511fdsm7628760pfb.94.2024.03.27.02.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1711531930; x=1712136730; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WqrZPMitGEHrImvOZFbV4c6XxRh57v1JSDYD00D/pSY=; b=jWX0aJtmQLP2ACDFhr55Dk91O/OdwXSc7NBChxQICDWhcvwoKHCw47fUJ7L5MLXMrM pSG9Ai+LzyylNJNbGDoYIsK/eIRZeD5w1ZG+Kaxoy6MXaps90MlETn66PV8vmSA9Zo/0 NXW5u/62WsJF7+0S6IfEhzwID/Qh3j0RE5VCFq53okdf2UmhuoRDf8jb/m4cSOnkEgcy zYS1x+MYTkKuok771Bp09DACAQsszz+cxdYwg5kot6u3F2aAny5iXrfkjHD80x2hUa4i TBO8rX/QnANsnWQvXwWwuTA1e77G1Tp0kMhy/f2DASxox6i/Bu7SeEz2vSid0X9hHaTH MJ3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711531930; x=1712136730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WqrZPMitGEHrImvOZFbV4c6XxRh57v1JSDYD00D/pSY=; b=RcO6qQN7h0XZR6FdJX1VvRuZLVHK49RuagTZWpBSc79CdKqki7txNhXErxa3rLc5Vw zcJGSkDXPwzs8eC5Jl1lH+otZEmjzaY8CkAdokX7E1IRRCOuicQFYPc72d0HcN6dmWHM l3GddxtjKailByr2HJvpQ+IIxI8QUPNG6fCEzWur3Z7n5l0FX8j6Waate3YNKRHAfKeg EPkYrhlFZFmcWnoB+F/41QEYRNcT2hufF7Qkt40NjW0+xtHurZ8QxU9phLtFmoOzbJkM DeNrYgSJxm2/ARBW0V62uz4as3AimQehOrmNwHnS65QfyXN0zLV5DhhYN0OUh/Fl8nj3 z+iw== X-Gm-Message-State: AOJu0Yz+6XvDLzfeZN6ujUyD86mtmdHpuRSLZGkLxhKCLAKhT0WZRHys GRQyEwSFGk3FifQmrPagYeeon+kTVnfBrC+r0C/usVCffRWpA5cG8BBeRnrfNb12qKKJDL6UCAx j X-Google-Smtp-Source: AGHT+IEnRUpiCmLDAaY/pT87GTpS76y4rQhAOYHwK8GAKX+Ipbo4DTsNWbS+KeFOdO3kEc9wwmIP3w== X-Received: by 2002:a05:6a00:2349:b0:6ea:950f:7d29 with SMTP id j9-20020a056a00234900b006ea950f7d29mr2317095pfj.20.1711531929893; Wed, 27 Mar 2024 02:32:09 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: thuth@redhat.com, alistair.francis@wdc.com, groug@kaod.org, peter.maydell@linaro.org, qemu_oss@crudebyte.com, Daniel Henrique Barboza Subject: [PATCH for-9.0 v2 7/7] qtest/virtio-9p-test.c: remove g_test_slow() gate Date: Wed, 27 Mar 2024 06:31:44 -0300 Message-ID: <20240327093144.781701-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327093144.781701-1-dbarboza@ventanamicro.com> References: <20240327093144.781701-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=dbarboza@ventanamicro.com; helo=mail-pf1-x42f.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1711532004773100001 Content-Type: text/plain; charset="utf-8" Commit 558f5c42ef gated the local tests with g_test_slow() to skip them in 'make check'. The reported issue back then was this following CI problem: https://lists.nongnu.org/archive/html/qemu-devel/2020-11/msg05510.html This problem ended up being fixed when the recently added risc-v machine nodes faced the same issue [1]. We're now able to run these tests with 'make check' in the CI. This reverts commit 558f5c42efded3e0d0b20a90bce2a9a14580d824. [1] https://mail.gnu.org/archive/html/qemu-devel/2024-03/msg05807.html Signed-off-by: Daniel Henrique Barboza Tested-by. You're more than welcome to give this version a try :) --- tests/qtest/virtio-9p-test.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index f85f4ef407..8d8a7578b7 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -710,15 +710,6 @@ static void register_virtio_9p_test(void) =20 =20 /* 9pfs test cases using the 'local' filesystem driver */ - - /* - * XXX: Until we are sure that these tests can run everywhere, - * keep them as "slow" so that they aren't run with "make check". - */ - if (!g_test_slow()) { - return; - } - opts.before =3D assign_9p_local_driver; qos_add_test("local/config", "virtio-9p", pci_config, &opts); qos_add_test("local/create_unlinkat_dir", "virtio-9p", --=20 2.44.0