From patchwork Mon Nov 15 14:58:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 264CFC433F5 for ; Mon, 15 Nov 2021 15:18:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA7C761AA5 for ; Mon, 15 Nov 2021 15:18:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BA7C761AA5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdkJ-0008QT-S1 for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:18:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdRx-000756-5Z for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdRt-0008TL-9Y for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:10 -0500 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= 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-244-S2fc4UsIPtWmV0q0i60m_Q-1; Mon, 15 Nov 2021 09:59:07 -0500 X-MC-Unique: S2fc4UsIPtWmV0q0i60m_Q-1 Received: by mail-wm1-f69.google.com with SMTP id 144-20020a1c0496000000b003305ac0e03aso9740358wme.8 for ; Mon, 15 Nov 2021 06:59:07 -0800 (PST) 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=sngz2Oy0GM9xIVN7bQNCB0JcA/uOU8sEQ7dE0zDLvDPUL706dz/sQFxzD4+u8MGlfN K7aGNdvXRS0lADV9lPgtAHNdelMuec93o1tlUfzIkasn53uf+czX6kmcGGwixuKGIzA9 8gBNnUhFtkc3bE5otT2vOZUNEI0ep7Nf4FNbEZ9YkArqQZUSUnqGnQTTHXVad7HFPnrD rnle7swsnwAzgAXx4+ThxIFgG1MD36tfATRXQj6nWHGKMn2ReJyGIMoCE5ZiCEj0Xezq FVt3mCW/eiNZ0BuFwsAA+qTepg5JWfEsHrxEG6dwO5u3ITc/NC732WI9yLQ8vYXxGprZ QVyQ== X-Gm-Message-State: AOAM530RD/NagsszIH5fbv88KBvPZYajAoNn9+Ws+CjHjUP3EydrL+ME VXCVoRuGF34EfG4dzxWNZIZzhXpBj8YvwUElTNpdhJ90KI2dvM6lZsjGcuoXrz2S15gKe0773CU BTyDxF0f9npRJw4zip4gLQlQoGQTmyG0lDO0JZym8Qtxd54O5pAVZNUsJ4wGmKjOj X-Received: by 2002:a1c:1b15:: with SMTP id b21mr42113598wmb.174.1636988346242; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Richard Henderson , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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); } - /* Reset the supported min CPUs and max CPUs */ + /* Force invalid min CPUs and max CPUs */ mc->min_cpus = 2; mc->max_cpus = 511; @@ -523,6 +523,10 @@ static void test_generic(void) smp_parse_test(ms, data, false); } + /* Reset the supported min CPUs and max CPUs */ + mc->min_cpus = MIN_CPUS; + mc->max_cpus = MAX_CPUS; + object_unref(obj); } @@ -536,6 +540,7 @@ static void test_with_dies(void) int i; smp_machine_class_init(mc); + /* Force the SMP compat properties */ mc->smp_props.dies_supported = true; for (i = 0; i < ARRAY_SIZE(data_generic_valid); i++) { @@ -575,6 +580,9 @@ static void test_with_dies(void) smp_parse_test(ms, data, false); } + /* Restore the SMP compat properties */ + mc->smp_props.dies_supported = false; + object_unref(obj); } From patchwork Mon Nov 15 14:58:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 805CEC433FE for ; Mon, 15 Nov 2021 15:07:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F176B61266 for ; Mon, 15 Nov 2021 15:07:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F176B61266 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:57996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdaH-0004dB-2i for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:07:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdS0-0007Ec-SD for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdRy-0008Tv-So for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988353; 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=5aBWgeT8dX8n5hQ5ktoKDC7N22O1xIWSsGNqfC8T6cI=; b=FgZeXsQzy0dboNcELF4SMmz8l6U7qe7hgBzu36c5A1cKuhBDwysdJ94XYVXWegN9s5zvcd jnRvzRZIXB0W3ERNUzt6wwspUkdIypb8pPpO6kI2tUWIhOqSOhRiWXXzp0I/9uLQt7YgML uXrfWapT10kiW7bRAkdIqkR2phtAzPw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-nvaLh1M_N2GdwIxtHoznvg-1; Mon, 15 Nov 2021 09:59:12 -0500 X-MC-Unique: nvaLh1M_N2GdwIxtHoznvg-1 Received: by mail-wm1-f70.google.com with SMTP id g11-20020a1c200b000000b003320d092d08so6309160wmg.9 for ; Mon, 15 Nov 2021 06:59:12 -0800 (PST) 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=5aBWgeT8dX8n5hQ5ktoKDC7N22O1xIWSsGNqfC8T6cI=; b=OSV7pFUU/MrRf+QLnXPMdCvowxw0Nf4tVLXmspF2Fn7t7VJA8s49/VfqPl9iMKttdn F14kFY6ZzLt854SDjxZcq0IEjvws2oowmGHQZO81uS8OgXXA11MrK37vLjTzrbqDotG0 Ma2XKDkpZv8OFm3EpY8aYaMZ8f8ZHx9uWBsjAMS8dPrP8lGr9+m2+82nWCfg1rHX+yo6 lybuAqHAP19C1os463iHefk9hynW0bLPFuHKLoxyR42B/ojlCVQHluWBYxskop1fTGsD +H6RKOO1ZVFJvxkIXx3eyn5aIFRaxfpQQw0J60v8XksuPF+baNBofEzlJLq2+jj6abct hjYA== X-Gm-Message-State: AOAM531hzIh8jcNuEM1uhyDgkkq54uogey1xFIfLOZFKPd+6ZvzRKXrU A5B46q6O7KjYJZLZbUinh0fKpfVhJsvU0zMytTjCSM2lG1MJ1KXFxD4LLRoTv65sPfy2CLCo27U JuEGCv/FDiVSI05mPqwUYK5IPT0JhiE/n+sgY9VEpqh2W+GR6WlHy2+EquHKGRnre X-Received: by 2002:a5d:4704:: with SMTP id y4mr46850775wrq.85.1636988350799; Mon, 15 Nov 2021 06:59:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5Sfp5AM6+xO0tVEMe/4po5R+MIwLeW8l/RmHHIhz5RGCmDJZPaa/VBr0hQVulmXgq8Vrr/A== X-Received: by 2002:a5d:4704:: with SMTP id y4mr46850721wrq.85.1636988350453; Mon, 15 Nov 2021 06:59:10 -0800 (PST) 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 l5sm13007464wml.20.2021.11.15.06.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-6.2 v4 02/11] tests/unit/test-smp-parse: QOM'ify smp_machine_class_init() Date: Mon, 15 Nov 2021 15:58:51 +0100 Message-Id: <20211115145900.2531865-3-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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Richard Henderson , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" smp_machine_class_init() is the actual TypeInfo::class_init(). Declare it as such in smp_machine_info, and avoid to call it manually in each test. Move smp_machine_info definition just before we register the type to avoid a forward declaration. Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang Signed-off-by: Philippe Mathieu-Daudé --- tests/unit/test-smp-parse.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 47774c1ee2a..3fff2af4e27 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -75,14 +75,6 @@ typedef struct SMPTestData { const char *expect_error; } SMPTestData; -/* Type info of the tested machine */ -static const TypeInfo smp_machine_info = { - .name = TYPE_MACHINE, - .parent = TYPE_OBJECT, - .class_size = sizeof(MachineClass), - .instance_size = sizeof(MachineState), -}; - /* * List all the possible valid sub-collections of the generic 5 * topology parameters (i.e. cpus/maxcpus/sockets/cores/threads), @@ -480,9 +472,10 @@ static void unsupported_params_init(MachineClass *mc, SMPTestData *data) } } -/* Reset the related machine properties before each sub-test */ -static void smp_machine_class_init(MachineClass *mc) +static void machine_base_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->min_cpus = MIN_CPUS; mc->max_cpus = MAX_CPUS; @@ -498,8 +491,6 @@ static void test_generic(void) SMPTestData *data = &(SMPTestData){{ }}; int i; - smp_machine_class_init(mc); - for (i = 0; i < ARRAY_SIZE(data_generic_valid); i++) { *data = data_generic_valid[i]; unsupported_params_init(mc, data); @@ -539,7 +530,6 @@ static void test_with_dies(void) unsigned int num_dies = 2; int i; - smp_machine_class_init(mc); /* Force the SMP compat properties */ mc->smp_props.dies_supported = true; @@ -586,12 +576,24 @@ static void test_with_dies(void) object_unref(obj); } +/* Type info of the tested machine */ +static const TypeInfo smp_machine_types[] = { + { + .name = TYPE_MACHINE, + .parent = TYPE_OBJECT, + .class_init = machine_base_class_init, + .class_size = sizeof(MachineClass), + .instance_size = sizeof(MachineState), + } +}; + +DEFINE_TYPES(smp_machine_types) + int main(int argc, char *argv[]) { - g_test_init(&argc, &argv, NULL); - module_call_init(MODULE_INIT_QOM); - type_register_static(&smp_machine_info); + + g_test_init(&argc, &argv, NULL); g_test_add_func("/test-smp-parse/generic", test_generic); g_test_add_func("/test-smp-parse/with_dies", test_with_dies); From patchwork Mon Nov 15 14:58:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35118C433F5 for ; Mon, 15 Nov 2021 15:05:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EFC8B6321B for ; Mon, 15 Nov 2021 15:05:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EFC8B6321B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:51854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdXy-0000Na-PS for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:05:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdS4-0007Gb-IF for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdS2-0008VS-9Y for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988357; 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=4KAeBrUilj/ve6Ofp+Ew6cDhrRd6+8AxOgCMLHgLOxQ=; b=WB3tu6iLh5AUt6QpaK5oIxrK3pnsOlbP+21Mzk64KSJ0ueQOMwzQAjCbsN9EocL1MmvoaX DGGdWpf7WFlufjKp4Md0dRv100bjHwMo9fIZgnBXU+XDxorEhtHdwCAPjCLAfdkPwb2GGM xog8vHmDUMhMVKnxksK/gfNspnTI3e0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-U4hAGtG8PrmU-qtLlBtxYw-1; Mon, 15 Nov 2021 09:59:16 -0500 X-MC-Unique: U4hAGtG8PrmU-qtLlBtxYw-1 Received: by mail-wr1-f70.google.com with SMTP id q7-20020adff507000000b0017d160d35a8so3670245wro.4 for ; Mon, 15 Nov 2021 06:59:16 -0800 (PST) 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=4KAeBrUilj/ve6Ofp+Ew6cDhrRd6+8AxOgCMLHgLOxQ=; b=fz22r1FqnuwbyGcR1GBNxumJTOaKWB903y/ceSeySiR9hZq8bVP3VKUc9c4RE8w+Ts qGHBr4o60bcPjcEyTI4HB7wrNeeb9QobIeeXSRZMNVyLsigjL8kLzK/Ss3i7ZYYR5Sts /eau/b1xH9lL2wgRyLaxpbXmbUbVoZ+F2U48Sgb7hHN2MWziFfhDP0HrJiTpjT1CUpeU 5pQlIlLSBiKq8MnquhcPLFpVqF0F/yJY3LR+uqG9iafaFi1PpJdGlVK8gHkXkYGZs+R2 wH5uPiSvCIqbjb8SgxiIOkdtFr96ReK74CHXJLiH049x0Np1Q0mVRbC/KIQt4DL6gaN/ EDLQ== X-Gm-Message-State: AOAM5335biwah3gPP+n+o0jqoiybjRDDpnd6Sc0NmLSeH8aiYKgRqTRl rE5P3IMRyQyTWdFCzhrUWmw9QK+4VW1Vm1aJvaIm0414nGdzJQxDFItgvtQb8va82sVgB3PC2OG +OhKmaTZ8b+8y8emWvt5adwCucGwZkuCwUsqyDF0HLP0uPJGW+bo97soV/wwMokO0 X-Received: by 2002:a5d:6e8c:: with SMTP id k12mr47514707wrz.401.1636988355139; Mon, 15 Nov 2021 06:59:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCMKRZjDDT6BXi0z8cGLwmCLsGou+twN0aKM1cAra2VHjcM269z3ycWuB/R3sbQ2VfrV4Wog== X-Received: by 2002:a5d:6e8c:: with SMTP id k12mr47514660wrz.401.1636988354923; Mon, 15 Nov 2021 06:59:14 -0800 (PST) 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 k37sm15906619wms.21.2021.11.15.06.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:14 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-6.2 v4 03/11] tests/unit/test-smp-parse: Explicit MachineClass name Date: Mon, 15 Nov 2021 15:58:52 +0100 Message-Id: <20211115145900.2531865-4-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Richard Henderson , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" If the MachineClass::name pointer is not explicitly set, it is NULL. Per the C standard, passing a NULL pointer to printf "%s" format is undefined. Some implementations display it as 'NULL', other as 'null'. Since we are comparing the formatted output, we need a stable value. The easiest is to explicit a machine name string. Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang Signed-off-by: Philippe Mathieu-Daudé --- tests/unit/test-smp-parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 3fff2af4e27..b02450e25a3 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -23,6 +23,8 @@ #define MIN_CPUS 1 /* set the min CPUs supported by the machine as 1 */ #define MAX_CPUS 512 /* set the max CPUs supported by the machine as 512 */ +#define SMP_MACHINE_NAME "TEST-SMP" + /* * Used to define the generic 3-level CPU topology hierarchy * -sockets/cores/threads @@ -307,13 +309,13 @@ static struct SMPTestData data_generic_invalid[] = { * should tweak the supported min CPUs to 2 for testing */ .config = SMP_CONFIG_GENERIC(T, 1, F, 0, F, 0, F, 0, F, 0), .expect_error = "Invalid SMP CPUs 1. The min CPUs supported " - "by machine '(null)' is 2", + "by machine '" SMP_MACHINE_NAME "' is 2", }, { /* config: -smp 512 * should tweak the supported max CPUs to 511 for testing */ .config = SMP_CONFIG_GENERIC(T, 512, F, 0, F, 0, F, 0, F, 0), .expect_error = "Invalid SMP CPUs 512. The max CPUs supported " - "by machine '(null)' is 511", + "by machine '" SMP_MACHINE_NAME "' is 511", }, }; @@ -481,6 +483,8 @@ static void machine_base_class_init(ObjectClass *oc, void *data) mc->smp_props.prefer_sockets = true; mc->smp_props.dies_supported = false; + + mc->name = g_strdup(SMP_MACHINE_NAME); } static void test_generic(void) From patchwork Mon Nov 15 14:58:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D25C433F5 for ; Mon, 15 Nov 2021 15:07:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0129E63212 for ; Mon, 15 Nov 2021 15:07:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0129E63212 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdaP-0005DR-5j for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:07:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSp-0008DJ-JA for qemu-devel@nongnu.org; Mon, 15 Nov 2021 10:00:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSn-0000D2-G5 for qemu-devel@nongnu.org; Mon, 15 Nov 2021 10:00:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988404; 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=BZpI0ahGf4kduGjb9YumMUGF6LmoFzxgBcNi4uwMZn8=; b=JCerl6pt8iYl6uMla7DlOYoZ1NJJAMGK4jFLeHE6ZW6c0j+jNQ02ncI/G2TelQUmXxxeU0 NCLA0R2rrI5cIE3ogOv6nI6K9D0ffSSlV9S5MXc2MkITeNJ4Brxl+8jhS+4fCM8xF+on1i NcIJHd/3OIpHyaG702rsUFDa0NBcrZI= 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-487-YCQYesshMCSuizJDUtjyyA-1; Mon, 15 Nov 2021 09:59:20 -0500 X-MC-Unique: YCQYesshMCSuizJDUtjyyA-1 Received: by mail-wm1-f71.google.com with SMTP id 205-20020a1c00d6000000b003335d1384f1so6799547wma.3 for ; Mon, 15 Nov 2021 06:59:20 -0800 (PST) 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=BZpI0ahGf4kduGjb9YumMUGF6LmoFzxgBcNi4uwMZn8=; b=xX/OUVuoEgGsAFDzxg+fMQQRj7nYMsNLsMQuELLWVBagmkIllfbOdsstfHmIoCCI3u dOA/q6sW0JJItaLtUGSt97y9LGOthG402AW17YuAP/AWoTquHUmF9RhzTenTiJxoS7Ut Ev0iNi3e5OkUaVHB3wWL7b+7AYYNlv1/fvIyHBycjdRTEuW4QGxU/qNZRq+s186j9v8E p80svOMl2+aGX+CYK+8860peqN1gUXWKaZefqbGpi3tZ4QYat3bL3rdFlRwmchzhUb0y x4VegFsSVl+J9b/fa4UnF1TWSIh6dmGOUr97WrHi5+xu4hNyemOFXKUbzjU1Ls7k/Is8 k2Fw== X-Gm-Message-State: AOAM53329XC7QCNv58pbGmtpIOS4Xe1zotdXOtpS41lAEabQ9kRR4iFG du8Tih6cmbOzIzYxZs9GGNsVQvtzb0rYYkABPi8DDZvu4fyzWnaXR3HnR2oP6H4NayDoPK9d3Iq sVKkj7V9kdRTImMb98vDpI0nYruA7NhwwGU7/Zgs/sLF/8CpMqJIBF9Kp3Y6iqlC1 X-Received: by 2002:a7b:ce16:: with SMTP id m22mr42101243wmc.39.1636988359552; Mon, 15 Nov 2021 06:59:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmV7M5DT5RuonHLIfQoQVMZNVgK795Dk22eQTXVP5DyttGto4TohsnhEW3oETy41PCeUw0HA== X-Received: by 2002:a7b:ce16:: with SMTP id m22mr42101213wmc.39.1636988359392; Mon, 15 Nov 2021 06:59:19 -0800 (PST) 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 h15sm14551985wml.9.2021.11.15.06.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 v4 04/11] tests/unit/test-smp-parse: Pass machine type as argument to tests Date: Mon, 15 Nov 2021 15:58:53 +0100 Message-Id: <20211115145900.2531865-5-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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use g_test_add_data_func() instead of g_test_add_func() so we can pass the machine type to the tests (we will soon have different machine types). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang --- tests/unit/test-smp-parse.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index b02450e25a3..37c6b4981db 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -487,9 +487,10 @@ static void machine_base_class_init(ObjectClass *oc, void *data) mc->name = g_strdup(SMP_MACHINE_NAME); } -static void test_generic(void) +static void test_generic(const void *opaque) { - Object *obj = object_new(TYPE_MACHINE); + const char *machine_type = opaque; + Object *obj = object_new(machine_type); MachineState *ms = MACHINE(obj); MachineClass *mc = MACHINE_GET_CLASS(obj); SMPTestData *data = &(SMPTestData){{ }}; @@ -525,9 +526,10 @@ static void test_generic(void) object_unref(obj); } -static void test_with_dies(void) +static void test_with_dies(const void *opaque) { - Object *obj = object_new(TYPE_MACHINE); + const char *machine_type = opaque; + Object *obj = object_new(machine_type); MachineState *ms = MACHINE(obj); MachineClass *mc = MACHINE_GET_CLASS(obj); SMPTestData *data = &(SMPTestData){{ }}; @@ -599,8 +601,12 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); - g_test_add_func("/test-smp-parse/generic", test_generic); - g_test_add_func("/test-smp-parse/with_dies", test_with_dies); + g_test_add_data_func("/test-smp-parse/generic", + TYPE_MACHINE, + test_generic); + g_test_add_data_func("/test-smp-parse/with_dies", + TYPE_MACHINE, + test_with_dies); g_test_run(); From patchwork Mon Nov 15 14:58:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A9AEC433EF for ; Mon, 15 Nov 2021 15:02:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA54A63211 for ; Mon, 15 Nov 2021 15:02:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EA54A63211 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdUl-0002EN-Sy for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:02:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSP-0007tR-Qo for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSB-0008WB-FO for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988366; 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=gF1s0KbAL9b83AB6/JlbAHqywgqU7lOR4NhlFP3KFgg=; b=cy2OEnuTRuwnbJtQVSpL1cS2O8A8lJEdoXNuCVUaBHP65zobighyd7hhx1BtbVO3azEgyV 2EqfxHMd55gN0IZhuPDZUrEpuPyhNEuL27bX8B8Fvu/yequjb2XocaP9QMnSX3G7S2JKcR U5ZA2Bdjkv666n6Jp2f1RutAvPVsEd4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-hD989GA5M5S2vhzoSIfTbw-1; Mon, 15 Nov 2021 09:59:25 -0500 X-MC-Unique: hD989GA5M5S2vhzoSIfTbw-1 Received: by mail-wr1-f70.google.com with SMTP id q7-20020adff507000000b0017d160d35a8so3670391wro.4 for ; Mon, 15 Nov 2021 06:59:25 -0800 (PST) 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=gF1s0KbAL9b83AB6/JlbAHqywgqU7lOR4NhlFP3KFgg=; b=bWoK5f/Pqzv25JI+nQW4NZWhwDrSdB0tIlOFBAdaMkLQPK63mMrX1evz5kSD2hL8bS QPshpjUHNgQYUHBMU3dJQ2M5U9zmS4hf7uWYhHlT4OsGeBQJ1Y1QOrw5dg2W24NoXHN3 VnOY4a20UdKw8gYYYVpnu4pj6inKbqJHcoHEY/1e5+ej77KwhlRbICEVF8d9wA/NEdOh xO9pZDm1Yln4IsxiMpVZPhaXyvy/ceaRzd4B/cS4Fb0/O+CAj5UoI93bZQ2X8uPpwnU4 YX3nY/PzauN66NDzG/zawKt4ZVVoUUGSoxh1WDF7U8TQd5FudBusSBehysXAwK0QCiPe e47w== X-Gm-Message-State: AOAM532usKiTaNFmjFPp3r+ACsRu+78lRE4AxoiqW4LGip1vGcWyU0rP u2paUE8rPYuOsqWpnEi61Gufz0QZ7WktcnK5NWsWBJp8PtGmZoBjruAPRQr0xA7JoMgllyceCid ULghKepI0Xa1TLsYCKN3pKV3u+GIhZdgYKZZdWqzPRPRpTEWoaw61HQW9wIMp2U1G X-Received: by 2002:a05:600c:3553:: with SMTP id i19mr59753383wmq.97.1636988364093; Mon, 15 Nov 2021 06:59:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBiHO29Vm+h+jU24GT/dqqfeksL0Vw9veynBbFRs2Rn1r5bPrUU8uyakzy04flTYbN4S4oew== X-Received: by 2002:a05:600c:3553:: with SMTP id i19mr59753356wmq.97.1636988363875; Mon, 15 Nov 2021 06:59:23 -0800 (PST) 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 d15sm20289354wri.50.2021.11.15.06.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 v4 05/11] tests/unit/test-smp-parse: Split the 'generic' test in valid / invalid Date: Mon, 15 Nov 2021 15:58:54 +0100 Message-Id: <20211115145900.2531865-6-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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: , Cc: Andrew Jones , Eduardo Habkost , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Split the 'generic' test in two tests: 'valid' and 'invalid'. This will allow us to remove the hack which modifies the MachineClass internal state. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang --- tests/unit/test-smp-parse.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 37c6b4981db..e27aedad354 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -487,7 +487,7 @@ static void machine_base_class_init(ObjectClass *oc, void *data) mc->name = g_strdup(SMP_MACHINE_NAME); } -static void test_generic(const void *opaque) +static void test_generic_valid(const void *opaque) { const char *machine_type = opaque; Object *obj = object_new(machine_type); @@ -508,6 +508,19 @@ static void test_generic(const void *opaque) smp_parse_test(ms, data, true); } + object_unref(obj); +} + +static void test_generic_invalid(const void *opaque) +{ + const char *machine_type = opaque; + Object *obj = object_new(machine_type); + MachineState *ms = MACHINE(obj); + MachineClass *mc = MACHINE_GET_CLASS(obj); + SMPTestData *data = &(SMPTestData){}; + int i; + + /* Force invalid min CPUs and max CPUs */ mc->min_cpus = 2; mc->max_cpus = 511; @@ -601,9 +614,12 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); - g_test_add_data_func("/test-smp-parse/generic", + g_test_add_data_func("/test-smp-parse/generic/valid", TYPE_MACHINE, - test_generic); + test_generic_valid); + g_test_add_data_func("/test-smp-parse/generic/invalid", + TYPE_MACHINE, + test_generic_invalid); g_test_add_data_func("/test-smp-parse/with_dies", TYPE_MACHINE, test_with_dies); From patchwork Mon Nov 15 14:58:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6BEDC433F5 for ; Mon, 15 Nov 2021 15:08:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 929E763225 for ; Mon, 15 Nov 2021 15:08:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 929E763225 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdai-0006IH-Ng for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:08:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSH-0007au-Mq for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSF-000057-Co for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988370; 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=PkNx1vVthJresEPv0AEPQMCe6OwiQPQTnh+dL7sr9nWVGRnZiFFjfXUDTWtFaYfb9y5VJP 0RhChKDKkRKMKqEkJRRXRjd9Rf6nEm/muUYg6QGYhfWVxN3M9l6G8A4Oo8N/cp8t9eS2jx m2+WF91Gb/85OadjEZLlAQWnuU0ic3w= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-9VPUh_mUN567LNYRycLYIA-1; Mon, 15 Nov 2021 09:59:29 -0500 X-MC-Unique: 9VPUh_mUN567LNYRycLYIA-1 Received: by mail-wr1-f72.google.com with SMTP id v17-20020adfedd1000000b0017c5e737b02so3653868wro.18 for ; Mon, 15 Nov 2021 06:59:29 -0800 (PST) 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=Hgf4YgfP4Q9aJOkjtUt6dofpqK0AOzdi1eEkynnqRdy7X00q23BW1pSC6wGokqX6sQ Etbnz00sjCJtsrz0r4ZHUzr08uFfzDlp7DhX8oi1VXo7vMXmQjbiBL0O1XczEGdg9f44 i6d+IlZq4DgXLikbX5XV6mpE61kKPtHfmyLC/RFBlJanzZ2YLEn6cgueqfE2lNOFcui/ tSibbChawAHByxfsNy3nZSBpiAEQPcnidm1zE4+ZkuEVRIehgRr1T9D52Dwz4opgmLkU bJHvUtYcXP7O2Thlfp3n3mED/4imaJGCsyooD3Eim68WdhfDl0IugPJASzPOUaL1fnBB y5nQ== X-Gm-Message-State: AOAM533+Z/udbOKM62J8Hj5iqa21UpkDx/0bEDSDaAeQ2qbNLwf+gyFr a4F9VzvXU8/dVEparXYRRdlkAbu81hgj5d16jQsB+yjlrC0x8z76jwl1VXd09cwWx9NanleRYBZ HbEQaggwtw9QsFheMLoYN3Z/4FFd1Dyut4aKWALjajEtrLluFiVgjwaV7LF3bvlNI X-Received: by 2002:a05:600c:3227:: with SMTP id r39mr64451050wmp.120.1636988368455; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=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: , Cc: Andrew Jones , Eduardo Habkost , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Avoid modifying the MachineClass internals by adding the 'smp-with-dies' machine, which inherits from TYPE_MACHINE. Signed-off-by: Philippe Mathieu-Daudé 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, void *data) mc->name = g_strdup(SMP_MACHINE_NAME); } +static void machine_with_dies_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + mc->min_cpus = MIN_CPUS; + mc->max_cpus = MAX_CPUS; + + mc->smp_props.dies_supported = true; +} + static void test_generic_valid(const void *opaque) { const char *machine_type = opaque; @@ -549,9 +559,6 @@ static void test_with_dies(const void *opaque) unsigned int num_dies = 2; int i; - /* Force the SMP compat properties */ - mc->smp_props.dies_supported = true; - for (i = 0; i < ARRAY_SIZE(data_generic_valid); i++) { *data = 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); } - /* Restore the SMP compat properties */ - mc->smp_props.dies_supported = false; - object_unref(obj); } @@ -603,6 +607,10 @@ static const TypeInfo smp_machine_types[] = { .class_init = machine_base_class_init, .class_size = sizeof(MachineClass), .instance_size = sizeof(MachineState), + }, { + .name = MACHINE_TYPE_NAME("smp-with-dies"), + .parent = TYPE_MACHINE, + .class_init = machine_with_dies_class_init, } }; @@ -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); g_test_run(); From patchwork Mon Nov 15 14:58:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CB61C433EF for ; Mon, 15 Nov 2021 15:20:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01C0C61AF0 for ; Mon, 15 Nov 2021 15:20:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 01C0C61AF0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdmu-0002B5-6o for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:20:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSO-0007oy-7h for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34271) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSL-00005O-8S for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988375; 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=2CcO+Z0iBapQD7/VeLORTYFY1zV22osrIJAVn0P+5js=; b=IWdQiMCQzRW2LM+ZoZlVGM9GqhybUJOKCU8Jr8hzvGBd9c54yaJdH/q9HNRCx5cGTYc3/2 KCOQbHwNkOml/W/OHDGasdDGvejCr7cUdpgTmjtuHnOfGfrJY+ixdyPXMy/xpquDGlbZyZ nhsnS/wenYg2vCvDaFFHYHx36wIHWIA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-L2mNss_IOxmkzkCYvVmu8g-1; Mon, 15 Nov 2021 09:59:34 -0500 X-MC-Unique: L2mNss_IOxmkzkCYvVmu8g-1 Received: by mail-wr1-f69.google.com with SMTP id q17-20020adfcd91000000b0017bcb12ad4fso3657050wrj.12 for ; Mon, 15 Nov 2021 06:59:34 -0800 (PST) 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=2CcO+Z0iBapQD7/VeLORTYFY1zV22osrIJAVn0P+5js=; b=d5MTUFMxJHACW86p9RIc2Cd86m0bJoiFalcsfNcXOtksavzmAVpRldZ1k/MGEYFGUF ifogGIHyygHUD71U4MSmXvqIph+QtSCRPoRXNhHP64E/0XXEM2l2dm3sxYKgj3AZzWmS gbkxhKhtcaHcb3PHhAiPVYCKF5ST9GH1zI6rw5fwQOteEIRZSFC457CuEAQzfnosEdyE g5ErCDQJ/Wk8G0yOJ+mcQeN7NraKe8FVfvkIIaA1Cd9y9b96/YAYZpmJU+q9M8bKz27Z KBl5/Wx0Mi6gry+5nqTEtoGh/VDUg/hCi4MOKpnhOPtydaTiLS3H2dxQnRF/zn60Y66x Tl9g== X-Gm-Message-State: AOAM533rQT5XvSR4fLl3oP6ivHqGQwZRkZtm2b1SD3VuJZryJDGDXFrW mi/Mp57+gd51r+HWSZT0p2LpTr+4rKS/w9zcITTBp/BN9kNbTAQVXflB8HXnM+MmGqwX2Us6Y5o 7WhJAqLaQEfyH1TTfyk58HD51aezEzp0If8mLr56p3u5eZftsxFvKZqVexY7fb6+S X-Received: by 2002:adf:d1e2:: with SMTP id g2mr49312409wrd.346.1636988373115; Mon, 15 Nov 2021 06:59:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6CciOegvif+34GnCt0hD/64UuEDugB7rW9G76m3FCy6yAO30mqJbwBDxaNwN/j5jZNdoVtw== X-Received: by 2002:adf:d1e2:: with SMTP id g2mr49312366wrd.346.1636988372860; Mon, 15 Nov 2021 06:59:32 -0800 (PST) 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 o8sm14256154wrm.67.2021.11.15.06.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 v4 07/11] tests/unit/test-smp-parse: Add 'smp-without-dies-invalid' machine type Date: Mon, 15 Nov 2021 15:58:56 +0100 Message-Id: <20211115145900.2531865-8-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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Avoid modifying the MachineClass internals by adding the 'smp-without-dies-invalid' machine, which inherits from TYPE_MACHINE. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- tests/unit/test-smp-parse.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index ff61da06e3d..dfe7f1313b0 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -487,6 +487,17 @@ static void machine_base_class_init(ObjectClass *oc, void *data) mc->name = g_strdup(SMP_MACHINE_NAME); } +static void machine_without_dies_invalid_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + /* Force invalid min CPUs and max CPUs */ + mc->min_cpus = 2; + mc->max_cpus = 511; + + mc->smp_props.dies_supported = false; +} + static void machine_with_dies_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -530,11 +541,6 @@ static void test_generic_invalid(const void *opaque) SMPTestData *data = &(SMPTestData){}; int i; - - /* Force invalid min CPUs and max CPUs */ - mc->min_cpus = 2; - mc->max_cpus = 511; - for (i = 0; i < ARRAY_SIZE(data_generic_invalid); i++) { *data = data_generic_invalid[i]; unsupported_params_init(mc, data); @@ -542,10 +548,6 @@ static void test_generic_invalid(const void *opaque) smp_parse_test(ms, data, false); } - /* Reset the supported min CPUs and max CPUs */ - mc->min_cpus = MIN_CPUS; - mc->max_cpus = MAX_CPUS; - object_unref(obj); } @@ -607,6 +609,10 @@ static const TypeInfo smp_machine_types[] = { .class_init = machine_base_class_init, .class_size = sizeof(MachineClass), .instance_size = sizeof(MachineState), + }, { + .name = MACHINE_TYPE_NAME("smp-without-dies-invalid"), + .parent = TYPE_MACHINE, + .class_init = machine_without_dies_invalid_class_init, }, { .name = MACHINE_TYPE_NAME("smp-with-dies"), .parent = TYPE_MACHINE, @@ -626,7 +632,7 @@ int main(int argc, char *argv[]) TYPE_MACHINE, test_generic_valid); g_test_add_data_func("/test-smp-parse/generic/invalid", - TYPE_MACHINE, + MACHINE_TYPE_NAME("smp-without-dies-invalid"), test_generic_invalid); g_test_add_data_func("/test-smp-parse/with_dies", MACHINE_TYPE_NAME("smp-with-dies"), From patchwork Mon Nov 15 14:58:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C7D0C433F5 for ; Mon, 15 Nov 2021 15:22:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A522961A3D for ; Mon, 15 Nov 2021 15:22:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A522961A3D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdoV-0005HL-SO for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:22:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSf-00082j-Gl for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSO-00006f-Ah for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:46 -0500 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= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-ai0nrpJTNCOdHeFKS2Dvmw-1; Mon, 15 Nov 2021 09:59:38 -0500 X-MC-Unique: ai0nrpJTNCOdHeFKS2Dvmw-1 Received: by mail-wr1-f69.google.com with SMTP id u4-20020a5d4684000000b0017c8c1de97dso3654614wrq.16 for ; Mon, 15 Nov 2021 06:59:38 -0800 (PST) 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=cE8I0GUzd9jvs5VssB0mq+VJK5H+2hDf4xbVHthS0a5eJktN8V/aB4ao6+nVSpgOt8 2L4gcyKS3wIZLLmqyrSCsS1ah1bsO2qLrKj5wob1BFXT97sM/yqecaUAEEa5+963AKLL 8XipYJlCcbCfs5+e+tD7toIVX1oTvdW5Bsiex74khoV2TV0E9p1c6WyCECB3EfBOSgYi Um6GJNSyMV4NhirRcjI8zDcgLOappyvffchW2KAF3FUuwYtXF18Ui6g+MwyvzJR10ZUI 7ZfNO5RdooqVNxoDmIIncYGPi4jqDo4kMsFc/tq8uyJy5UKJ7DUIJ3eJ5lrYtj5W3Cyy JN1w== X-Gm-Message-State: AOAM5304Sa07jNUJgj0uvfWtqt4dSnfRtNKlGzEbU3FSmdNLnjvJ8qfO s8dOKOLeGSA6fqmOp4+p9loBqy+VEkQXguCTtTtKVJV3a83RKyciRQPI698ohhjiQodFe8HGnGq HiafDvq63z6VLzI94yBGvZj7pCHGvUGj2GnRYy1+/HJzyaS0DBTYv7wLt54sbv3Zq X-Received: by 2002:a5d:464c:: with SMTP id j12mr47415619wrs.150.1636988377382; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é 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 = MACHINE_CLASS(oc); + mc->smp_props.prefer_sockets = true; + + mc->name = g_strdup(SMP_MACHINE_NAME); +} + +static void machine_without_dies_valid_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + mc->min_cpus = MIN_CPUS; mc->max_cpus = MAX_CPUS; - mc->smp_props.prefer_sockets = true; mc->smp_props.dies_supported = false; - - mc->name = g_strdup(SMP_MACHINE_NAME); } static void machine_without_dies_invalid_class_init(ObjectClass *oc, void *data) @@ -606,9 +612,14 @@ static const TypeInfo smp_machine_types[] = { { .name = TYPE_MACHINE, .parent = TYPE_OBJECT, + .abstract = true, .class_init = machine_base_class_init, .class_size = sizeof(MachineClass), .instance_size = sizeof(MachineState), + }, { + .name = MACHINE_TYPE_NAME("smp-without-dies-valid"), + .parent = TYPE_MACHINE, + .class_init = machine_without_dies_valid_class_init, }, { .name = MACHINE_TYPE_NAME("smp-without-dies-invalid"), .parent = TYPE_MACHINE, @@ -629,7 +640,7 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); 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"), From patchwork Mon Nov 15 14:58:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E22CDC433EF for ; Mon, 15 Nov 2021 15:10:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7BD8963211 for ; Mon, 15 Nov 2021 15:10:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7BD8963211 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdd5-0003Ve-Hg for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:10:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSf-00082i-Ff for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51433) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdST-000084-2i for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988384; 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=7qrzT/vnokZ3nh9S7J+fR3Ca5gL/K7rOLc2Ix6PJKjc=; b=RxosOmOMseojs0qHhCh55Np6+gCbfo1uCJM4Ygk+/Iyt+8K4vcSHL+VebQokvYZqu6qljd NIIxkAVJP4Q4YysgWODv38fMdDdbC+L1vGVDspcpj/vGwrDrdSihzr0OdJIQ0Uqa1OAtms 3K4CkSIPGTljRWRvnOsh2fOEle/1oBQ= 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-238-hJlYuoBfNjipk9xC1yCHOA-1; Mon, 15 Nov 2021 09:59:43 -0500 X-MC-Unique: hJlYuoBfNjipk9xC1yCHOA-1 Received: by mail-wm1-f69.google.com with SMTP id l187-20020a1c25c4000000b0030da46b76daso9723222wml.9 for ; Mon, 15 Nov 2021 06:59:43 -0800 (PST) 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=7qrzT/vnokZ3nh9S7J+fR3Ca5gL/K7rOLc2Ix6PJKjc=; b=DkYgh5wkqdyQPEL9g3Og7YoUsgt/qZFceSgvx8sMh1a9cESbjGMKTo/+qcbUPz2PP0 om+8lmkulLRZ1z1AfCW+zNQaFgHRKseOs/dXvFVoG/NA8QGRnRy7jQGvyi9kXVYCSxHF KMoDIhE8c2ISChzXhV8HXa/glRBVj5dst+/IoB+kZ7/BqPfFNO6Oisf7eXX4nforPYwV tgRVuF5aF8wEP8Cvs7Sc4+R6l91AdeSVNvnj90vlnlwTLx9aLGWy5sy1wGCg9dCMHTyp L3h94h1zsaYanD0V4YWRTFiNwm2XQ0zFEeahUkKonEa+JOY9xPjaU6Z1uqKQCOtX3alX ygBg== X-Gm-Message-State: AOAM533BBoLDNNKvtOXV1iS+a5lRg6lb2xp8HLUfgrv7ygaH8CzRm7LM MSw+yls0vg/Tn9C+QyjNWBNDpjy718gm6GFKKSgQHlTu+v4jLQ9k/aYLfnF29EJ+6GPcJs71xAq 12fHQByh+gNpNzkZjsHtPDKfZFP9UdOFyTfjDIAzPOAgEnzRIsqo+e89x7qb48j5K X-Received: by 2002:a1c:448b:: with SMTP id r133mr60991518wma.85.1636988381983; Mon, 15 Nov 2021 06:59:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJykDunek8iQ6DRO/1a7gbv8dm/sXnTEje1uFEdMxUcwqTlr0/Y4tcY1g6TJ2uU2BGzyKxPDvA== X-Received: by 2002:a1c:448b:: with SMTP id r133mr60991475wma.85.1636988381663; Mon, 15 Nov 2021 06:59:41 -0800 (PST) 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 4sm18966325wrz.90.2021.11.15.06.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 v4 09/11] tests/unit/test-smp-parse: Simplify pointer to compound literal use Date: Mon, 15 Nov 2021 15:58:58 +0100 Message-Id: <20211115145900.2531865-10-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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Richard Henderson , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We can simply use a local variable (and pass its pointer) instead of a pointer to a compound literal. Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang Signed-off-by: Philippe Mathieu-Daudé --- tests/unit/test-smp-parse.c | 66 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 90a249fe8c8..2f3bcf198a5 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -520,19 +520,19 @@ static void test_generic_valid(const void *opaque) Object *obj = object_new(machine_type); MachineState *ms = MACHINE(obj); MachineClass *mc = MACHINE_GET_CLASS(obj); - SMPTestData *data = &(SMPTestData){{ }}; + SMPTestData data = {}; int i; for (i = 0; i < ARRAY_SIZE(data_generic_valid); i++) { - *data = data_generic_valid[i]; - unsupported_params_init(mc, data); + data = data_generic_valid[i]; + unsupported_params_init(mc, &data); - smp_parse_test(ms, data, true); + smp_parse_test(ms, &data, true); /* Unsupported parameters can be provided with their values as 1 */ - data->config.has_dies = true; - data->config.dies = 1; - smp_parse_test(ms, data, true); + data.config.has_dies = true; + data.config.dies = 1; + smp_parse_test(ms, &data, true); } object_unref(obj); @@ -544,14 +544,14 @@ static void test_generic_invalid(const void *opaque) Object *obj = object_new(machine_type); MachineState *ms = MACHINE(obj); MachineClass *mc = MACHINE_GET_CLASS(obj); - SMPTestData *data = &(SMPTestData){}; + SMPTestData data = {}; int i; for (i = 0; i < ARRAY_SIZE(data_generic_invalid); i++) { - *data = data_generic_invalid[i]; - unsupported_params_init(mc, data); + data = data_generic_invalid[i]; + unsupported_params_init(mc, &data); - smp_parse_test(ms, data, false); + smp_parse_test(ms, &data, false); } object_unref(obj); @@ -563,45 +563,45 @@ static void test_with_dies(const void *opaque) Object *obj = object_new(machine_type); MachineState *ms = MACHINE(obj); MachineClass *mc = MACHINE_GET_CLASS(obj); - SMPTestData *data = &(SMPTestData){{ }}; + SMPTestData data = {}; unsigned int num_dies = 2; int i; for (i = 0; i < ARRAY_SIZE(data_generic_valid); i++) { - *data = data_generic_valid[i]; - unsupported_params_init(mc, data); + data = data_generic_valid[i]; + unsupported_params_init(mc, &data); /* when dies parameter is omitted, it will be set as 1 */ - data->expect_prefer_sockets.dies = 1; - data->expect_prefer_cores.dies = 1; + data.expect_prefer_sockets.dies = 1; + data.expect_prefer_cores.dies = 1; - smp_parse_test(ms, data, true); + smp_parse_test(ms, &data, true); /* when dies parameter is specified */ - data->config.has_dies = true; - data->config.dies = num_dies; - if (data->config.has_cpus) { - data->config.cpus *= num_dies; + data.config.has_dies = true; + data.config.dies = num_dies; + if (data.config.has_cpus) { + data.config.cpus *= num_dies; } - if (data->config.has_maxcpus) { - data->config.maxcpus *= num_dies; + if (data.config.has_maxcpus) { + data.config.maxcpus *= num_dies; } - data->expect_prefer_sockets.dies = num_dies; - data->expect_prefer_sockets.cpus *= num_dies; - data->expect_prefer_sockets.max_cpus *= num_dies; - data->expect_prefer_cores.dies = num_dies; - data->expect_prefer_cores.cpus *= num_dies; - data->expect_prefer_cores.max_cpus *= num_dies; + data.expect_prefer_sockets.dies = num_dies; + data.expect_prefer_sockets.cpus *= num_dies; + data.expect_prefer_sockets.max_cpus *= num_dies; + data.expect_prefer_cores.dies = num_dies; + data.expect_prefer_cores.cpus *= num_dies; + data.expect_prefer_cores.max_cpus *= num_dies; - smp_parse_test(ms, data, true); + smp_parse_test(ms, &data, true); } for (i = 0; i < ARRAY_SIZE(data_with_dies_invalid); i++) { - *data = data_with_dies_invalid[i]; - unsupported_params_init(mc, data); + data = data_with_dies_invalid[i]; + unsupported_params_init(mc, &data); - smp_parse_test(ms, data, false); + smp_parse_test(ms, &data, false); } object_unref(obj); From patchwork Mon Nov 15 14:58:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DF84C433FE for ; Mon, 15 Nov 2021 15:04:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E81A61A40 for ; Mon, 15 Nov 2021 15:04:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9E81A61A40 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdXQ-0007vs-HW for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:04:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSh-00083C-FP for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSf-00008L-67 for qemu-devel@nongnu.org; Mon, 15 Nov 2021 09:59:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988388; 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=1cgRYAqM41Px2LriKtMbCkqWrzppnp4Wtl8WLrPbt8g=; b=ELVEEsGBdZJNFe0Z3pDomqG7jffBYS/zMOvVStCaB+wGlAj8qLkCgiTTgbWkEBv80MAvGY 4LqrVDdj6e8UMoPZIZtNrjxvYFXypegYRuIFEhzbzooKzCpGFFGxpz3HjigD9PYdMKk/TZ CrjmiOgOtblTnJj5L7eecV1XtJvJ9l4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-437-Qs1YxomnM32JJjUXCoPezA-1; Mon, 15 Nov 2021 09:59:47 -0500 X-MC-Unique: Qs1YxomnM32JJjUXCoPezA-1 Received: by mail-wr1-f70.google.com with SMTP id y4-20020adfd084000000b00186b16950f3so3659205wrh.14 for ; Mon, 15 Nov 2021 06:59:47 -0800 (PST) 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=1cgRYAqM41Px2LriKtMbCkqWrzppnp4Wtl8WLrPbt8g=; b=pXfCw84r7U2HoA3Ewfcdewgs5hdvAQUCmyfrCgxuneytWXLkGLGixH1Cy5X88s6HZC w2lOzp7Gwh8U/rQb6WH+OxV2S7yyxpiVa6vMGQ6Ee3KmWD2/+l6RApMPUH7yAEWDBos8 pZyMWACis+X5I9caOZF74BQMGLpD8ZgoBwSHL2FJC/42w9j5x0Vr8/zHHvkKfxvojj/N saZ8v0vyF5zl73u+YGJ/0mhldoplfVlPwEe1xlSJl+cOgPD6PAaern6XXC0lYqGufVx+ jGVMaht5UXuXJkjmf/6JZtNXIMEfgqVX+r2K+VaH9/6hKZK3yiqKjHH31/h/wOIKRyDz qOVg== X-Gm-Message-State: AOAM531MiQQpkJHH4VrWtZGkXm8x0UmD22Nd2p9iD43srf5KoNRBPduq flGgMH9cgZT3X51kTaraaak/8gs+oQCNoQY5SczkCqFnF7PlHfA5s9BaI97hvXoi8ohwlUz6ouz 5BJsPCCY9PiHenQWnVRkm5QmdOoO23LFYqUG2QeaRpPaFWTvLsc23O/lK/0AFf9xW X-Received: by 2002:a1c:cc09:: with SMTP id h9mr45141877wmb.191.1636988386264; Mon, 15 Nov 2021 06:59:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMNNqFIDTgepRxco8S6Zh8Jux7IOmBRfYU39T36RKkzsyRIdT1//measUpR5efmESqGx+hwg== X-Received: by 2002:a1c:cc09:: with SMTP id h9mr45141838wmb.191.1636988386025; Mon, 15 Nov 2021 06:59:46 -0800 (PST) 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 j40sm16105149wms.16.2021.11.15.06.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 v4 10/11] tests/unit/test-smp-parse: Constify some pointer/struct Date: Mon, 15 Nov 2021 15:58:59 +0100 Message-Id: <20211115145900.2531865-11-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Richard Henderson , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Declare structures const when we don't need to modify them at runtime. Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang Signed-off-by: Philippe Mathieu-Daudé --- tests/unit/test-smp-parse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 2f3bcf198a5..8f47a2e65f6 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -83,7 +83,7 @@ typedef struct SMPTestData { * then test the automatic calculation algorithm of the missing * values in the parser. */ -static struct SMPTestData data_generic_valid[] = { +static const struct SMPTestData data_generic_valid[] = { { /* config: no configuration provided * expect: cpus=1,sockets=1,cores=1,threads=1,maxcpus=1 */ @@ -285,7 +285,7 @@ static struct SMPTestData data_generic_valid[] = { }, }; -static struct SMPTestData data_generic_invalid[] = { +static const struct SMPTestData data_generic_invalid[] = { { /* config: -smp 2,dies=2 */ .config = SMP_CONFIG_WITH_DIES(T, 2, F, 0, T, 2, F, 0, F, 0, F, 0), @@ -319,7 +319,7 @@ static struct SMPTestData data_generic_invalid[] = { }, }; -static struct SMPTestData data_with_dies_invalid[] = { +static const struct SMPTestData data_with_dies_invalid[] = { { /* config: -smp 16,sockets=2,dies=2,cores=4,threads=2,maxcpus=16 */ .config = SMP_CONFIG_WITH_DIES(T, 16, T, 2, T, 2, T, 4, T, 2, T, 16), @@ -356,7 +356,7 @@ static char *smp_config_to_string(SMPConfiguration *config) config->has_maxcpus ? "true" : "false", config->maxcpus); } -static char *cpu_topology_to_string(CpuTopology *topo) +static char *cpu_topology_to_string(const CpuTopology *topo) { return g_strdup_printf( "(CpuTopology) {\n" @@ -372,7 +372,7 @@ static char *cpu_topology_to_string(CpuTopology *topo) } static void check_parse(MachineState *ms, SMPConfiguration *config, - CpuTopology *expect_topo, const char *expect_err, + const CpuTopology *expect_topo, const char *expect_err, bool is_valid) { g_autofree char *config_str = smp_config_to_string(config); @@ -466,7 +466,7 @@ static void smp_parse_test(MachineState *ms, SMPTestData *data, bool is_valid) } /* The parsed results of the unsupported parameters should be 1 */ -static void unsupported_params_init(MachineClass *mc, SMPTestData *data) +static void unsupported_params_init(const MachineClass *mc, SMPTestData *data) { if (!mc->smp_props.dies_supported) { data->expect_prefer_sockets.dies = 1; From patchwork Mon Nov 15 14:59:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12619739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D9B7C433FE for ; Mon, 15 Nov 2021 15:09:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0628F63220 for ; Mon, 15 Nov 2021 15:09:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0628F63220 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmdcA-0001sy-72 for qemu-devel@archiver.kernel.org; Mon, 15 Nov 2021 10:09:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSj-00085s-9j for qemu-devel@nongnu.org; Mon, 15 Nov 2021 10:00:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmdSg-00009c-Tw for qemu-devel@nongnu.org; Mon, 15 Nov 2021 10:00:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636988394; 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=yztInNsLIu7QfwRSSpxpOx1pYZAWme74L6OF+WOPa2U=; b=czzeCmOYeZgVB+OIteWAilpYgM2dwifo6SNZKC6X4d/l6DSEo0s5Kislst+F/4zFk18uxs UpuzEuTgRtxqxFnF5PhXXog+AZH53fXPEkF71LG8UT3u3vDQGEhb+J6KBMXas7jKCxYqOD Wo0Qh2HYIUKYDq/vYERgWRQoq7V0dmk= 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-411-A1KH5rYPNdy6oxzC31rLGg-1; Mon, 15 Nov 2021 09:59:53 -0500 X-MC-Unique: A1KH5rYPNdy6oxzC31rLGg-1 Received: by mail-wm1-f72.google.com with SMTP id ay34-20020a05600c1e2200b00337fd217772so15104wmb.4 for ; Mon, 15 Nov 2021 06:59:52 -0800 (PST) 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=yztInNsLIu7QfwRSSpxpOx1pYZAWme74L6OF+WOPa2U=; b=WeBOc3m2/MztOeCmD5+paVgv9gyBfDeFOmlj5TH05ZUIyuUnNMUT1Na2Rtk+TSG2oY nAlozcVGraS/wv4DZLKGlZda13mqIlsGodOhkjETP3kHgpV+DJUpLm0E6EYKSOL7LppU VKJdmdORApbHNRKJgwOXKegrtd3of+6IUA/lBFUdgdAOrYEzLQHnxLLaesvr2e5bZNp4 yhWe1QaTRs0yxHF4RPafp2LxTiFaSeHuhPPCO9PkZC/8l3QhDe1XEsvLGW8ASlmcR2Mh GpqAPglgPiYXbI7t4FOp6a9ogrt/499irXdfi9xxXPsaIUO8x++ZrS5RqhnJ0hPLebUY kCcQ== X-Gm-Message-State: AOAM533frKDEGJwrRTBBhINvJvWYRAO25OCn0ZAkfRhpws1pK07aZD03 LMLvympUTRxEqJMqi6u3ImN0My68yvKJ5RCyIPDSHAN8ULTU8KhmcQyRS7BSFYSMU3ev/cecWsa VDdUM0lIeyBkuVKHh5TlYBim5M3XNdzUIISBTwgMMcDCCEEgbEFi/PJaA1wqgnRd9 X-Received: by 2002:a5d:4582:: with SMTP id p2mr48488339wrq.364.1636988390728; Mon, 15 Nov 2021 06:59:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIoKRUnjRgOgfAroUSLRHpDuDgLBussq3AjSBId67KMcnGz8tMSA1Y3CIZq7AyxOb0lKUIOw== X-Received: by 2002:a5d:4582:: with SMTP id p2mr48488287wrq.364.1636988390476; Mon, 15 Nov 2021 06:59:50 -0800 (PST) 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 l8sm22753146wmc.40.2021.11.15.06.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 06:59:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-7.0 v4 11/11] hw/core: Rename smp_parse() -> machine_parse_smp_config() Date: Mon, 15 Nov 2021 15:59:00 +0100 Message-Id: <20211115145900.2531865-12-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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: , Cc: Andrew Jones , Eduardo Habkost , Richard Henderson , Markus Armbruster , Yanan Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" All methods related to MachineState are prefixed with "machine_". smp_parse() does not need to be an exception. Rename it and const'ify the SMPConfiguration argument, since it doesn't need to be modified. Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang Signed-off-by: Philippe Mathieu-Daudé --- include/hw/boards.h | 3 ++- hw/core/machine-smp.c | 6 ++++-- hw/core/machine.c | 2 +- tests/unit/test-smp-parse.c | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 9c1c1901046..7597cec4400 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -34,7 +34,8 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine); void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props, Error **errp); -void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp); +void machine_parse_smp_config(MachineState *ms, + const SMPConfiguration *config, Error **errp); /** * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index 116a0cbbfab..2cbfd574293 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -44,7 +44,8 @@ static char *cpu_hierarchy_to_string(MachineState *ms) } /* - * smp_parse - Generic function used to parse the given SMP configuration + * machine_parse_smp_config: Generic function used to parse the given + * SMP configuration * * Any missing parameter in "cpus/maxcpus/sockets/cores/threads" will be * automatically computed based on the provided ones. @@ -63,7 +64,8 @@ static char *cpu_hierarchy_to_string(MachineState *ms) * introduced topology members which are likely to be target specific should * be directly set as 1 if they are omitted (e.g. dies for PC since 4.1). */ -void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp) +void machine_parse_smp_config(MachineState *ms, + const SMPConfiguration *config, Error **errp) { MachineClass *mc = MACHINE_GET_CLASS(ms); unsigned cpus = config->has_cpus ? config->cpus : 0; diff --git a/hw/core/machine.c b/hw/core/machine.c index 26ec54e7261..a2d3c9969d9 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -760,7 +760,7 @@ static void machine_set_smp(Object *obj, Visitor *v, const char *name, return; } - smp_parse(ms, config, errp); + machine_parse_smp_config(ms, config, errp); } static void machine_class_init(ObjectClass *oc, void *data) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 8f47a2e65f6..8e488e95145 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -337,7 +337,7 @@ static const struct SMPTestData data_with_dies_invalid[] = { }, }; -static char *smp_config_to_string(SMPConfiguration *config) +static char *smp_config_to_string(const SMPConfiguration *config) { return g_strdup_printf( "(SMPConfiguration) {\n" @@ -371,7 +371,7 @@ static char *cpu_topology_to_string(const CpuTopology *topo) topo->cores, topo->threads, topo->max_cpus); } -static void check_parse(MachineState *ms, SMPConfiguration *config, +static void check_parse(MachineState *ms, const SMPConfiguration *config, const CpuTopology *expect_topo, const char *expect_err, bool is_valid) { @@ -380,8 +380,8 @@ static void check_parse(MachineState *ms, SMPConfiguration *config, g_autofree char *output_topo_str = NULL; Error *err = NULL; - /* call the generic parser smp_parse() */ - smp_parse(ms, config, &err); + /* call the generic parser */ + machine_parse_smp_config(ms, config, &err); output_topo_str = cpu_topology_to_string(&ms->smp);