path: root/tests
diff options
authorHarshavardhana <>2013-09-30 16:10:32 -0700
committerAnand Avati <>2013-10-01 23:29:56 -0700
commita66bf67965dddd9decd9210c3a530fdc85b6430c (patch)
tree2321028342a8424e5590b895f80b1b2dd807746d /tests
parentdbe4566beff3239bbb23af50b1ef263b8b100e1b (diff)
tests: Gather only files which need to built
Previous code would rather provide a filter but never look for newly "Added" files leading to failures in subsequent build. This patch fixes such issue by actually verifying pedantically for only files which need to be tested. Change-Id: Ia716acf82ee60f8ffe5e36257f1cc866c6062718 BUG: 904005 Signed-off-by: Harshavardhana <> Reviewed-on: Reviewed-by: Kaleb KEITHLEY <> Tested-by: Gluster Build System <> Reviewed-by: Anand Avati <>
Diffstat (limited to 'tests')
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/basic/rpm.t b/tests/basic/rpm.t
index e2c630f8e..a914d536c 100755
--- a/tests/basic/rpm.t
+++ b/tests/basic/rpm.t
@@ -35,18 +35,11 @@ else
GIT_PARENT=$(git describe --abbrev=0)
-# check for changed files
-CHANGED_FILES=$(git diff --name-only ${GIT_PARENT})
-# if a commit changes this test, we should not skip it
-SELFTEST=$(grep -e 'tests/basic/rpm.t' <<< "${CHANGED_FILES}")
-# 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}" -a -z "${SELFTEST}" ]
+# Filter out everything and what remains needs to be built
+BUILD_FILES=$(git diff --name-status ${GIT_PARENT} | grep -Ev '^M.*\.(c|h|py)' | awk {'print $2'})
+SELFTEST=$(grep -e 'tests/basic/rpm.t' <<< "${BUILD_FILES}")
+BUILD_FILES=$(grep -Ev '^tests/' <<< "${BUILD_FILES}")
+if [ -z "${BUILD_FILES}" -a -z "${SELFTEST}"]
# nothing affecting packaging changed, no need to retest rpmbuild