From: Loic Dachary Date: Sat, 30 May 2015 14:36:45 +0000 (+0200) Subject: tests: ceph-helpers.sh reduce kill_daemon verbosity X-Git-Tag: v9.0.3~75^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aefcf6d3859f0ebfac3390b8329be09a0d52b625;p=ceph.git tests: ceph-helpers.sh reduce kill_daemon verbosity When a test fails, the script returns immediately and kill_daemon function is called to cleanup. It is quite verbose and requires scrolling hundreds of lines back to find the actual error message. Turn off the shell trace to reduce the verbosity and improve error output readability. The kill_daemon cannot just turn off set -x because it may be called by a test, not just at the end of the run. Instead the kill_daemon function checks if tracing is activated and temporarily disables it. Also get rid of the find standard error that commonly happens when kill_daemon is called to verify there are no leftovers and the test directory does not exist. Signed-off-by: Loic Dachary --- diff --git a/qa/workunits/ceph-helpers.sh b/qa/workunits/ceph-helpers.sh index 4dcef3399c25..325754ad2077 100755 --- a/qa/workunits/ceph-helpers.sh +++ b/qa/workunits/ceph-helpers.sh @@ -189,13 +189,15 @@ function test_teardown() { # @return 0 on success, 1 on error # function kill_daemons() { + local trace=$(shopt -q -o xtrace && echo true || echo false) + $trace && shopt -u -o xtrace local dir=$1 local signal=${2:-KILL} local name_prefix=$3 # optional, osd, mon, osd.1 local delays=${4:-0 0 1 1 1 2 3 5 5 5 10 10 20 60} local status=0 - for pidfile in $(find $dir | grep $name_prefix'[^/]*\.pid') ; do + for pidfile in $(find $dir 2>/dev/null | grep $name_prefix'[^/]*\.pid') ; do pid=$(cat $pidfile) local send_signal=$signal local kill_complete=false @@ -213,6 +215,7 @@ function kill_daemons() { status=1 fi done + $trace && shopt -s -o xtrace return $status }