From nobody Tue Feb 10 04:16:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1636988373; cv=none; d=zohomail.com; s=zohoarc; b=HUJ4xgnQNiwWUrHbtIV9f/SMWU7lbnxyb6cd2vKB8y4GYqEETKdYNv7/uOgrDvNAJ3Fz2bur8vYHUjAu9tjkJmG0o6ug2xRCH18NMaJZUS6M9o+0fgKMxrosNe8MaUECT7SqluXKOhIMHQXuJI3zCfQis65GqkCr3b7bVEOo9UA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636988373; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=4xRdiXmpdnfeTUGpX5NMgs94Fe642FxHpeJMvGfGSJQ=; b=OYEUm6C2lkKjYShq8CeWJ3VCnEYBY0qqbeZO8WwtEgXi2wk7AG5meiEboyDHzRK10dOxWWv0TUqLcZohUVogKfJoXK3VrMkE7d5FX5N1g8t9KalwHkLEs3ZKfOxCz3eqloCcICaxZPxNq9OrdeQNyFirk5DNlkYSZGe4WB5h0f4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1636988373583407.7310614481928; Mon, 15 Nov 2021 06:59:33 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-353-h9OoLUHwOeOTZ51j7NPMEQ-1; Mon, 15 Nov 2021 09:59:29 -0500 Received: by mail-wm1-f69.google.com with SMTP id z138-20020a1c7e90000000b003319c5f9164so9748933wmc.7 for ; Mon, 15 Nov 2021 06:59:29 -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 w17sm15203043wrp.79.2021.11.15.06.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988372; 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=4xRdiXmpdnfeTUGpX5NMgs94Fe642FxHpeJMvGfGSJQ=; b=IwhWZx9rE0xgCa2yfDgW4vGOEq/0uz/d3muIz0d3iBvHuhbAFu/MjWdcMFZODRXZc+G4L7 jbiLWeDds55YSjwthhUQZQkqXLGjpois1KUEEYDvoE5zCozuGpXEDKZHdWfKxdgBOQmmpq Ob/yBrK1pwTqW4oYlcYE8fnKNQ/zqFk= X-MC-Unique: h9OoLUHwOeOTZ51j7NPMEQ-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=4xRdiXmpdnfeTUGpX5NMgs94Fe642FxHpeJMvGfGSJQ=; b=O6iPkg6wBiYHWHEV6Pkk8vgp36pzz5VNYMToN6LN/dZKSbGvmTNTEUsalJJs9/d9Or LPrSsIUi6XFKYxQT0MuALhGpXlE+CDveeI5PDwGWA4xalrhU+bZPBRBcRb6LnfN6YUV5 OXrrofpJYw2E/p4cyl2noT3ZI+f8jMstL15V5V20WcVgLaJs/axJzGTbYjAs/AZ87C3c p/nJqerJsAmK5qu5BObkMrsvG567x6OAD0OBDtFZd+fBHon5GSdK04E3N3IfyoElj+QQ hJu5/ehWakpu1MJEr3o3IVdbndd8zNauSbBS7xwGEvWyoM9AIPExd5sh6a2UkW7yJCjk zkgg== X-Gm-Message-State: AOAM532oLMPAAb9iM2u7JfGnnO5ekooJf80+TrFevD3CkM1OwkKDtm9T cGDh4/dVvBr5zswiUwV3uo5P00XWjbCoQEA65DjiPPZxB8Hh7v8kbiovZ9NDznbnMZVwJM0aOYM ZxMLjsofxiTXSqA== X-Received: by 2002:a05:600c:3227:: with SMTP id r39mr64451042wmp.120.1636988368408; Mon, 15 Nov 2021 06:59:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwk/zqiwkSztF//4rF24BcxpTmpw66DybNwLZPSvoC8yRbT5o1dKrbJxPMDTtIEOmfTezfvmA== X-Received: by 2002:a05:600c:3227:: with SMTP id r39mr64451019wmp.120.1636988368289; Mon, 15 Nov 2021 06:59:28 -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 Subject: [PATCH-for-7.0 v4 06/11] tests/unit/test-smp-parse: Add 'smp-with-dies' machine type Date: Mon, 15 Nov 2021 15:58:55 +0100 Message-Id: <20211115145900.2531865-7-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: 1636988374516100001 Avoid modifying the MachineClass internals by adding the 'smp-with-dies' machine, which inherits from TYPE_MACHINE. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang --- tests/unit/test-smp-parse.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index e27aedad354..ff61da06e3d 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -487,6 +487,16 @@ static void machine_base_class_init(ObjectClass *oc, v= oid *data) mc->name =3D g_strdup(SMP_MACHINE_NAME); } =20 +static void machine_with_dies_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->smp_props.dies_supported =3D true; +} + static void test_generic_valid(const void *opaque) { const char *machine_type =3D opaque; @@ -549,9 +559,6 @@ static void test_with_dies(const void *opaque) unsigned int num_dies =3D 2; int i; =20 - /* Force the SMP compat properties */ - mc->smp_props.dies_supported =3D true; - for (i =3D 0; i < ARRAY_SIZE(data_generic_valid); i++) { *data =3D data_generic_valid[i]; unsupported_params_init(mc, data); @@ -589,9 +596,6 @@ static void test_with_dies(const void *opaque) smp_parse_test(ms, data, false); } =20 - /* Restore the SMP compat properties */ - mc->smp_props.dies_supported =3D false; - object_unref(obj); } =20 @@ -603,6 +607,10 @@ static const TypeInfo smp_machine_types[] =3D { .class_init =3D machine_base_class_init, .class_size =3D sizeof(MachineClass), .instance_size =3D sizeof(MachineState), + }, { + .name =3D MACHINE_TYPE_NAME("smp-with-dies"), + .parent =3D TYPE_MACHINE, + .class_init =3D machine_with_dies_class_init, } }; =20 @@ -621,7 +629,7 @@ int main(int argc, char *argv[]) TYPE_MACHINE, test_generic_invalid); g_test_add_data_func("/test-smp-parse/with_dies", - TYPE_MACHINE, + MACHINE_TYPE_NAME("smp-with-dies"), test_with_dies); =20 g_test_run(); --=20 2.31.1