test: Shellcheck - correct rule "using pgrep"

Correct shellcheck rule SC2009: Consider using
pgrep instead of grepping ps output.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: If00080ffb62a589c21b684e2f8f2945c77b38bdd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466911
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Maciej Wawryk 2019-08-30 13:12:56 +02:00 committed by Jim Harris
parent 93ae0344c8
commit bebda9fb40
2 changed files with 2 additions and 2 deletions

View File

@ -241,7 +241,7 @@ if hash shellcheck 2>/dev/null; then
# Error descriptions can also be found at: https://github.com/koalaman/shellcheck/wiki
SHCK_EXCLUDE="SC1001,SC1003,SC1004,SC1010,\
SC1083,SC1090,SC1091,SC1113,SC2001,SC2002,SC2003,SC2004,SC2005,\
SC2009,SC2010,SC2012,SC2013,SC2015,SC2016,SC2018,SC2019,SC2022,\
SC2010,SC2012,SC2013,SC2015,SC2016,SC2018,SC2019,SC2022,\
SC2027,SC2030,SC2031,SC2034,SC2035,SC2039,SC2043,SC2044,SC2045,SC2046,\
SC2059,SC2068,SC2074,SC2086,SC2088,SC2089,SC2090,SC2091,SC2094,\
SC2097,SC2098,SC2103,SC2115,SC2116,SC2119,SC2120,SC2121,SC2124,SC2126,SC2128,\

View File

@ -312,7 +312,7 @@ if [[ -n "$kernel_cpus" ]]; then
echo "$kernel_mask" >> /sys/fs/cgroup/cpuset/spdk/cpuset.cpus
echo "0-1" >> /sys/fs/cgroup/cpuset/spdk/cpuset.mems
kernel_vhost_pids=$(ps aux | grep -Po "^root\s+\K(\d+)(?=.*\[vhost-\d+\])")
kernel_vhost_pids=$(pgrep "vhost" -U root)
for kpid in $kernel_vhost_pids; do
echo "Limiting kernel vhost pid ${kpid}"
echo "${kpid}" >> /sys/fs/cgroup/cpuset/spdk/tasks