From nobody Thu Dec 18 23:21:43 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=1636625049; cv=none; d=zohomail.com; s=zohoarc; b=E3jYsVbjv7qhQSi2DNOqroiJYHZ2w+vwWytjwg6iRrPJoyQB70ppCxIpzr5X9hbWnY/EtULktyRTzUw0mB6pFvhyr5ot+m63gKxaBAipdkwVhjA0v8U3whJj22+JhdiS9osKzvatY4tdrOmiBp9sYXOqL7CNiwCEs1E9crZAQ2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636625049; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=6CWt9qvUfdPUYJvJPJwk4S85pT07giVjWWIGVSTBQMQ=; b=NmQH5IqhS4mG+SlZijBLrtQBmrrkCE0Z6yUPsQw3s6Hdlq/9/vff32GNzWkzFJYKhKnIN78KnCXDwce260upO0xuU0kmGoFqZSvF831V4te6iZ3qxeOxzPPoOOWR4bRu3zWQ7goypphiEfKJ/XMv7O78o0o9tR5a1+W+rqneyI4= 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 1636625049542775.5104010509889; Thu, 11 Nov 2021 02:04:09 -0800 (PST) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-Tf_K6xh7O9eaSLE6QHG-8g-1; Thu, 11 Nov 2021 05:04:07 -0500 Received: by mail-wr1-f71.google.com with SMTP id a2-20020a5d4d42000000b0017b3bcf41b9so916631wru.23 for ; Thu, 11 Nov 2021 02:04:07 -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 f7sm2727883wri.74.2021.11.11.02.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 02:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636625048; 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=6CWt9qvUfdPUYJvJPJwk4S85pT07giVjWWIGVSTBQMQ=; b=FKcvg7Csk4eYF57wzpxFXI2tD+aAvi1gmdvTvbcGebIfbfiNfRx9AYri84xJHkx9KuDU+3 qBYBE4a/+sEbe9VCXP2zDyMZkza3gTr171qcZSrUb5WF2yjOh1zLu94YTQwnati1pVxuxB +CQbuB8R4Ky+TFNNz0DQKvyTBTdI/ck= X-MC-Unique: Tf_K6xh7O9eaSLE6QHG-8g-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=6CWt9qvUfdPUYJvJPJwk4S85pT07giVjWWIGVSTBQMQ=; b=yow8YoMR/oEoLnhXfWueZdiQHHzYjde14sJVFgoIRfgNW96r1d9nE93uSqiBFOYVcc H2UA6nUZKT2VETdn3P5o2vwIvubW9lZN2yEhDFOkkqjv7zFA6ot+CHT4b0Hrkyn9wQLU RGFFNajnsw369e5Wnlsva28z5qjvNG3TXgAbm3bH1zEP6mRjxtagmU+jz5RT0NUWGXAw hWBy0rDfWNBqRfuBioSUKB4ROtHOh5d4ztg/28NvUW0TcGcGFoJOkG4SBRUMAkG91Koy vBoVww6PkTlIHghz89nHojENpf9U9fE51JHkR/6cwsLUhGKfCda2uor3yP9KCBWOdamO JVnA== X-Gm-Message-State: AOAM530d5Up2X6eAaEc5BhBmWZPlWenlqS+dCc0jxPBqB/sVc3QYXmkh tLT1rsbewQeGjzcKRR3BIB1suuWOR3mRJfWuMTTdNXpIylIdxq2vr73j1nVgsBCmdWruBAawndv HqLceUz/+JHZNYQ== X-Received: by 2002:adf:fb09:: with SMTP id c9mr6997171wrr.223.1636625046251; Thu, 11 Nov 2021 02:04:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjkKP3jlm7WgcixPtOzz5Nu78jHIxpkFcloO0+roEU6MxpDlS9/SXchhwk0sqcXEOXQ2yMJw== X-Received: by 2002:adf:fb09:: with SMTP id c9mr6997147wrr.223.1636625046094; Thu, 11 Nov 2021 02:04:06 -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 3/6] tests/unit/test-smp-parse: Explicit MachineClass name Date: Thu, 11 Nov 2021 11:03:48 +0100 Message-Id: <20211111100351.2153662-4-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: 1636625050362100001 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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reported-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Reviewed-by: Yanan Wang Suggested-by: Yanan Wang Tested-by: Yanan Wang --- 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 51670297bf9..de6d226b455 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 */ =20 +#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[] =3D { * should tweak the supported min CPUs to 2 for testing */ .config =3D SMP_CONFIG_GENERIC(T, 1, F, 0, F, 0, F, 0, F, 0), .expect_error =3D "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 =3D SMP_CONFIG_GENERIC(T, 512, F, 0, F, 0, F, 0, F, 0), .expect_error =3D "Invalid SMP CPUs 512. The max CPUs supported " - "by machine '(null)' is 511", + "by machine '" SMP_MACHINE_NAME "' is 511", }, }; =20 @@ -481,6 +483,8 @@ static void machine_class_init(ObjectClass *oc, void *d= ata) =20 mc->smp_props.prefer_sockets =3D true; mc->smp_props.dies_supported =3D false; + + mc->name =3D g_strdup(SMP_MACHINE_NAME); } =20 static void test_generic(void) --=20 2.31.1