From nobody Mon Feb 9 16:34:22 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=1636988380; cv=none; d=zohomail.com; s=zohoarc; b=B9ADrd+tCgHFjrz+uN+mpyXvucHvWDGpfqM1lMJnOOBWLZ5QiPUi58eIhaX78VRQgWvGZZNmlSVgrnDBnq0bdgZdejRebnClj7/TqLiphfuK1RHjD32uIcjWsKw3bmcjMzlnDERhNNHdyJQqBXdddcv69FP7mzPzgl6NZAfcEp0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636988380; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=k7Mfm0kJ9oi+go9Fu+Y6UDaHOPdntdv19UcC7ZtAoHg=; b=K6yAM8PFRp0dMuotknD4LkyQSrcQGX+fJd3bZdM048cfVRqzUJfyOpf7zqslCq5NukLCwJy8xiIJsw6/cFMYCKfkN74BGJrKZh99BMAwgpQ5zgDQMKpubibFRV+XmphxoN+WI1Tjd+T9WDvKPxJS39QwGbM4+qA8vTIMQYGfwqk= 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 1636988380861665.3750546277129; Mon, 15 Nov 2021 06:59:40 -0800 (PST) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-x3TDmittP6KDhxwdJPZyYQ-1; Mon, 15 Nov 2021 09:59:38 -0500 Received: by mail-wm1-f71.google.com with SMTP id o22-20020a1c7516000000b0030d6f9c7f5fso6325601wmc.1 for ; Mon, 15 Nov 2021 06:59:38 -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 b188sm14043968wmd.45.2021.11.15.06.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988379; 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=k7Mfm0kJ9oi+go9Fu+Y6UDaHOPdntdv19UcC7ZtAoHg=; b=YRTrzlR9DxEvInLYZziRiau8yEHpiHSUSgOITFs3bzdzgo0mbQp5fvQfPMm3gDzT1TOBg9 hnluReZAcwNfkNwKwi+8dtL9HlsOGGoaortNmylO+e4GNSsVULlBB2Sc2pWpFvBxox9ROu ksUfUIT73OxbwvaLSEqI9165vCuF/Xg= X-MC-Unique: x3TDmittP6KDhxwdJPZyYQ-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=k7Mfm0kJ9oi+go9Fu+Y6UDaHOPdntdv19UcC7ZtAoHg=; b=SVSRGIKG7iuxbEC+hlaQflbRR0qK1wcbBNYsgNEyCKucotRwnm+T/HTIPV37oTuGJ0 hiwOf7UKt73lqpD+msoT7SSz7KYJdhrlZ43hkQDNnavU95z3LdDMuZGP5zE2ZvQMf4mk cKUuURdH2UXpfmyq2EBbfEDGoXOmsgyQXkOYPnKpemk1DenGvhzH0GHvf+bkjXcZGEtE Gty3YCip0Pddy7rkyoWJRDzh3eUKKWbSnqE9tsj7okiHJGvYqIBycvIoTJnMyhanaJtY CO3gTPLSwO+Gn48V68tQVG79rr3FrisAtyUW9QxBF1Bf9gfJI3Jc/3wrBtJZAsV1TEkN WB7g== X-Gm-Message-State: AOAM533BSmN9mDyyf/T9eGToNw3/8Z5wXnI1ZYqBJ//I4B+8m8glwY/r 7a1lGpmnqNP3wYWlcNfWGeD+zeQZflks4dW1Yo88GSwFCAgpjgEc7c2fYlob6RKIdwrdH5aPOcg Wvy2BG7j1rYTzTA== X-Received: by 2002:a5d:464c:: with SMTP id j12mr47415611wrs.150.1636988377355; Mon, 15 Nov 2021 06:59:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZcmTp4r0jzDzTwRnun/HIV1bv/UO4CRlPVTREiare+KSKukQl/Vr0NsBwexNnIWCObYijcg== X-Received: by 2002:a5d:464c:: with SMTP id j12mr47415595wrs.150.1636988377243; Mon, 15 Nov 2021 06:59:37 -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 08/11] tests/unit/test-smp-parse: Add 'smp-without-dies-valid' machine type Date: Mon, 15 Nov 2021 15:58:57 +0100 Message-Id: <20211115145900.2531865-9-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: 1636988381542100001 Keep the common TYPE_MACHINE class initialization in machine_base_class_init(), make it abstract, and move the non-common code to a new class: "smp-without-dies-valid". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- tests/unit/test-smp-parse.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index dfe7f1313b0..90a249fe8c8 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -478,13 +478,19 @@ static void machine_base_class_init(ObjectClass *oc, = void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); =20 + mc->smp_props.prefer_sockets =3D true; + + mc->name =3D g_strdup(SMP_MACHINE_NAME); +} + +static void machine_without_dies_valid_class_init(ObjectClass *oc, void *d= ata) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + mc->min_cpus =3D MIN_CPUS; mc->max_cpus =3D MAX_CPUS; =20 - mc->smp_props.prefer_sockets =3D true; mc->smp_props.dies_supported =3D false; - - mc->name =3D g_strdup(SMP_MACHINE_NAME); } =20 static void machine_without_dies_invalid_class_init(ObjectClass *oc, void = *data) @@ -606,9 +612,14 @@ static const TypeInfo smp_machine_types[] =3D { { .name =3D TYPE_MACHINE, .parent =3D TYPE_OBJECT, + .abstract =3D true, .class_init =3D machine_base_class_init, .class_size =3D sizeof(MachineClass), .instance_size =3D sizeof(MachineState), + }, { + .name =3D MACHINE_TYPE_NAME("smp-without-dies-valid"), + .parent =3D TYPE_MACHINE, + .class_init =3D machine_without_dies_valid_class_init, }, { .name =3D MACHINE_TYPE_NAME("smp-without-dies-invalid"), .parent =3D TYPE_MACHINE, @@ -629,7 +640,7 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); =20 g_test_add_data_func("/test-smp-parse/generic/valid", - TYPE_MACHINE, + MACHINE_TYPE_NAME("smp-without-dies-valid"), test_generic_valid); g_test_add_data_func("/test-smp-parse/generic/invalid", MACHINE_TYPE_NAME("smp-without-dies-invalid"), --=20 2.31.1