From a66bf67965dddd9decd9210c3a530fdc85b6430c Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 30 Sep 2013 16:10:32 -0700 Subject: 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: http://review.gluster.org/6016 Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System Reviewed-by: Anand Avati --- tests/basic/rpm.t | 17 +++++------------ 1 file 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) fi -# 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}"] then # nothing affecting packaging changed, no need to retest rpmbuild SKIP_TESTS -- cgit