From nobody Mon Feb 9 20:12:01 2026 Delivered-To: importer@patchew.org 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; 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; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1576682298; cv=none; d=zohomail.com; s=zohoarc; b=KXm+H9+PK9v5FWqY9kOLdJebKFgwgXlPosH1gMn1XWaxvTPUfhIm3vdKkZlMGC4GiPub7ga3m9gHnDCHGzU0N13M1RwjqePj1WxeRbSQhJTiPD5Fs/bEwHodKq8aQIJ7EPd5C1+3JdIdNBB2Uxc85+FeUYcg0bhe9P34HWAPVDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576682298; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dS1iuR3dCQd46YTSHKj8EZ1+/iu1EX7LIzJnLFpbqfQ=; b=ZC2Gq5Hif1gxOuiU+Dn4yOyZRE6rDYUNxSKyT4+Yc7U3Ur9IhLsgiHFqodqqZ64Xqr+vdRKFbSNM+LHyUzu7HvrNgiim3sCq426shSr7hK2B1h8FbwwZ19fSpjCIRmUanfGtR+VrRh/MeAueEu0emOUe/M8tGxr4y271SEt94TQ= 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; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576682298310817.6768238935206; Wed, 18 Dec 2019 07:18:18 -0800 (PST) Received: from localhost ([::1]:55632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihb5d-0006kl-7d for importer@patchew.org; Wed, 18 Dec 2019 10:18:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59275) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <2a40095340d9536575af8fd214a7ac647b4603c9@lizzy.crudebyte.com>) id 1ihb4C-0005Xz-OK for qemu-devel@nongnu.org; Wed, 18 Dec 2019 10:16:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <2a40095340d9536575af8fd214a7ac647b4603c9@lizzy.crudebyte.com>) id 1ihb4B-000436-J6 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 10:16:48 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:52497) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <2a40095340d9536575af8fd214a7ac647b4603c9@lizzy.crudebyte.com>) id 1ihb4B-0006bb-A1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 10:16:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Subject:Date:Cc:To:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=dS1iuR3dCQd46YTSHKj8EZ1+/iu1EX7LIzJnLFpbqfQ=; b=SPxy7 F0MDCIgP8kqguZzShP3LZfUxYXYPE6reJmoNy9o9Qq/fd2gGYvlCUmhtNqHd3qTm41SBtV5Pd+j4m cZydf6x8sk5TrDrStOJRalB8yecl0oqXbCvG/aO2zFgLdT855b0tRpw5aHCYRKlOc52OywdEOqgqL T6U6Ehu4qGLJD/3xKaxazZRYtDX584PJPfnsr1I/WHxtDGl/j+h6BR1pFcZ9YgxBAny2KqNONOtgf SOJ//dJ17qGGFBWA1HuGFc3wBWKLUgFzNKx1VJIuMpKEurDaGBhj3cP2M4FhYUfIdOLjk6GBb3Srf 4JKw3N3jXaouYm8wgQ8EKlUHysIzg==; Message-Id: <2a40095340d9536575af8fd214a7ac647b4603c9.1576678644.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck To: qemu-devel@nongnu.org Cc: Greg Kurz Date: Wed, 18 Dec 2019 14:35:56 +0100 Subject: [PATCH v2 5/9] tests/virtio-9p: check file names of R_readdir response X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 91.194.90.13 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Additionally to the already existing check for expected amount of directory entries returned by R_readdir response, also check whether all directory entries have the expected file names (as created on 9pfs synth driver side), ignoring their precise order in result list though. Signed-off-by: Christian Schoenebeck --- tests/virtio-9p-test.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c index 48c0eca292..cb5c9fb420 100644 --- a/tests/virtio-9p-test.c +++ b/tests/virtio-9p-test.c @@ -565,6 +565,16 @@ static void fs_walk(void *obj, void *data, QGuestAlloc= ator *t_alloc) g_free(wqid); } =20 +static bool fs_dirents_contain_name(struct v9fs_dirent *e, const char* nam= e) +{ + for (; e; e =3D e->next) { + if (!strcmp(e->name, name)) { + return true; + } + } + return false; +} + static void fs_readdir(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtio9P *v9p =3D obj; @@ -599,6 +609,18 @@ static void fs_readdir(void *obj, void *data, QGuestAl= locator *t_alloc) QTEST_V9FS_SYNTH_READDIR_NFILES + 2 /* "." and ".." */ ); =20 + /* + * Check all file names exist in returned entries, ignore their order + * though. + */ + g_assert_cmpint(fs_dirents_contain_name(entries, "."), =3D=3D, true); + g_assert_cmpint(fs_dirents_contain_name(entries, ".."), =3D=3D, true); + for (int i =3D 0; i < QTEST_V9FS_SYNTH_READDIR_NFILES; ++i) { + char *name =3D g_strdup_printf(QTEST_V9FS_SYNTH_READDIR_FILE, i); + g_assert_cmpint(fs_dirents_contain_name(entries, name), =3D=3D, tr= ue); + g_free(name); + } + v9fs_free_dirents(entries); g_free(wnames[0]); } --=20 2.20.1