summaryrefslogtreecommitdiffstats
path: root/run-tests.sh
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2016-03-10 10:50:59 -0500
committerRaghavendra Talur <rtalur@redhat.com>2016-05-06 03:16:43 -0700
commitd544ac4997d047b0a27e40d445e910373b3acfd2 (patch)
treeb28003f708aa4b3e87d599f28fc1603e6a7125a1 /run-tests.sh
parentebd51f143ed62d3d35b674e3dc639b1951322ec6 (diff)
tests: run tests from the most recent commit first
>Signed-off-by: Jeff Darcy <jdarcy@redhat.com> >Reviewed-on: http://review.gluster.org/13439 >Smoke: Gluster Build System <jenkins@build.gluster.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: Raghavendra Talur <rtalur@redhat.com> (cherry picked from commit df7390c9d7db40dcd68cf1020b6248f5105ab8eb) Change-Id: If11f552543bf0f1f0e9756e9f2237b72e44b7aed BUG: 1316533 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/14220 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.sh32
1 files changed, 30 insertions, 2 deletions
diff --git a/run-tests.sh b/run-tests.sh
index b4a5e677eba..f080267b4ef 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -4,6 +4,7 @@
export TZ=UTC
force="no"
+head="yes"
retry="no"
tests=""
exit_on_failure="no"
@@ -332,12 +333,34 @@ function run_tests()
return ${RES}
}
+function run_head_tests()
+{
+ [ -d ${regression_testsdir}/.git ] || return
+
+ # The git command needs $cwd to be within the repository, but run_tests
+ # needs it to be back where we started.
+ pushd $regression_testsdir
+ git_cmd="git diff-tree --no-commit-id --name-only -r HEAD"
+ htests=$($git_cmd tests | grep '.t$')
+ popd
+ [ -n "$htests" ] || return
+
+ # Perhaps it's not ideal that we'll end up re-running these tests, but the
+ # gains from letting them fail fast in the first round should outweigh the
+ # losses from running them again in the second. OTOH, with so many of our
+ # tests being non-deterministic, maybe it doesn't hurt to give the newest
+ # tests an extra workout.
+ run_tests "$htests"
+}
+
function parse_args () {
- args=`getopt frcbk "$@"`
+ args=`getopt frcbkhH "$@"`
set -- $args
while [ $# -gt 0 ]; do
case "$1" in
-f) force="yes" ;;
+ -h) head="no" ;;
+ -H) head="only" ;;
-r) retry="yes" ;;
-c) exit_on_failure="no" ;;
-b) skip_bad_tests="no" ;;
@@ -367,4 +390,9 @@ check_dependencies
check_location
# Run the tests
-run_tests "$tests"
+if [ x"$head" != x"no" ]; then
+ run_head_tests || exit 1
+fi
+if [ x"$head" != x"only" ]; then
+ run_tests "$tests" || exit 1
+fi