summaryrefslogtreecommitdiffstats
path: root/run-tests.sh
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2016-02-02 18:14:24 +0530
committerRaghavendra Talur <rtalur@redhat.com>2016-02-08 00:27:56 -0800
commit152832a34b1a03448356298e08d7de36f3a9e992 (patch)
treeac71bc83c529c7366118de2cdc4f7e38d03bab76 /run-tests.sh
parent8ad742de98da284539b8ae772e0990294412da01 (diff)
tests: Make match function simpler
We don't use the dir matching code in run_all. It is used in run_tests but it is not generic enough and needs work to be fixed. Rather, making the match function simpler and work for only files is easier. This will help with refactoring of run_all and run_tests. Change-Id: Ifcd1217480738316736184a51813052ac6a1124e BUG: 1251592 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/13334 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'run-tests.sh')
-rwxr-xr-xrun-tests.sh39
1 files changed, 13 insertions, 26 deletions
diff --git a/run-tests.sh b/run-tests.sh
index 042b3fa0e4b..d3c128a952c 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -118,12 +118,11 @@ function check_user()
fi
}
-function run_tests()
+function match()
{
- declare -A DONE
- match()
- {
# Patterns considered valid:
+ # 0. Empty means everything
+ # "" matches ** i.e all
# 1. full or partial file/directory names
# basic matches tests/basic
# basic/afr matches tests/basic/afr
@@ -136,37 +135,25 @@ function run_tests()
# 1015990 matches /bugs/bug-1015990-rep.t, bug-1015990.t
# ...lots of other cases accepted as well, since globbing is tricky.
local t=$1
- local mt=$1
shift
local a
local match=1
- if [ -d $t ] ; then
- # Allow matching on globs like 'basic/*/'
- mt=$t/
+ if [ -z "$@" ]; then
+ match=0
+ return $match
fi
- for a in "$@" ; do
- case "$mt" in
- *$a|*/bugs/$a/|*/bugs/$a.t|*/bugs/bug-$a.t|*/bugs/bug-$a-*.t)
+ for a in $@ ; do
+ case "$t" in
+ *$a*)
match=0
;;
esac
done
- if [ "${DONE[$(dirname $t)]}" != "" ] ; then
- # Parentdir is already matched
- match=1
- if [ -d $t ] ; then
- # Ignore subdirectory as well
- DONE[$t]=$t
- fi
- elif [ $match -eq 0 -a -d $t ] ; then
- # Make sure children of this matched directory will be ignored
- DONE[$t]=$t
- elif [[ -f $t && ! $t =~ .*\.t ]] ; then
- # Ignore files not ending in .t
- match=1
- fi
return $match
- }
+}
+
+function run_tests()
+{
RES=0
for t in $(find ${regression_testsdir}/tests | LC_COLLATE=C sort) ; do
if match $t "$tests" ; then