From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5124942BFE; Thu, 1 Jun 2023 08:01:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E9DF406B3; Thu, 1 Jun 2023 08:01:24 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 88894406A2 for ; Thu, 1 Jun 2023 08:01:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685599282; x=1717135282; h=from:to:cc:subject:date:message-id; bh=tIAZW7SPypTDYi9f8ZWyWR8myJqedDELf/wk5WLhOW0=; b=ZqcQGaZh9FXIDSXNEi+4JZ8X3YGv5W2l5Z2ismlTj5gubRL/AE26Hshm qliqXARuAnALnhWW3TJCIQzPnEx04ZH0tDz/ns5+6GIwz5cxj5EjYYxa5 6E2kE9EA1zfeiVhjN3K7RGQwfViOJZ7+AXE4nqw63oHHcac8PIz3vmUhy MKsdmLdaU9Kf4rrnOMLZQzIhcmGOU3C2Ygj95NRRWdh1nQk2kwEo2cWAM mvam+C+SjFXdV7BKLNxNyPJIIzAzoDZlXYdkrDnCFLUe6+RMTzSYKyuqi Dz2SOSehxmKkCjbGAt8wqD+EZDFVLj7t4WSqtpSVumbMyApFJAAF/dmDP g==; X-IronPort-AV: E=McAfee;i="6600,9927,10727"; a="441821372" X-IronPort-AV: E=Sophos;i="6.00,209,1681196400"; d="scan'208";a="441821372" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2023 23:01:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10727"; a="831457327" X-IronPort-AV: E=Sophos;i="6.00,209,1681196400"; d="scan'208";a="831457327" Received: from unknown (HELO localhost.localdomain) ([10.239.252.161]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2023 23:01:20 -0700 From: Daxue Gao To: dts@dpdk.org Cc: Daxue Gao Subject: [PATCH v1] framework: fix getting single cpu information on freebsd Date: Thu, 1 Jun 2023 14:01:25 +0800 Message-Id: <20230601060125.13278-1-daxuex.gao@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Fix to get cpu information on freebsd, when the machine has only one cpu, It cannot match the number of cpus,cores,threads. Such as: 0, 1, 2, 3, 4, 5, 6, 7 Signed-off-by: Daxue Gao --- framework/crb.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/framework/crb.py b/framework/crb.py index 4ffee558..9e3b0a58 100644 --- a/framework/crb.py +++ b/framework/crb.py @@ -721,9 +721,21 @@ class Crb(object): socket_id = 0 sockets = cpu_xml.findall(".//group[@level='2']") + if not sockets: + sockets = cpu_xml.findall(".//group[@level='1']") for socket in sockets: core_id = 0 core_elements = socket.findall(".//children/group/cpu") + if not core_elements: + core_elements = socket.findall("./cpu") + for core in core_elements: + cores = [int(x) for x in core.text.split(",")] + for core in cores: + if self.crb["bypass core0"] and core == 0: + continue + self.cores.append( + {"socket": socket_id, "core": core, "thread": core} + ) for core in core_elements: threads = [int(x) for x in core.text.split(",")] for thread in threads: -- 2.17.1