diff options
author | Nigel Babu <nigelb@redhat.com> | 2017-09-06 13:31:04 +0530 |
---|---|---|
committer | Nigel Babu <nigelb@redhat.com> | 2017-10-12 08:27:52 +0000 |
commit | 05a3b660aa49d6da9603f4419ec55ff1137b721e (patch) | |
tree | c7a9f8fff783b0820d9ac1cf745e27018268ed8e /build-gluster-org | |
parent | ccda0a9dd75d488004b92a9fc701f9305e145c9a (diff) |
When a commit only changes tests, only run tests
If a commit changes a .rc or .c file in the code, this doesn't catch
that because it becomes tricker to do.
Change-Id: I4658ec142e56b81f93452ecca7980f021b17072a
Diffstat (limited to 'build-gluster-org')
-rw-r--r-- | build-gluster-org/scripts/centos-regression.sh | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/build-gluster-org/scripts/centos-regression.sh b/build-gluster-org/scripts/centos-regression.sh index 8960ab8..66e1ef5 100644 --- a/build-gluster-org/scripts/centos-regression.sh +++ b/build-gluster-org/scripts/centos-regression.sh @@ -81,13 +81,30 @@ if [ $RET != 0 ]; then fi echo +TEST_ONLY=true +declare -a TEST_FILES +TEST_COUNT=0 +for file in $(git diff-tree --no-commit-id --name-only -r HEAD); do + if [[ $file =~ tests/.*\.t$ ]] ;then + TEST_FILES[$TEST_COUNT]="$file" + TEST_COUNT=$(( $TEST_COUNT + 1 )) + else + TEST_ONLY=false + fi +done + # Run the regression test echo "Start time $(date)" echo echo "Run the regression test" echo "***********************" echo -sudo -E bash /opt/qa/regression.sh +if [[ "$TEST_ONLY" == true ]]; then + echo "This review only changes tests, running only the changed tests" + sudo -E bash /opt/qa/regression.sh ${TEST_FILES[*]} +else + sudo -E bash /opt/qa/regression.sh +fi RET=$? if [ $RET = 0 ]; then |