From nobody Mon Feb 9 04:45:46 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) 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 1702644503295784.1642698767865; Fri, 15 Dec 2023 04:48:23 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 38EA71AD6; Fri, 15 Dec 2023 07:48:22 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2EC031A1E; Fri, 15 Dec 2023 07:34:51 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7F9141AA5; Fri, 15 Dec 2023 07:33:49 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 C7BC019DD for ; Fri, 15 Dec 2023 07:33:38 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-L3u_E7PZOW23Ox8NISMrig-1; Fri, 15 Dec 2023 07:33:36 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id C41F085A589 for ; Fri, 15 Dec 2023 12:33:35 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C1211C060B1 for ; Fri, 15 Dec 2023 12:33:35 +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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: L3u_E7PZOW23Ox8NISMrig-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 06/19] qemuxml2argvtest: Check for duplicate invocation of tests Date: Fri, 15 Dec 2023 13:33:16 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: WAJDK4MBEDTXKQ6EPSTDX6NFI7GY7RZF X-Message-ID-Hash: WAJDK4MBEDTXKQ6EPSTDX6NFI7GY7RZF 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1702644505218100001 Prevent duplicated invocation of tests by tracking use of output files. Some cases need to be exempt from this for now. Signed-off-by: Peter Krempa --- tests/qemustatusxml2xmltest.c | 2 +- tests/qemuxml2argvtest.c | 37 +++++++++++++++++++++++++++++++---- tests/testutilsqemu.h | 2 ++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c index f1589345c3..4796b62853 100644 --- a/tests/qemustatusxml2xmltest.c +++ b/tests/qemustatusxml2xmltest.c @@ -73,7 +73,7 @@ mymain(void) { int ret =3D 0; g_autoptr(virConnect) conn =3D NULL; - struct testQemuConf testConf =3D { NULL, NULL, NULL }; + struct testQemuConf testConf =3D { NULL, NULL, NULL, NULL }; if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ae4f9f8e0a..a5dce0a2a1 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -273,6 +273,7 @@ testCheckExclusiveFlags(int flags) FLAG_FIPS_HOST | FLAG_REAL_CAPS | FLAG_SLIRP_HELPER | + FLAG_ALLOW_DUPLICATE_OUTPUT | 0, -1); return 0; @@ -477,6 +478,28 @@ testCompareXMLToArgvValidateSchema(virCommand *cmd, } +static int +testInfoCheckDuplicate(struct testQemuInfo *info) +{ + const char *path =3D info->outfile; + + if (info->flags & FLAG_ALLOW_DUPLICATE_OUTPUT) + return 0; + + if (info->flags & (FLAG_EXPECT_FAILURE | FLAG_EXPECT_PARSE_ERROR)) + path =3D info->errfile; + + if (g_hash_table_contains(info->conf->duplicateTests, path)) { + fprintf(stderr, "\nduplicate invocation of test case: %s\n'", path= ); + return -1; + } + + g_hash_table_insert(info->conf->duplicateTests, g_strdup(path), NULL); + + return 0; +} + + static int testCompareXMLToArgv(const void *data) { @@ -503,6 +526,9 @@ testCompareXMLToArgv(const void *data) if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0) goto cleanup; + if (testInfoCheckDuplicate(info) < 0) + goto cleanup; + if (info->arch !=3D VIR_ARCH_NONE && info->arch !=3D VIR_ARCH_X86_64) qemuTestSetHostArch(&driver, info->arch); @@ -688,12 +714,14 @@ static int mymain(void) { int ret =3D 0; + g_autoptr(GHashTable) duplicateTests =3D virHashNew(NULL); g_autoptr(GHashTable) capslatest =3D testQemuGetLatestCaps(); g_autoptr(GHashTable) qapiSchemaCache =3D virHashNew((GDestroyNotify) = g_hash_table_unref); g_autoptr(GHashTable) capscache =3D virHashNew(virObjectUnref); struct testQemuConf testConf =3D { .capslatest =3D capslatest, .capscache =3D capscache, - .qapiSchemaCache =3D qapiSchemaCache = }; + .qapiSchemaCache =3D qapiSchemaCache, + .duplicateTests =3D duplicateTests }; if (!capslatest) return EXIT_FAILURE; @@ -852,7 +880,7 @@ mymain(void) DO_TEST_CAPS_ARCH_VER_PARSE_ERROR(name, "x86_64", ver) # define DO_TEST_GIC(name, ver, gic) \ - DO_TEST_CAPS_ARCH_VER_FULL(name, "aarch64", ver, ARG_GIC, gic, ARG_END) + DO_TEST_CAPS_ARCH_VER_FULL(name, "aarch64", ver, ARG_GIC, gic, ARG_FLA= GS, FLAG_ALLOW_DUPLICATE_OUTPUT, ARG_END) /* Unset or set all envvars here that are copied in qemudBuildCommandL= ine * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected @@ -1341,7 +1369,7 @@ mymain(void) DO_TEST_CAPS_LATEST("net-vhostuser-multiq"); DO_TEST_CAPS_LATEST_FAILURE("net-vhostuser-fail"); DO_TEST_CAPS_LATEST("net-user"); - DO_TEST_CAPS_ARCH_LATEST_FULL("net-user", "x86_64", ARG_FLAGS, FLAG_SL= IRP_HELPER); + DO_TEST_CAPS_ARCH_LATEST_FULL("net-user", "x86_64", ARG_FLAGS, FLAG_SL= IRP_HELPER | FLAG_ALLOW_DUPLICATE_OUTPUT); DO_TEST_CAPS_LATEST("net-user-addr"); DO_TEST_CAPS_LATEST("net-user-passt"); DO_TEST_CAPS_VER("net-user-passt", "7.2.0"); @@ -1592,7 +1620,8 @@ mymain(void) ARG_MIGRATE_FD, 7); DO_TEST_CAPS_ARCH_LATEST_FULL("restore-v2-fd", "x86_64", ARG_MIGRATE_FROM, "fd:7", - ARG_MIGRATE_FD, 7); + ARG_MIGRATE_FD, 7, + ARG_FLAGS, FLAG_ALLOW_DUPLICATE_OUTPUT); DO_TEST_CAPS_ARCH_LATEST_FULL("migrate", "x86_64", ARG_MIGRATE_FROM, "tcp:10.0.0.1:5000"); DO_TEST_CAPS_ARCH_LATEST_FULL("migrate-numa-unaligned", "x86_64", diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index 8dbc480756..71e220de3a 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -62,12 +62,14 @@ typedef enum { FLAG_REAL_CAPS =3D 1 << 3, FLAG_SLIRP_HELPER =3D 1 << 4, FLAG_SKIP_CONFIG_ACTIVE =3D 1 << 5, /* Skip 'active' config test in qe= muxml2xmltest */ + FLAG_ALLOW_DUPLICATE_OUTPUT =3D 1 << 6, /* allow multiple tests with t= he same output file */ } testQemuInfoFlags; struct testQemuConf { GHashTable *capscache; GHashTable *capslatest; GHashTable *qapiSchemaCache; + GHashTable *duplicateTests; /* for checking duplicated invocations */ }; typedef enum { --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org