diff options
-rwxr-xr-x | tests/basic/rpm.t | 27 | ||||
-rw-r--r-- | tests/include.rc | 9 |
2 files changed, 35 insertions, 1 deletions
diff --git a/tests/basic/rpm.t b/tests/basic/rpm.t index 45818ef68d9..f7854981087 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) diff --git a/tests/include.rc b/tests/include.rc index 90bcb8ec7b8..03ffe4a5cc1 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -154,6 +154,15 @@ function _EXPECT_WITHIN() } +function SKIP_TESTS() +{ + dbg "Skipping tests $t-$testcnt"; + while [ $t -le $testcnt ]; do + true ; test_footer; + done +} + + function cleanup() { killall -15 glusterfs glusterfsd glusterd 2>/dev/null || true; |