From nobody Mon Feb 9 19:29:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636988358; cv=none; d=zohomail.com; s=zohoarc; b=B9C+3NbD7u38tUfDiz7CcCTSfCljSn6Ioebe8U3lm5kWeYnzVl3wrYqMNOYCTtCs3GGyuqr3e5uCb0gPtboMh6tN0JfnIio10/IbeGZLTiH8/TASorxsdS0zsCVSRKaS134B98cqGgJ78/CHqaCW2RJ+IJueIcxXkGH8HxYrl/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636988358; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=4KAeBrUilj/ve6Ofp+Ew6cDhrRd6+8AxOgCMLHgLOxQ=; b=hDKHyGLEV5Zfw5t7yhs8o5G5WeiZ3DE2um/NEXvWvDPhISwfWinD9ZnPPv5SXGGaoxkp2mcpoEabezQuvNmIj6PDeHWIFyrRw+F9fVt6hPwcM9rI5xfvcYqr6zC/k8Rgyuxx4ssFVwqsXOcfLi6SMYatkiqMi0PBhOLF8H8lPTE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636988358584787.3929652692188; Mon, 15 Nov 2021 06:59:18 -0800 (PST) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-542-udW3y36UMBWMX8X8hHg8QA-1; Mon, 15 Nov 2021 09:59:16 -0500 Received: by mail-wm1-f71.google.com with SMTP id j25-20020a05600c1c1900b00332372c252dso23199wms.1 for ; Mon, 15 Nov 2021 06:59:16 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id 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) 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= X-MC-Unique: udW3y36UMBWMX8X8hHg8QA-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=4KAeBrUilj/ve6Ofp+Ew6cDhrRd6+8AxOgCMLHgLOxQ=; b=KVUUpF5WYlRWRk3HegI/hKBkNyFABrqRq6UMKKSRI6/DC5+m7owRVZwcgiVgS+f5GB pmUyEX/pufmWsqfDHiSZuCzlpww9Ewkp70SC3lPCnadCk/rfpz8z8yGc2FW2a0sqoXxC n7rOn9ulcPVQp4DJx3NAgVSBpsITZgpk3Osttr1N3uERXMju0aqi0nP5UmPh6QtsCxOK 2eP8NBtLx1JMk4pzzxLmDt2fJbPr5JsdM2hi1KCh/EH3sOX+I2aeQBK2v/FYh7ndFc5p iG+NvVucaXx0KEyJh6x+kvBx1RwGvxKa4HuO/7OZPj6Rykc/rxzJpxuHccgbFhot7lOF nCAQ== X-Gm-Message-State: AOAM532KMGywlh5U5Ou2TkRf41nU/2P4BZirv5lcg4V4zohUwXMGpyFw glsxaHTXusBdTYU5CqpyYlO/5tjRGna6nP2lbddJ48Hgtpu8cPw8cIl/Z2YDcjML66m0Vsk2z0q IydnQGQizTtlqJw== X-Received: by 2002:a5d:6e8c:: with SMTP id k12mr47514685wrz.401.1636988355053; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Andrew Jones , Eduardo Habkost , Thomas Huth , Marcel Apfelbaum , Richard Henderson 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1636988359193100001 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=C3=A9 --- 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 */ =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_base_class_init(ObjectClass *oc, vo= id *data) =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