[LTP] [PATCH] pm_include.sh: Fix calculation error of no_of_sockets

huangjuniter@foxmail.com huangjuniter@foxmail.com
Thu Sep 1 11:03:21 CEST 2022


From: Jun Huang <huangjuniter@foxmail.com>

An error will occur when there are multiple sockets and each socket has 
more than 10 cores, resulting in the value of no_of_sockets being 1.

Signed-off-by: Jun Huang <huangjuniter@foxmail.com>
---
 testcases/kernel/power_management/pm_include.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/power_management/pm_include.sh b/testcases/kernel/power_management/pm_include.sh
index 35ff0f1e6..f3e160445 100755
--- a/testcases/kernel/power_management/pm_include.sh
+++ b/testcases/kernel/power_management/pm_include.sh
@@ -124,8 +124,8 @@ check_input() {
 
 is_multi_socket() {
 	no_of_sockets=`cat \
-		/sys/devices/system/cpu/cpu?/topology/physical_package_id \
-		| uniq | wc -l`
+		/sys/devices/system/cpu/cpu*/topology/physical_package_id \
+		| sort -u | wc -l`
 	[ $no_of_sockets -gt 1 ] ; echo $?
 }
 
-- 
2.37.2.windows.2



More information about the ltp mailing list