From nobody Sat Sep 21 05:27:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705588706; cv=none; d=zohomail.com; s=zohoarc; b=eOTSc1T4dA5jkgS/v6P6lzg4ITSkPXNy1KkRg1fxRDKKz79UgPssHUsK0xtk/jXlJc3XPhhOfgYft+KppqFjFJ3ONBYQKDvk9CV3/tqdBq5xoKdB5v+6miad+s5JjxoYK+ZLhuoNxALMvLczPluif6O2fjdJXV9zhuUyK6Wrjlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705588706; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tCcsoHMW5imCo/W4UmfEHMIeM2pt8xF/8uDVCRoGASI=; b=BcohqU2EJOxcAvaCvftWancXFroK/IQqkxnLunJE9nrztUqKfz1pG3KBVSHovuyCB/6nxx784/8HOzRr+10+MH5w7bCNqDQ2EpiuGCRI4hPvwfMNtXHdMolbBOCE8lEga5bGtxPjq6VbiS5YxNXULFJ59KOi7LN7Lvf3c8znn40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705588706166152.32426215890223; Thu, 18 Jan 2024 06:38:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQTWx-0004zV-4j; Thu, 18 Jan 2024 09:38:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWf-0004ux-1T for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:50 -0500 Received: from mgamail.intel.com ([198.175.65.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQTWZ-0004T0-AI for qemu-devel@nongnu.org; Thu, 18 Jan 2024 09:37:47 -0500 Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2024 06:36:10 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa005.jf.intel.com with ESMTP; 18 Jan 2024 06:36:08 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705588663; x=1737124663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=scLXbUoC+ZDyb0yjC19HMwOlFwwAZ+GFvAD3rT1YF14=; b=Od+vLzl2UKCeNtHv4Ai+hw6Hs5ztnDPS2anO0u6ckNtpfbP6nERpPaZt bqUo1g/0eko/ZNZvhIgnishR5FfONfLxqGQiwiyWlaTrz8Lm12ZCy8WHJ xRCyMXleyHoqPboAeMH2oqhK/LT+8+Sd+9NDXjOpOgK5iuPVAEpzAPyVt uieiTroAUjJOgpnyGGlzW27k/nnP3DbgegZS0ikVLHgJwnClWU1B3FHzZ eydDfOYhr0Le8IIM32ZbNuoBQkzQcWZis/dgfLTeQwCqb5y2BiOkkgqUO bcpK+4uHFFX5iJBMf6PaCuk1Det/k5wesY2PeDl2VWDjjFGG2m33vf5m7 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="19057059" X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="19057059" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="329252" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Cc: qemu-devel@nongnu.org, Xiaoling Song , Zhao Liu Subject: [PATCH 1/8] tests/unit/test-smp-parse.c: Use CPU number macros in invalid topology case Date: Thu, 18 Jan 2024 22:48:50 +0800 Message-Id: <20240118144857.2124034-2-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> References: <20240118144857.2124034-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=198.175.65.9; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.806, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705588708300100003 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Use MAX_CPUS/MIN_CPUS micros in invalid topology case. This gives us the flexibility to change the maximum and minimum CPU limits. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth --- tests/unit/test-smp-parse.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index 24972666a74d..20c663a006b3 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -323,15 +323,21 @@ static const struct SMPTestData data_generic_invalid[= ] =3D { "sockets (2) * cores (4) * threads (2) " "=3D=3D maxcpus (16) < smp_cpus (18)", }, { - /* config: -smp 1 - * 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), + /* + * config: -smp 1 + * The test machine should tweak the supported min CPUs to + * 2 (MIN_CPUS + 1) for testing. + */ + .config =3D SMP_CONFIG_GENERIC(T, MIN_CPUS, F, 0, F, 0, F, 0, F, 0= ), .expect_error =3D "Invalid SMP CPUs 1. The min CPUs supported " "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), + /* + * config: -smp 512 + * The test machine should tweak the supported max CPUs to + * 511 (MAX_CPUS - 1) for testing. + */ + .config =3D SMP_CONFIG_GENERIC(T, MAX_CPUS, F, 0, F, 0, F, 0, F, 0= ), .expect_error =3D "Invalid SMP CPUs 512. The max CPUs supported " "by machine '" SMP_MACHINE_NAME "' is 511", }, @@ -575,8 +581,8 @@ static void machine_generic_invalid_class_init(ObjectCl= ass *oc, void *data) MachineClass *mc =3D MACHINE_CLASS(oc); =20 /* Force invalid min CPUs and max CPUs */ - mc->min_cpus =3D 2; - mc->max_cpus =3D 511; + mc->min_cpus =3D MIN_CPUS + 1; + mc->max_cpus =3D MAX_CPUS - 1; } =20 static void machine_with_dies_class_init(ObjectClass *oc, void *data) --=20 2.34.1