ltp
ltp copied to clipboard
cpuhotplug06.sh: use '-h' to identify top or htop
'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.
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.
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
Pushed, thanks.