From nobody Wed Nov 5 14:27:34 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534871887492115.09475584571828; Tue, 21 Aug 2018 10:18:07 -0700 (PDT) Received: from localhost ([::1]:55014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsAIA-0006B5-7v for importer@patchew.org; Tue, 21 Aug 2018 13:18:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsA4C-0001Wz-LS for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:03:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsA45-00069j-DR for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:03:36 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:34989) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsA3v-0005nP-55 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:03:25 -0400 Received: by mail-wr1-x42f.google.com with SMTP id j26-v6so645938wre.2 for ; Tue, 21 Aug 2018 10:03:20 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-184-244.clienti.tiscali.it. [78.12.184.244]) by smtp.gmail.com with ESMTPSA id v6-v6sm2608955wmc.43.2018.08.21.10.03.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 10:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=x6olhPSsYEJrh2LYk6+qySPVHxptO+334y6mLZMlLl0=; b=gnd9fyPnx9dPichFwg1mG/Cpw6fapJ+2RagSVoqI8mE7CaaJonSV9eaXVleeMC+X0i mg2Y2Kv7P5MkZYRCNzWaasMjdO9AVLphbSx7ruLsn5PsyNib4kVrX0KNpcr+k9NWvKnI dyfPYGcdfLRIYN+DyzOUNY6wYNYKrvBJDsKOxJpIAz7AwMPPdfrjnmaLSoxk9/5xWU24 iAZ24RZkmApwi71RmCBMqAHnYQ2ICUEEQT09G3P1fd4RLtTU2ISQJ7BVeww9YzQDy1hH M3m7rdU5Qqvt4HkVqkn6bwGkWqHGmjpv8zsqo53SRXpkcQB2q537yJX+gUpVDA+2AhBt YKpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=x6olhPSsYEJrh2LYk6+qySPVHxptO+334y6mLZMlLl0=; b=PqVJW0c5yJH9aBva/nvBogN6rKKxsqu3EJrNVPz9Qgv6hek0Cprw2+gfD2gjDfpqZS eYlP/G0SqCy/zZ1gTZN/bVnFpubxelJ6Xj7gjYKPpFDicsS/AWVt5o2uPW97ySFsU8QJ Ij+AATMkled3viI8WfiOypdzOzV48ZBboYc66ZHWzuxoGF+FjZc34R3j7MZOPPD5l/Ig a3bW6VCe115Xh0yurMhgLFzDzFfPEKWoabLHWj3MGTKqfSpg9ogyDrvyILI+wp1nkk6F eCuwM/DyjB/Oyd8NItEiuDnwm69FJ/caQt9gA9smogeM9Fk7bl+czUVmgB/6Usj/jzHs jw7Q== X-Gm-Message-State: APzg51AOwsPhT2CscRhRHmo98swFneM35o3228lktFulXjb7GM2pDxRe oI7mS9u0821XGfojCMPE+Dn8z0Dn X-Google-Smtp-Source: ANB0VdYMD1thJZ3kVsGS0TpDnRLogoRlvF23wSar+4dMdiW2Z5f4P0ZSbVRrJ5YaxE0k8N6Bo+uHEQ== X-Received: by 2002:adf:a30a:: with SMTP id c10-v6mr9246734wrb.31.1534870999227; Tue, 21 Aug 2018 10:03:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 19:01:47 +0200 Message-Id: <1534870966-9287-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> References: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42f Subject: [Qemu-devel] [PULL 15/74] tests/device-introspection: Check that the qom-tree and qtree do not change X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Introspection should not change the qom-tree / qtree, so we should check this in the device-introspect-test, too. This patch helped to find lots of instrospection bugs during the QEMU v3.0 soft/hard-freeze period in the last two months. Signed-off-by: Thomas Huth Message-Id: <1534419358-10932-7-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/device-introspect-test.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index 0b4f221..a38193b 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -103,7 +103,14 @@ static QList *device_type_list(bool abstract) static void test_one_device(const char *type) { QDict *resp; - char *help, *qom_tree; + char *help; + char *qom_tree_start, *qom_tree_end; + char *qtree_start, *qtree_end; + + g_test_message("Testing device '%s'", type); + + qom_tree_start =3D hmp("info qom-tree"); + qtree_start =3D hmp("info qtree"); =20 resp =3D qmp("{'execute': 'device-list-properties'," " 'arguments': {'typename': %s}}", @@ -115,10 +122,18 @@ static void test_one_device(const char *type) =20 /* * Some devices leave dangling pointers in QOM behind. - * "info qom-tree" has a good chance at crashing then + * "info qom-tree" or "info qtree" have a good chance at crashing then. + * Also make sure that the tree did not change. */ - qom_tree =3D hmp("info qom-tree"); - g_free(qom_tree); + qom_tree_end =3D hmp("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 hmp("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) --=20 1.8.3.1