From nobody Fri Dec 27 04:21:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1732782863272457.6812233451418; Thu, 28 Nov 2024 00:34:23 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id AC35817CE; Thu, 28 Nov 2024 03:34:22 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5DDCA196D; Thu, 28 Nov 2024 03:32:59 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0FE1212A3; Thu, 28 Nov 2024 03:32:52 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B71CE17F5 for ; Thu, 28 Nov 2024 03:32:40 -0500 (EST) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-609-fiCbI8EvOuaAC7_xyX-w1w-1; Thu, 28 Nov 2024 03:32:38 -0500 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 98C63195419B for ; Thu, 28 Nov 2024 08:32:37 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.6]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AF01B195605A for ; Thu, 28 Nov 2024 08:32:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732782760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i6IgaIDBPNtaWN7dNqVD3q0/HMpzRivEvBOcggXOD4Y=; b=PpPHf0LJFe5XQTNNTJ/Chq1pZcxtvqoaqcGvXklRUv187NXr+5YddQWZ+PxMQOAeEXhOn8 gdb1MejnpNMu6SvWLBCGfKDeT+YeB0nOfIehMLZLfgpJ5rrWUHFOlxpcSaCtR6ykbYYqe4 eczNQOK47KC2811IuGtzD3j5/PKryD4= X-MC-Unique: fiCbI8EvOuaAC7_xyX-w1w-1 X-Mimecast-MFC-AGG-ID: fiCbI8EvOuaAC7_xyX-w1w From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 5/5] virschematest: Don't skip all "directory" tests Date: Thu, 28 Nov 2024 09:32:27 +0100 Message-ID: <275dd26c482b8eaccda7f6b1b174e0b4546002c3.1732782657.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 6dGs_tyGkMMfhrqLN4nCK9GGRbIhiKQuV2UmxfkLqBM_1732782757 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QDZHXTCOY6YCHEC6MCSNKX2CX3FHJQ5H X-Message-ID-Hash: QDZHXTCOY6YCHEC6MCSNKX2CX3FHJQ5H X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1732782865189019100 Content-Type: text/plain; charset="utf-8" Due to a bug in the optimization to avoid testing symlinked tests multiple times all tests were skipped. In commit f997fcca71a16b102e6ee663 I made an attempt to optimize the tests by avoiding testing symlinks. This optimization was buggy as I've passed the 'd_name' field of 'struct dirent' which is just the filename to 'g_lstat()'. 'g_lstat()' obviously always failed with ENOENT. As the logic checked only for successful return of 'g_lstat()' the optimizatio was a dud. Now in 4d8ebbfee83edb2 the 'g_lstat()' call was replaced by 'virFileIsLink()' checking all non-zero values. This meant that if 'virFileIsLink()' failed the test was skipped. Now since a bad argument was passed this failed always and thus was always skipped making 'virschematest' useless. Fix it by passing the full path of the test and also explicitly check for '1' return value instead of any non-zero. Fixes: f997fcca71a16b102e6ee663a3fb86bed8de9d7d Fixes: 4d8ebbfee83edb26b19a62465b9f98d0126db991 Signed-off-by: Peter Krempa --- tests/virschematest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/virschematest.c b/tests/virschematest.c index 5d3fa32de4..e08ae21738 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -124,8 +124,6 @@ testSchemaDir(const char *schema, continue; if (ent->d_name[0] =3D=3D '.') continue; - if (virFileIsLink(ent->d_name)) - continue; if (filter && !g_regex_match(filter, ent->d_name, 0, NULL)) continue; @@ -134,11 +132,14 @@ testSchemaDir(const char *schema, g_strv_contains(entry->skip, ent->d_name)) continue; + xml_path =3D g_strdup_printf("%s/%s", dir_path, ent->d_name); + + if (virFileIsLink(xml_path) =3D=3D 1) + continue; + if (entry->exceptions) exception =3D g_strv_contains(entry->exceptions, ent->d_name); - xml_path =3D g_strdup_printf("%s/%s", dir_path, ent->d_name); - if (testSchemaFile(schema, validator, xml_path, exception) < 0) ret =3D -1; } --=20 2.47.0