From nobody Mon May 20 02:17:46 2024 Delivered-To: importer@patchew.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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594361289; cv=none; d=zohomail.com; s=zohoarc; b=kGS/P+gBzplBDEbbdW0MO5SpYsjTHb3kgzFsMyAV9GONNJg1/kKN9vopw2IRDyo7A27crhVswkiUwJInj21M4n9sgE82nC/wc2mZCQe57h28N4MIm7Ri4bF1lNU9GsraoPLeoGOn+VAfmIdCDqUN8jggjAFuO1knb34PKteQ8CI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594361289; 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=6Ug6571A2wGeckp76nBxVhyGsxMMQ06/3UwSVf0f2xU=; b=lgrzfrFTtribSseG4uJxwEjqOSZVnOmP/H3JzwfthNHcj4wrrXRHsBuDdvbkAc79VM75JUGM+HOaHtX8/XwzUcDmhUkxByp0cS2FmYACETOqLWhVgB9UUTCJso9OMpnVO3fwgHaqetrK0LwQ1evwYfujx2KEMI7/Bsu6Vjxv7nQ= 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=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 1594361289900417.64183156117883; Thu, 9 Jul 2020 23:08:09 -0700 (PDT) Received: from localhost ([::1]:48602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtmCd-0002Mx-F4 for importer@patchew.org; Fri, 10 Jul 2020 02:08:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtmC3-0001wt-26 for qemu-devel@nongnu.org; Fri, 10 Jul 2020 02:07:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23362 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 1jtmC0-0004yp-69 for qemu-devel@nongnu.org; Fri, 10 Jul 2020 02:07:30 -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-209-7T7dWYfJOE63oiY3fyMvsQ-1; Fri, 10 Jul 2020 02:07:24 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DFB47800D5C for ; Fri, 10 Jul 2020 06:07:23 +0000 (UTC) Received: from thuth.com (ovpn-112-68.ams2.redhat.com [10.36.112.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C59F60E1C; Fri, 10 Jul 2020 06:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594361246; 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=6Ug6571A2wGeckp76nBxVhyGsxMMQ06/3UwSVf0f2xU=; b=DisEpdHZqdtba7dgnDkolTbgFczzMPhofLXsJaW4Ndb66ah4esqM/mw6RR6oHJ2t5EZGmN i4h4fU9S1h5dWfOfZ0jHKNOMiM9UCLofBrfwXaISsGMqUTzzB0zfm29YEzHnvYbod37gwS CZoWoLUrrahZpNkrXyrS+QBwx/IiBIE= X-MC-Unique: 7T7dWYfJOE63oiY3fyMvsQ-1 From: Thomas Huth To: qemu-devel@nongnu.org Subject: [PATCH v2] tests: improve performance of device-introspect-test Date: Fri, 10 Jul 2020 08:07:19 +0200 Message-Id: <20200710060719.22386-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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=thuth@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/10 00:36:21 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 , "Daniel P . Berrange" , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Daniel P. Berrang=C3=A9 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 [thuth: Add the tree check to test_device_intro_none() and test_device_intro_abstract(), too, just to be sure...] Signed-off-by: Thomas Huth Reviewed-by: Laurent Vivier --- v2: Add the tree check to test_device_intro_none() and test_device_intro_abstract(), too When I run the following command, the test time drops from more than 20 minutes to 50 seconds now (wow!): =20 QTEST_QEMU_BINARY=3Dppc64-softmmu/qemu-system-ppc64 \ time tests/qtest/device-introspect-test -m slow > /dev/null tests/qtest/device-introspect-test.c | 60 ++++++++++++++++++---------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index 9abb5ec889..d68b7856a7 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) @@ -213,16 +193,38 @@ static void test_qom_list_fields(void) static void test_device_intro_none(void) { QTestState *qts =3D qtest_init(common_args); + g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_end =3D NULL; + g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); + g_autofree char *qtree_end =3D NULL; =20 test_one_device(qts, "nonexistent"); + + /* Make sure that really nothing changed in the trees */ + 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); + qtest_quit(qts); } =20 static void test_device_intro_abstract(void) { QTestState *qts =3D qtest_init(common_args); + g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_end =3D NULL; + g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); + g_autofree char *qtree_end =3D NULL; =20 test_one_device(qts, "device"); + + /* Make sure that really nothing changed in the trees */ + 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); + qtest_quit(qts); } =20 @@ -231,9 +233,12 @@ static void test_device_intro_concrete(const void *arg= s) QList *types; QListEntry *entry; const char *type; - QTestState *qts; + QTestState *qts =3D qtest_init(args); + g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_end =3D NULL; + g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); + g_autofree char *qtree_end =3D NULL; =20 - qts =3D qtest_init(args); types =3D device_type_list(qts, false); =20 QLIST_FOREACH_ENTRY(types, entry) { @@ -243,6 +248,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.18.1