* [LTP] [PATCH] pm_include.sh: Fix no_of_sockets calculation error of is_multi_socket() function.
@ 2022-08-27 1:55 huangjuniter
2022-08-29 19:49 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: huangjuniter @ 2022-08-27 1:55 UTC (permalink / raw)
To: ltp; +Cc: Jun Huang
From: 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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] pm_include.sh: Fix no_of_sockets calculation error of is_multi_socket() function.
2022-08-27 1:55 [LTP] [PATCH] pm_include.sh: Fix no_of_sockets calculation error of is_multi_socket() function huangjuniter
@ 2022-08-29 19:49 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2022-08-29 19:49 UTC (permalink / raw)
To: huangjuniter; +Cc: ltp
Hi Jun,
nit: Commit message could be better: shorter subject (first line)
and more descriptive description after single blank line.
That would help me avoiding asking question bellow.
> From: Jun Huang <huangjuniter@foxmail.com>
nit: there should have been your Signed-off-by:
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 $?
> }
I was going to merge it, but is it really needed? Unsorted input to unique will
can lead to higher number of count, but because anything higher than 1 results
in echo 0 and 0 will result in 1 due this code:
[ $no_of_sockets -gt 1 ] ; echo $?
i.e. 2 or more different files will result in count higher than 1 regardless
using sorted uniq (sort -u) or just uniq. Or am I missing something?
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] pm_include.sh: Fix no_of_sockets calculation error of is_multi_socket() function.
@ 2022-08-31 2:54 dreamhj
0 siblings, 0 replies; 3+ messages in thread
From: dreamhj @ 2022-08-31 2:54 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
[-- Attachment #1.1: Type: text/plain, Size: 1238 bytes --]
> nit: Commit message could be better: shorter subject (first line)nit: Commit message could be better: shorter subject (first line)
> and more descriptive description after single blank line.
> That would help me avoiding asking question bellow.
>
> > From: Jun Huang <huangjuniter@foxmail.com>
>
> nit: there should have been your Signed-off-by:
>
> Signed-off-by: Jun Huang <huangjuniter@foxmail.com>
Thanks for your suggestion!
> I was going to merge it, but is it really needed? Unsorted input to unique will
> can lead to higher number of count, but because anything higher than 1 results
> in echo 0 and 0 will result in 1 due this code:
>
> [ $no_of_sockets -gt 1 ] ; echo $?
>
> i.e. 2 or more different files will result in count higher than 1 regardless
> using sorted uniq (sort -u) or just uniq. Or am I missing something?
The main purpose of this patch is to change 'cpu?' to 'cpu*', otherwise an error
will occur when the number of cores exceeds 10.
As you said 'sort -u' has the same effect as 'uniq'. I suggest using 'sort -u'
to make the command result more in line with the naming of 'no_of_sockets'.
Thanks,
Jun.
[-- Attachment #1.2: Type: text/html, Size: 2066 bytes --]
[-- Attachment #2: Type: text/plain, Size: 60 bytes --]
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-31 2:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-27 1:55 [LTP] [PATCH] pm_include.sh: Fix no_of_sockets calculation error of is_multi_socket() function huangjuniter
2022-08-29 19:49 ` Petr Vorel
2022-08-31 2:54 dreamhj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).