From nobody Wed May 8 05:56:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666194233; cv=none; d=zohomail.com; s=zohoarc; b=icEKtu/dpOdKTnk8E0zWHKUhXIwi6GU8GjhNxkQFiS71vrfbYBn0KLOCRxgWZHlz96lGf6fgdZhqW7bqbMez7+RouNN2JmQGndN8QMKGVuKXd35p7LVH6+7TvnDw7JcaiXlxQRgsMRbJJXhbS4ERi3qTEXZPAgzmeG4T5oSzv/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666194233; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=MHO4Abod6JS9T3pF/pfxwfvmp5bJozFkjMCGPLhOj34=; b=aJQKM4JPNL4Cse5rctHf/cIfkgR23W0s/8SYMGIeP7rhoYoSJLLbnzP1bdYBvQQfScTzLLxc1eH3Kaanyi80G8BctqoBQREuK6QPw+foMLkEEUpDrYlXUzQbuGNJSLfIDQ0lvOwFXrL6MnhdFYotcEBau2GrQ0zkA5T96JmG4uk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1666194233743511.17716295798164; Wed, 19 Oct 2022 08:43:53 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-4DUZv2MkOBusPFUD1yhCCg-1; Wed, 19 Oct 2022 11:43:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 178DA3814585; Wed, 19 Oct 2022 15:43:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 649F42024CB7; Wed, 19 Oct 2022 15:43:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B18AA19465A2; Wed, 19 Oct 2022 15:43:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 925081946587 for ; Wed, 19 Oct 2022 15:28:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 81328154D8A2; Wed, 19 Oct 2022 15:28:21 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-27.brq.redhat.com [10.40.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3F8D154D8A1 for ; Wed, 19 Oct 2022 15:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666194232; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MHO4Abod6JS9T3pF/pfxwfvmp5bJozFkjMCGPLhOj34=; b=hmoCpKnCozQSL5PEwkEbPWRpidbV5PJ2PEDGgZshiBaULOE6x3lv81GE+l1R9z8K/5Oz5e ez5ktfWECWTHLOAIpQyJacvTqZ1ywbKwJEIY43mWyRvvlJ9Fgk/DNoehj+6R04C74TDkw0 qPW8ZB2sGaOCuNI6gaW20hqPwMAcI/o= X-MC-Unique: 4DUZv2MkOBusPFUD1yhCCg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemuxml2argvtest: Don't re-parse and re-generate commandline for QAPI schema validation Date: Wed, 19 Oct 2022 17:28:19 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666194234257100001 Content-Type: text/plain; charset="utf-8" The removal of the special internal flag for '-netdev' validatition now allows us to use the same virCommand object for validation of the schema. Pass it into the validator instead of re-parsing and re-generating everything. This improved the runtime of qemuxml2argvtest by ~25% on my box. Signed-off-by: Peter Krempa Reviewed-by: Erik Skultety --- tests/qemuxml2argvtest.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index de69cd426a..7ede68d555 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -548,17 +548,11 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args, static int -testCompareXMLToArgvValidateSchema(virQEMUDriver *drv, - const char *migrateURI, - struct testQemuInfo *info, - unsigned int flags) +testCompareXMLToArgvValidateSchema(virCommand *cmd, + struct testQemuInfo *info) { g_auto(GStrv) args =3D NULL; - g_autoptr(virDomainObj) vm =3D NULL; - qemuDomainObjPrivate *priv =3D NULL; GHashTable *schema =3D NULL; - g_autoptr(virCommand) cmd =3D NULL; - unsigned int parseFlags =3D info->parseFlags; /* comment out with line comment to enable schema checking for non _CA= PS tests if (!info->schemafile) @@ -580,23 +574,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv, if (!schema) return 0; - if (!(vm =3D virDomainObjNew(driver.xmlopt))) - return -1; - - parseFlags |=3D VIR_DOMAIN_DEF_PARSE_INACTIVE; - if (!(vm->def =3D virDomainDefParseFile(info->infile, - driver.xmlopt, - NULL, parseFlags))) - return -1; - - priv =3D vm->privateData; - - if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0) - return -1; - - if (!(cmd =3D testCompareXMLToArgvCreateArgs(drv, vm, migrateURI, info= , flags))) - return -1; - if (virCommandGetArgList(cmd, &args) < 0) return -1; @@ -762,7 +739,7 @@ testCompareXMLToArgv(const void *data) goto cleanup; } - if (testCompareXMLToArgvValidateSchema(&driver, migrateURI, info, flag= s) < 0) + if (testCompareXMLToArgvValidateSchema(cmd, info) < 0) goto cleanup; if (virCommandToStringBuf(cmd, &actualBuf, true, false) < 0) --=20 2.37.3