From nobody Fri Dec 19 07:16:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1636625058; cv=none; d=zohomail.com; s=zohoarc; b=ISwEPqPDLiQdu3q5fWW4I/ipNFsTzARbeXkXU9XaThuD/39PoY/hmtIngul1hlMHeOTofNFoAmZbQ0hH8XtHrmzGVt0wA0Go9R5V67gt+lDL5RGUegaSzI8K4zdh5tsRkjTV29364LeGQa/3JuiHhsiDdHT7ZdIrDJAtT8Lg8PM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636625058; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=uPiGfJGGXXvWAef0vocDFa36Z1A0Gwvp66AOmpazW+Y=; b=Q2Gw/Y3/N+Ys5LZ4D253hkfzs3op5LHbjfRv5W3+PMW/OHxtlkDukBRFg3zgTVJ0ZzXXxX4w3FbamM+PszCONh792ABf5TRlJ7l/ZPmQgjRWCZnVnQBABcwrqQ+qvs96rZk6P02NtykoJff7ylzFlwNoTNhWhebtZwIB1aJpxr0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1636625058227666.0301453015447; Thu, 11 Nov 2021 02:04:18 -0800 (PST) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-553-HIJ7v-ztOQq_9rmD4YWAWA-1; Thu, 11 Nov 2021 05:04:16 -0500 Received: by mail-wm1-f69.google.com with SMTP id 144-20020a1c0496000000b003305ac0e03aso4531224wme.8 for ; Thu, 11 Nov 2021 02:04:16 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id w7sm2443499wru.51.2021.11.11.02.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 02:04:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636625057; 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=uPiGfJGGXXvWAef0vocDFa36Z1A0Gwvp66AOmpazW+Y=; b=OTSugkrRsRW1haE/JLx25Vjv8vv4i5Kvt3T9xSVMYaH0yOTN1JdZMybAtX/ElPYiD8fKtz USG5NKU9btIoWRVB2K/gb3XUziSWUEUL2Vlgss+Ebnzgrqmpu5ygzejfQFnWMFA3MjPwHo +nMxkzcKJX4Elo6qSKeIFWdMjoV+msY= X-MC-Unique: HIJ7v-ztOQq_9rmD4YWAWA-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=uPiGfJGGXXvWAef0vocDFa36Z1A0Gwvp66AOmpazW+Y=; b=G5ioX8dchLoshW1/gkac79t+o7Eoh1/ZaxicMebdNOBiRceHnIM9xgFY4JosLtLoND /pAbps54V/49YNI+m6iLB4iGPEuO35mLz2QKsOFTzhWEXKA3hBn+4kqjSvrU3YFDDeZc Bfco+zxRli35dBm9Luw136/8LgL4HOsbreu1dqxj/KnJj/U3g2aZ8Evid+FQRKRQMYrw rFjYw+O8EETtUBzL9IFmWlo65sdgpuaqX28zomZ7dEPnfwJC5MQJX+y+Eiyko9GgSBXU GPIUiJg4zvEWnB4YBlI4xiMCdJcaNW6LwDAqjHjWasE8pF8Oq88EYDL/czeITKr6L9xK OBkA== X-Gm-Message-State: AOAM533j87OEkj3qdJvha9AvSAljlJNdyzTxpZOvl0jQXvhyrLGNGAn/ ICsGZC3fB2jdMX7DIPXXVpLGxdzJUjd7su9qHr6G3dDFQR9uI0F1stA4Bj1MR0MG9+wTOi0XLVE 9GFKklt/07ALxNQ== X-Received: by 2002:a05:600c:1989:: with SMTP id t9mr6811429wmq.24.1636625055047; Thu, 11 Nov 2021 02:04:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyADShtS3puNw/QayYYDzOefeQ0Y0ewm1eIhnV+IQ9y87D9vlUQiyb9kcY57J9wVeGgw74TgQ== X-Received: by 2002:a05:600c:1989:: with SMTP id t9mr6811405wmq.24.1636625054889; Thu, 11 Nov 2021 02:04:14 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Yanan Wang , Marcel Apfelbaum , Eduardo Habkost , Andrew Jones Subject: [PATCH-for-6.2 v3 5/6] tests/unit/test-smp-parse: Constify some pointer/struct Date: Thu, 11 Nov 2021 11:03:50 +0100 Message-Id: <20211111100351.2153662-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111100351.2153662-1-philmd@redhat.com> References: <20211111100351.2153662-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: 1636625059329100001 Declare structures const when we don't need to modify them at runtime. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Tested-by: Yanan Wang --- tests/unit/test-smp-parse.c | 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 83a5b8ffdcf..11109752799 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.31.1