From nobody Mon Feb 9 20:31:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1640683645; cv=none; d=zohomail.com; s=zohoarc; b=JOJtqIRH5a15b/kt+EEQV5PNXUqhpgvGze4QCAALStvjZe1AKbW9eAibfZuuC797jVvGpoeOFv0GTp1faB41GI4imNZi4GwL2bc+Y2y4u4nMRBU6y3Z912O8TTQjw+KJiC0JlyVs5ml3rxP0j5yXmzXMa3gQw/KlZeieED9+TQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640683645; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=tMlRwgrRREhKtiXqc6v5UuBkp6a6F/1aIURLphIL174=; b=dFpxzweEMPSrre4Y3GflPgkdhyOt0BeQ0jzlb+t3p1v6dRoWi+rqeRvlv98KaMd9GBNSmgBlxPuZI1FP/39M/jWMMia8CVn5uZ94IjV8eccSl1b/qhvjl3zUyviih6wpXSOE0naZ7e6wyBMPzunW/ozRGWFb30dMQopS3m9N11k= ARC-Authentication-Results: i=1; mx.zohomail.com; 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640683645675762.3291346181777; Tue, 28 Dec 2021 01:27:25 -0800 (PST) Received: from localhost ([::1]:49254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n28lQ-0007u9-S9 for importer@patchew.org; Tue, 28 Dec 2021 04:27:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n28h3-0007fJ-AL; Tue, 28 Dec 2021 04:22:53 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:4164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n28h0-00079W-VF; Tue, 28 Dec 2021 04:22:53 -0500 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4JNTXP21hKz8w7X; Tue, 28 Dec 2021 17:20:21 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 28 Dec 2021 17:22:47 +0800 To: , CC: Peter Maydell , Andrew Jones , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Paolo Bonzini , "Michael S . Tsirkin" , Igor Mammedov , Shannon Zhao , Ani Sinha , Markus Armbruster , Eric Blake , , Yanan Wang Subject: [PATCH v5 06/14] tests/unit/test-smp-parse: Keep default MIN/MAX CPUs in machine_base_class_init Date: Tue, 28 Dec 2021 17:22:13 +0800 Message-ID: <20211228092221.21068-7-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20211228092221.21068-1-wangyanan55@huawei.com> References: <20211228092221.21068-1-wangyanan55@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected 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=45.249.212.189; envelope-from=wangyanan55@huawei.com; helo=szxga03-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Yanan Wang From: Yanan Wang via X-ZM-MESSAGEID: 1640683647820000002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Most machine types in test-smp-parse will be OK to have the default MIN/MAX CPUs except "smp-generic-invalid", let's keep the default values in machine_base_class_init which will be inherited. And if we hope a different value for a specific machine, modify it in its own initialization function. Signed-off-by: Yanan Wang Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/unit/test-smp-parse.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 72d83d1bbc..fdc39a846c 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -523,15 +523,10 @@ static void machine_base_class_init(ObjectClass *oc, = void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); =20 - mc->name =3D g_strdup(SMP_MACHINE_NAME); -} - -static void machine_generic_valid_class_init(ObjectClass *oc, void *data) -{ - MachineClass *mc =3D MACHINE_CLASS(oc); - mc->min_cpus =3D MIN_CPUS; mc->max_cpus =3D MAX_CPUS; + + mc->name =3D g_strdup(SMP_MACHINE_NAME); } =20 static void machine_generic_invalid_class_init(ObjectClass *oc, void *data) @@ -547,9 +542,6 @@ static void machine_with_dies_class_init(ObjectClass *o= c, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); =20 - mc->min_cpus =3D MIN_CPUS; - mc->max_cpus =3D MAX_CPUS; - mc->smp_props.dies_supported =3D true; } =20 @@ -557,9 +549,6 @@ static void machine_with_clusters_class_init(ObjectClas= s *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); =20 - mc->min_cpus =3D MIN_CPUS; - mc->max_cpus =3D MAX_CPUS; - mc->smp_props.clusters_supported =3D true; } =20 @@ -718,7 +707,6 @@ static const TypeInfo smp_machine_types[] =3D { }, { .name =3D MACHINE_TYPE_NAME("smp-generic-valid"), .parent =3D TYPE_MACHINE, - .class_init =3D machine_generic_valid_class_init, }, { .name =3D MACHINE_TYPE_NAME("smp-generic-invalid"), .parent =3D TYPE_MACHINE, --=20 2.27.0