summaryrefslogtreecommitdiffstats
path: root/tests/basic
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2013-01-25 10:00:57 +0100
committerAnand Avati <avati@redhat.com>2013-01-29 10:29:03 -0800
commitf811441e257cafb975dfcd16f14b4378beee524e (patch)
tree4eaed1ee722b5e82ca623a9553fe590cd467b4f7 /tests/basic
parentfed0752313c37c500d3b88f0651c4923cec4cf9b (diff)
tests: skip time consuming mock builds for code-only changes
tests/basic/rpm.t takes a bulk of the time for the regression tests. Often the building of the rpm is not affected at all and therefor the tests does not add any value. With this change the rpmbuild/mock test will only be run when some changes affect the build system. Changes affecting 'tests/', 'doc/', '*.py', *.c' and '*.h' do not trigger the test anymore. Change-Id: Ic188b9e26cde3113b2bdf9cd1fab56d9fd85a4b7 BUG: 904005 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/4429 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests/basic')
-rwxr-xr-xtests/basic/rpm.t27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/basic/rpm.t b/tests/basic/rpm.t
index 45818ef68..f78549810 100755
--- a/tests/basic/rpm.t
+++ b/tests/basic/rpm.t
@@ -2,7 +2,6 @@
. $(dirname $0)/../include.rc
-cleanup
RESULT_DIR=$(mktemp -d -p /var/tmp rpm-tests.XXXXXXXX)
# enable some extra debugging
@@ -12,6 +11,32 @@ then
set -x
fi
+# detect the branch we're based off
+if [ -n "${BRANCH}" ] ; then
+ # $BRANCH is set in the environment (by Jenkins or other)
+ GIT_PARENT="origin/${BRANCH}"
+else
+ # get a reference to the latest clean tree
+ GIT_PARENT=$(git describe --abbrev=0)
+fi
+
+# check for changed files
+CHANGED_FILES=$(git diff --name-only ${GIT_PARENT})
+# filter out any files not affecting the build itself
+CHANGED_FILES=$(grep -E -v \
+ -e '\.c$' \
+ -e '\.h$' \
+ -e '\.py$' \
+ -e '^tests/' \
+ <<< "${CHANGED_FILES}")
+if [ -z "${CHANGED_FILES}" ]
+then
+ # only contents of files were changed, no need to retest rpmbuild
+ SKIP_TESTS
+ cleanup
+ exit 0
+fi
+
# checkout the sources to a new directory to execute ./configure and all
REPO=${PWD}
COMMIT=$(git describe)