From cdd360da7b279f5fe19b71a0ee2173da2f5fcf44 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Sat, 20 Jan 2018 23:24:00 -0800 Subject: [PATCH] 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 --- check | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 -- 2.47.3