ltp icon indicating copy to clipboard operation
ltp copied to clipboard

cpuhotplug06.sh: use '-h' to identify top or htop

Open liangxiao1 opened this issue 1 year ago • 2 comments

'v' is invalid option for both top and htop in newer version. Replace it with 'h' to make it work in earlier and current version.

liangxiao1 avatar Aug 27 '24 03:08 liangxiao1

What happens in the case that -v is a valid top option? Is the test stuck in the "top -v |grep htop"?

In other words the commit description does not explain clearly enough why this is needed.

metan-ucw avatar Sep 16 '24 15:09 metan-ucw

What happens in the case that -v is a valid top option? Is the test stuck in the "top -v |grep htop"?

The test can complete. When '-v' is invalid, "top -v" redirects its output to stderr, so "top -v|grep htop" always return 1 and cannot identify top or htop as expected.

In other words the commit description does not explain clearly enough why this is needed.

Hope below example can explain why this is needed. Thanks

$ top -v |grep top
top: invalid option -- 'v'
$ echo $?
1
$ top -h|grep top
 top [options]
For more details see top(1).
$ echo $?
0

liangxiao1 avatar Sep 19 '24 13:09 liangxiao1

Pushed, thanks.

metan-ucw avatar May 15 '25 12:05 metan-ucw