From nobody Sun Apr 28 22:21:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594294192; cv=none; d=zohomail.com; s=zohoarc; b=dIbK1QglbrGTiBVluA/UkbX5jtzdP7O3inQtr1sCe4rL0SgmjRpuxq+zBGHeeIB57R69B8TVuWakF2OeYeiTb6MEbL8Ogm/uVjn1Qr/99Pyqljj88rptUo38l586r/149ZyTUR3CaQKFAKMCbflQRafPHzTE3Q39FIcQX8FATuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594294192; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=w9CTFcztZXOHRtwLxvUc3BnkRbdncxBnD8z9W3Pyc7M=; b=UsiFRXjvt1Yz7YmBb4z6IxRcfu51aGasTXiLNxZYjsCiB0vvMqWajI6ts3NGHoxZLPVvhzg1dZhGvZfGrr2VAZ2dsziCz6qttWI/MlEStMg3KXIbiCVm5JIWOhicZhB5586ecRWh4WhovseVsHo5N/LvAxnCStvMRDlPILMSpEY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none 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 1594294192366981.2203894401192; Thu, 9 Jul 2020 04:29:52 -0700 (PDT) Received: from localhost ([::1]:54176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtUkQ-0006pJ-Ao for importer@patchew.org; Thu, 09 Jul 2020 07:29:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtUjl-0006MW-3c for qemu-devel@nongnu.org; Thu, 09 Jul 2020 07:29:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35142 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jtUjh-0001q1-L7 for qemu-devel@nongnu.org; Thu, 09 Jul 2020 07:29:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-NsvKGYX5PiyaYMsLtdwFgw-1; Thu, 09 Jul 2020 07:29:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C0A8A87952C for ; Thu, 9 Jul 2020 11:29:01 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CA1A2DE60; Thu, 9 Jul 2020 11:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594294144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w9CTFcztZXOHRtwLxvUc3BnkRbdncxBnD8z9W3Pyc7M=; b=hdnr8RL81UP5o+0Fxywp5xWLNgcpx0ifqdajzDNJpm0QYEKTbU10ISuHBYqS3cJNa4T0M6 BUrVigmXtmPog0PU6COqe9uXhKLRG1cmo2MfLrITx4gbHJecSNxva+BKRtuF0rR3Rb9Ahq abGERJzVDFDX82ljC5yxyjrpxdKcDtw= X-MC-Unique: NsvKGYX5PiyaYMsLtdwFgw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH] tests: improve performance of device-introspect-test Date: Thu, 9 Jul 2020 12:28:57 +0100 Message-Id: <20200709112857.3760116-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" 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=207.211.31.120; envelope-from=berrange@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/07 17:25:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Total execution time with "-m slow" and x86_64 QEMU, drops from 3 minutes 15 seconds, down to 54 seconds. Individual tests drop from 17-20 seconds, down to 3-4 seconds. The cost of this change is that any QOM bugs resulting in the test failure will not be directly associated with the device that caused the failure. The test case is not frequently identifying such bugs though, and the cause is likely easily visible in the patch series that causes the failure. So overall the shorter running time is considered the more important factor. Signed-off-by: Daniel P. Berrang=C3=A9 --- tests/qtest/device-introspect-test.c | 38 +++++++++++++--------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index 9abb5ec889..b4af1e19f6 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -105,14 +105,9 @@ static void test_one_device(QTestState *qts, const cha= r *type) { QDict *resp; char *help; - char *qom_tree_start, *qom_tree_end; - char *qtree_start, *qtree_end; =20 g_test_message("Testing device '%s'", type); =20 - qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); - qtree_start =3D qtest_hmp(qts, "info qtree"); - resp =3D qtest_qmp(qts, "{'execute': 'device-list-properties'," " 'arguments': {'typename': %s}}", type); @@ -120,21 +115,6 @@ static void test_one_device(QTestState *qts, const cha= r *type) =20 help =3D qtest_hmp(qts, "device_add \"%s,help\"", type); g_free(help); - - /* - * Some devices leave dangling pointers in QOM behind. - * "info qom-tree" or "info qtree" have a good chance at crashing then. - * Also make sure that the tree did not change. - */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); - g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); - g_free(qom_tree_start); - g_free(qom_tree_end); - - qtree_end =3D qtest_hmp(qts, "info qtree"); - g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); - g_free(qtree_start); - g_free(qtree_end); } =20 static void test_device_intro_list(void) @@ -232,10 +212,17 @@ static void test_device_intro_concrete(const void *ar= gs) QListEntry *entry; const char *type; QTestState *qts; + g_autofree char *qom_tree_start =3D NULL; + g_autofree char *qom_tree_end =3D NULL; + g_autofree char *qtree_start =3D NULL; + g_autofree char *qtree_end =3D NULL; =20 qts =3D qtest_init(args); types =3D device_type_list(qts, false); =20 + qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + qtree_start =3D qtest_hmp(qts, "info qtree"); + QLIST_FOREACH_ENTRY(types, entry) { type =3D qdict_get_try_str(qobject_to(QDict, qlist_entry_obj(entry= )), "name"); @@ -243,6 +230,17 @@ static void test_device_intro_concrete(const void *arg= s) test_one_device(qts, type); } =20 + /* + * Some devices leave dangling pointers in QOM behind. + * "info qom-tree" or "info qtree" have a good chance at crashing then. + * Also make sure that the tree did not change. + */ + qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); + + qtree_end =3D qtest_hmp(qts, "info qtree"); + g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); + qobject_unref(types); qtest_quit(qts); g_free((void *)args); --=20 2.26.2