From 005e18a881bb8e75bf1c069ee9bb86d47a94689c Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Mon, 6 May 2019 09:05:31 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453207 Tested-by: SPDK CI Jenkins Reviewed-by: Seth Howell Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- test/common/autotest_common.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 63ec56984f..da7f0ffce1 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -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