From: Luis R. Rodriguez Date: Sun, 21 Jan 2018 07:24:00 +0000 (-0800) Subject: check: move expunge test into a helper X-Git-Tag: v2022.05.01~1691 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=cdd360da7b279f5fe19b71a0ee2173da2f5fcf44 check: move expunge test into a helper Move the expunge test into a helper. [eguan: make TEST_ID local and use grep -q not io redirection] Signed-off-by: Luis R. Rodriguez Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/check b/check index 6078b1ef..84752dae 100755 --- a/check +++ b/check @@ -487,6 +487,18 @@ _check_filesystems() fi } +_expunge_test() +{ + local TEST_ID="$1" + if [ -s $tmp.xlist ]; then + if grep -q $TEST_ID $tmp.xlist; then + echo " [expunged]" + return 1 + fi + fi + return 0 +} + _prepare_test_list if $OPTIONS_HAVE_SECTIONS; then @@ -674,11 +686,9 @@ for section in $HOST_OPTIONS_SECTIONS; do rm -f $seqres.out.bad # check if we really should run it - if [ -s $tmp.xlist ]; then - if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then - echo " [expunged]" - continue - fi + _expunge_test $seqnum + if [ $? -eq 1 ]; then + continue fi # slashes now in names, sed barfs on them so use grep