autotest/common: silence hash output

We've got a bunch of `if hash` checks that generate
unnecessary output, e.g.:

$ if ! hash ceph; then [...]
/var/jenkins/workspace/Other_systems/centos7_autotest/
spdk/test/common/autotest_common.sh: line 28: hash: ceph: not found

We now silence that output in cases where we do expect
the binary to be unavailable and handle that case, but
we hold off in cases where `if hash` is just a sanity
check (e.g. `hash sgdisk` in part_dev_by_gpt() which
can make the entire function return immediately and do
nothing).

Change-Id: I7cbfada858aa86d57cbe182ea7f9b222debc8b88
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453207
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Darek Stojaczyk 2019-05-06 09:05:31 +02:00
parent fabd7fbb41
commit 005e18a881

View File

@ -25,11 +25,11 @@ if [[ ! -z $1 ]]; then
fi
# If certain utilities are not installed, preemptively disable the tests
if ! hash ceph; then
if ! hash ceph &>/dev/null; then
SPDK_TEST_RBD=0
fi
if ! hash pmempool; then
if ! hash pmempool &>/dev/null; then
SPDK_TEST_PMDK=0
fi
@ -281,7 +281,7 @@ function process_core() {
fi
echo "exe for $core is $exe"
if [[ ! -z "$exe" ]]; then
if hash gdb; then
if hash gdb &>/dev/null; then
gdb -batch -ex "thread apply all bt full" $exe $core
fi
cp $exe $output_dir
@ -325,13 +325,13 @@ function waitforlisten() {
local rpc_addr="${2:-$DEFAULT_RPC_ADDR}"
if hash ip; then
if hash ip &>/dev/null; then
local have_ip_cmd=true
else
local have_ip_cmd=false
fi
if hash ss; then
if hash ss &>/dev/null; then
local have_ss_cmd=true
else
local have_ss_cmd=false