From: James Nunez Date: Fri, 2 Aug 2019 19:49:59 +0000 (-0600) Subject: LU-11673 tests: quote argument of -n and test fix X-Git-Tag: 2.12.57~22 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7e0cba246a7f2408c8266574a657e4459f691570 LU-11673 tests: quote argument of -n and test fix Inside the single bracket test function '[', the ā€˜-nā€™ flag problems arise with unquoted arguments. The -n argument should be quoted or use double brackets for the test. Quote the ā€˜-nā€™ argument in test-framework.sh functions. This simple correction caused a few tests to fail. Fix sanity test 65k to use the correct facets and check for the mgs facet in convert_facet2label() to fix replay-single test 58b. Signed-off-by: James Nunez Change-Id: I9655d2138c56c007207434f04b487b518bb3392e Reviewed-on: https://review.whamcloud.com/35080 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 7cb2c85..a8ecfae 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7328,7 +7328,7 @@ cleanup_65k() { do_facet $SINGLEMDS lctl --device %$INACTIVE_OSC activate echo $INACTIVE_OSC "is Activate" - wait_osc_import_state mds ost$ostnum FULL + wait_osc_import_state mds ost$(( ostnum + 1 )) FULL } test_65k() { # bug11679 @@ -7388,7 +7388,7 @@ test_65k() { # bug11679 do_facet $SINGLEMDS lctl --device %$INACTIVE_OSC activate echo $INACTIVE_OSC "is Activate" - wait_osc_import_state mds ost$ostnum FULL + wait_osc_import_state mds ost$(( ostnum + 1 )) FULL done } run_test 65k "validate manual striping works properly with deactivated OSCs" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 44eec2c..bcb0c8e 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -2289,30 +2289,31 @@ zconf_mount() { } zconf_umount() { - local client=$1 - local mnt=$2 - local force - local busy - local need_kill - - [ "$3" ] && force=-f - local running=$(do_node $client "grep -c $mnt' ' /proc/mounts") || true - if [ $running -ne 0 ]; then - echo "Stopping client $client $mnt (opts:$force)" - do_node $client lsof -t $mnt || need_kill=no - if [ "x$force" != "x" -a "x$need_kill" != "xno" ]; then - pids=$(do_node $client lsof -t $mnt | sort -u); - if [ -n $pids ]; then - do_node $client kill -9 $pids || true - fi - fi + local client=$1 + local mnt=$2 + local force + local busy + local need_kill + local running=$(do_node $client "grep -c $mnt' ' /proc/mounts") || true + + [ "$3" ] && force=-f + [ $running -eq 0 ] && return 0 + + echo "Stopping client $client $mnt (opts:$force)" + do_node $client lsof -t $mnt || need_kill=no + if [ "x$force" != "x" ] && [ "x$need_kill" != "xno" ]; then + pids=$(do_node $client lsof -t $mnt | sort -u); + if [ -n "$pids" ]; then + do_node $client kill -9 $pids || true + fi + fi - busy=$(do_node $client "umount $force $mnt 2>&1" | grep -c "busy") || true - if [ $busy -ne 0 ] ; then - echo "$mnt is still busy, wait one second" && sleep 1 - do_node $client umount $force $mnt - fi - fi + busy=$(do_node $client "umount $force $mnt 2>&1" | grep -c "busy") || + true + if [ $busy -ne 0 ] ; then + echo "$mnt is still busy, wait one second" && sleep 1 + do_node $client umount $force $mnt + fi } # Mount the file system on the MGS @@ -5153,7 +5154,7 @@ init_param_vars () { TIMEOUT=$(lctl get_param -n timeout) TIMEOUT=${TIMEOUT:-20} - if [ -n $arg1 ]; then + if [ -n "$arg1" ]; then [ "$arg1" = "server_only" ] && return fi @@ -7157,19 +7158,21 @@ delayed_recovery_enabled () { ######################## convert_facet2label() { - local facet=$1 + local facet=$1 - if [ x$facet = xost ]; then - facet=ost1 - fi + if [ x$facet = xost ]; then + facet=ost1 + elif [ x$facet = xmgs ] && combined_mgs_mds ; then + facet=mds1 + fi - local varsvc=${facet}_svc + local varsvc=${facet}_svc - if [ -n ${!varsvc} ]; then - echo ${!varsvc} - else - error "No lablel for $facet!" - fi + if [ -n ${!varsvc} ]; then + echo ${!varsvc} + else + error "No label for $facet!" + fi } get_clientosc_proc_path() {