From nobody Mon Feb 9 18:44:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@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.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636988349; cv=none; d=zohomail.com; s=zohoarc; b=OO1ii5kF8WS1eb9B721Fn2q+Ft5eYK8w4NViOp5ZMimeh7DZ3eS85jfAJ1QhppqZP2W94DWxG3jE4BijavvscZ50J/LbLs0lziXi5QjwY7G/GzzDQPy+tX4pgYzoya3tjXuy9tgIEOhkwbS8fZQY9AbWXhJXaF7LqXwAzReJ+4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636988349; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=caAjapNdQ6O6O98D29tR+rRlgePlecp/3vyOxlktzrU=; b=jW/d9ZvVZ3AeSu/4SK4QjxMTiw8Vaev4o3Z0XGSKUI8jMMwfVOIgfmpOZFM8TrY2JRjGG1ixjeZvb9yqTuFPiESLRTNLnPauxwuezEEnzvhO3jBO66ZYNkaZq0dZv68pMVuI9TDliBbq5o5PxjhgILbHaansZNGOhBEdlbBqfpQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636988349343131.7057396895534; Mon, 15 Nov 2021 06:59:09 -0800 (PST) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-PPLqIy76OKSLGsU0__P99Q-1; Mon, 15 Nov 2021 09:59:07 -0500 Received: by mail-wm1-f72.google.com with SMTP id 201-20020a1c04d2000000b003335bf8075fso5445921wme.0 for ; Mon, 15 Nov 2021 06:59:07 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id f7sm16700545wri.74.2021.11.15.06.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988348; 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: in-reply-to:in-reply-to:references:references; bh=caAjapNdQ6O6O98D29tR+rRlgePlecp/3vyOxlktzrU=; b=VBiE+P32t719oMDwsu2Mf8buyyWvtpQib+Ojzy1EZHfUTUQahiqkuhAi/K2EabAupiCpSE BhJaeNPyNcAEPQSqNdKTbF99A9ezxOwxA3O8o9ET9S4JMUIlGeBW5Phx2wytA1ROPCJbR1 +WElj9FbIRBDDDbMy38XInvDMYNX/YM= X-MC-Unique: PPLqIy76OKSLGsU0__P99Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=caAjapNdQ6O6O98D29tR+rRlgePlecp/3vyOxlktzrU=; b=u79p2HfOEy7ddRx3X8uXiwfPh4qfj8Da/YLCEsk6Nxy8L0XVe7ugumlgzGsU2aWW0X f2HWQGXfmWIpo1qEj2PrNRShfVeWjKpV4QZw0z2dkbC6AVhiTu2BnYZ1PfI1a3sZ9HTJ 7wy04cYfA9b+vnP7Ch1I4m9fvPq0+lEp9zHLp9PG+dKtEG5LRfnXyB10o/w4XYxh1FqO fUQv85gCFDe01st4ZYTEWa8JopAxXL+G2yk6y2oRVy2Rb/gD/TZinyXe/D6LP8a3wTcV JVrHTLTmakdvggoy9Hy/daxESctr17A7WyQYJcaMshV3JlZao0g/XDiBorTmoExa68FO ULDg== X-Gm-Message-State: AOAM5317Cdzu0GffxWJx9lObkr2xn9i4bkBJZINAzBCJzWF09NtsFMvm cGd/DYhsUCkpmkxV2x9A8d8XJseXY3R+i2tXV1zRyuIF2uxVETWPRf4dMgunoIZUyU1kxPEVa7Y AAJlObpS5S6GzYA== X-Received: by 2002:a1c:1b15:: with SMTP id b21mr42113577wmb.174.1636988346152; Mon, 15 Nov 2021 06:59:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0oa/CpUTWaggeGCmCOAqU5B8Z8RhJ/2ib4uzilsK0l/Wf4C9bHkOkX2oqAZOGufh4YElNHw== X-Received: by 2002:a1c:1b15:: with SMTP id b21mr42113554wmb.174.1636988346010; Mon, 15 Nov 2021 06:59:06 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Andrew Jones , Eduardo Habkost , Thomas Huth , Marcel Apfelbaum , Richard Henderson Subject: [PATCH-for-6.2 v4 01/11] tests/unit/test-smp-parse: Restore MachineClass fields after modifying Date: Mon, 15 Nov 2021 15:58:50 +0100 Message-Id: <20211115145900.2531865-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211115145900.2531865-1-philmd@redhat.com> References: <20211115145900.2531865-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636988350502100001 There is a single MachineClass object, registered with type_register_static(&smp_machine_info). Since the same object is used multiple times (an MachineState object is instantiated in both test_generic and test_with_dies), we should restore its internal state after modifying for the test purpose. Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/unit/test-smp-parse.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index cbe0c990494..47774c1ee2a 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -512,7 +512,7 @@ static void test_generic(void) smp_parse_test(ms, data, true); } =20 - /* Reset the supported min CPUs and max CPUs */ + /* Force invalid min CPUs and max CPUs */ mc->min_cpus =3D 2; mc->max_cpus =3D 511; =20 @@ -523,6 +523,10 @@ static void test_generic(void) smp_parse_test(ms, data, false); } =20 + /* Reset the supported min CPUs and max CPUs */ + mc->min_cpus =3D MIN_CPUS; + mc->max_cpus =3D MAX_CPUS; + object_unref(obj); } =20 @@ -536,6 +540,7 @@ static void test_with_dies(void) int i; =20 smp_machine_class_init(mc); + /* Force the SMP compat properties */ mc->smp_props.dies_supported =3D true; =20 for (i =3D 0; i < ARRAY_SIZE(data_generic_valid); i++) { @@ -575,6 +580,9 @@ static void test_with_dies(void) smp_parse_test(ms, data, false); } =20 + /* Restore the SMP compat properties */ + mc->smp_props.dies_supported =3D false; + object_unref(obj); } =20 --=20 2.31.1