From df7390c9d7db40dcd68cf1020b6248f5105ab8eb Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Thu, 10 Mar 2016 10:50:59 -0500 Subject: tests: run tests from the most recent commit first Change-Id: If11f552543bf0f1f0e9756e9f2237b72e44b7aed Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/13439 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra Talur --- run-tests.sh | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'run-tests.sh') diff --git a/run-tests.sh b/run-tests.sh index c681f7d727e..8fcfa713e80 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="yes" @@ -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 -- cgit