From nobody Tue Sep 9 07:00:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1640954927; cv=none; d=zohomail.com; s=zohoarc; b=ck0Eeh/88H9jwD7XaRzqP0pAJiMnR5QXzIyHcBDPbJDJADXJIu6lq6Yh0OUn6o08VT/CRHOEy6MzA+s21V61huP35Alb0LQAfvfF0ZRfmfSWVe4c+uVB28Xxu+CuFWmtmzxHXIFBaW7Qiw1a/Y3YssbuCCP307TwJGAjaRP7XHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640954927; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Brj1G/fUhqiziIlPAK7440LnFkqvsAAYMyPJBvFCKgI=; b=lBCkIQ9M9/IrE82YjPn2S9242c9lOYB95MGjGngf1zXnJoy2+02fTbYBWd31PrTCFMyiftdH1+kW35BZ6nLf2uB0rfW5g3QONiGgw03o1cY4HWbq6DjCt95xxuxc4DLogLVVTCEH2rrfHU/QWIAqStdNC3qVuRcdtHZKBkzxkgY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1640954927442641.3639291767903; Fri, 31 Dec 2021 04:48:47 -0800 (PST) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-193-LzVi-ouQM3-aSax4819efg-1; Fri, 31 Dec 2021 07:48:45 -0500 Received: by mail-wr1-f69.google.com with SMTP id v6-20020adfa1c6000000b001a26d0c3e32so7474955wrv.14 for ; Fri, 31 Dec 2021 04:48:45 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (26.red-83-50-86.dynamicip.rima-tde.net. [83.50.86.26]) by smtp.gmail.com with ESMTPSA id y13sm30613911wrd.89.2021.12.31.04.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Dec 2021 04:48:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640954926; 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=Brj1G/fUhqiziIlPAK7440LnFkqvsAAYMyPJBvFCKgI=; b=gZtErJpTOvBmSSG7x/l7xSPX+lT4EVVC7wRXtmAsJ8vK/gJfohC+fulXoG8IlOAcUbYF7p 8W5WgxY1D3JscAS3amBLhwziICj9YE0sk1GapB5Bg0rTqGjcRCD0kSZPml4BDjqL/MPg69 u6JT7jVg4hsloyyTVZ85uyvIsmPFJOI= X-MC-Unique: LzVi-ouQM3-aSax4819efg-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=Brj1G/fUhqiziIlPAK7440LnFkqvsAAYMyPJBvFCKgI=; b=Q6ulP/y3wad1DN8xn1iNyFUgOgTIo2hk/q6FduqQ9zzg2mPcxwBMZFBa1gV10I/m4V gKevwBPz8zEY31GN8hhVsY8xah8HAGIfyAj13rsFyxMK/6C9Gv8SoENqs9k4HywRivWu 0rHfbe/r8NaZzGSX30gAzR5mpBjvwy8dtXCqmqbk1wi6vY6+jgQuSkAaoP2vTRekSc7g N4eZ8MDiLWQCZdIQHqJ6tWfjrQ1OxwS6HtATH5Qc7hZzsA+4H0XydWf7N4KcBaTk/rn4 rMdqQzuw8eBWvpL6r2CtfUXO82WaBH1CGHSxjJyxJsLU1fVlU7P2hJw1j00RIr+Y3RZc Lw8Q== X-Gm-Message-State: AOAM5313ivmrYTT+8KHwQVJhMAc9G8rAiR1Fuz9gcWk8hZGEGyilxVu5 3oMm74mUlisES6ny1mP/c1wwUe8gMOn87XcOp8rnJBKrTqRuZkGthFYYnkLPeLIvllwuwzAVhFo aYQW7RMTnxC1GoQ== X-Received: by 2002:a1c:e909:: with SMTP id q9mr29066562wmc.184.1640954923960; Fri, 31 Dec 2021 04:48:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy90nhSNQRqRCtDsglq5R4j8vlK7YYBdk+5cfY1o18jPVz+ZSFniMUeYEu5f0EA3d07dHlgYw== X-Received: by 2002:a1c:e909:: with SMTP id q9mr29066551wmc.184.1640954923785; Fri, 31 Dec 2021 04:48:43 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yanan Wang , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Jones , Richard Henderson Subject: [PULL 11/20] tests/unit/test-smp-parse: Constify some pointer/struct Date: Fri, 31 Dec 2021 13:47:45 +0100 Message-Id: <20211231124754.1005747-12-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211231124754.1005747-1-philmd@redhat.com> References: <20211231124754.1005747-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: 1640954928320000001 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=C3=A9 Message-Id: <20211216132015.815493-8-philmd@redhat.com> --- 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 395929b66cf..0f98c9509ee 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[] =3D { +static const struct SMPTestData data_generic_valid[] =3D { { /* config: no configuration provided * expect: cpus=3D1,sockets=3D1,cores=3D1,threads=3D1,maxcpus=3D1 = */ @@ -285,7 +285,7 @@ static struct SMPTestData data_generic_valid[] =3D { }, }; =20 -static struct SMPTestData data_generic_invalid[] =3D { +static const struct SMPTestData data_generic_invalid[] =3D { { /* config: -smp 2,dies=3D2 */ .config =3D 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[] =3D { }, }; =20 -static struct SMPTestData data_with_dies_invalid[] =3D { +static const struct SMPTestData data_with_dies_invalid[] =3D { { /* config: -smp 16,sockets=3D2,dies=3D2,cores=3D4,threads=3D2,maxc= pus=3D16 */ .config =3D 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 *con= fig) config->has_maxcpus ? "true" : "false", config->maxcpus); } =20 -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) } =20 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 =3D smp_config_to_string(config); @@ -466,7 +466,7 @@ static void smp_parse_test(MachineState *ms, SMPTestDat= a *data, bool is_valid) } =20 /* 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 *d= ata) { if (!mc->smp_props.dies_supported) { data->expect_prefer_sockets.dies =3D 1; --=20 2.33.1