check: factor out get_sub_group_list() helper
authorAmir Goldstein <amir73il@gmail.com>
Mon, 2 Jan 2017 13:22:58 +0000 (15:22 +0200)
committerEryu Guan <eguan@redhat.com>
Wed, 4 Jan 2017 07:42:07 +0000 (15:42 +0800)
This helper gets a list of tests that belong to a group
under a specific tests subdir.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
check

diff --git a/check b/check
index cf6379bb4e7d94e685dfdaeb7cead7e0b50fa1e7..faf6281cbd496e4d29e6b2f59adeacc9ce3bb2a4 100755 (executable)
--- a/check
+++ b/check
@@ -87,19 +87,30 @@ testlist options
            exit 0
 }
 
            exit 0
 }
 
+get_sub_group_list()
+{
+       local d=$1
+       local grp=$2
+
+       test -s "$SRC_DIR/$d/group" || return 1
+
+       local grpl=$(sed -n < $SRC_DIR/$d/group \
+               -e 's/#.*//' \
+               -e 's/$/ /' \
+               -e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
+       echo $grpl
+}
+
 get_group_list()
 {
 get_group_list()
 {
-       grp=$1
+       local grp=$1
+       local grpl=""
 
        for d in $SRC_GROUPS $FSTYP; do
                if ! test -d "$SRC_DIR/$d" ; then
                        continue
                fi
 
        for d in $SRC_GROUPS $FSTYP; do
                if ! test -d "$SRC_DIR/$d" ; then
                        continue
                fi
-               l=$(sed -n < $SRC_DIR/$d/group \
-                       -e 's/#.*//' \
-                       -e 's/$/ /' \
-                       -e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
-               grpl="$grpl $l"
+               grpl="$grpl $(get_sub_group_list $d $grp)"
        done
        echo $grpl
 }
        done
        echo $grpl
 }