From 141127660c2723e67409f5ad96ecca50217d5a37 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Eagles Date: Fri, 6 Jul 2012 20:04:51 +0000 Subject: [PATCH] HADOOP-8523. test-patch.sh doesn't validate patches before building (Jack Dintruff via jeagles) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1358394 13f79535-47bb-0310-9956-ffa450edef68 --- dev-support/smart-apply-patch.sh | 6 ++++ dev-support/test-patch.sh | 34 ++++++++++++++++--- .../hadoop-common/CHANGES.txt | 3 ++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/dev-support/smart-apply-patch.sh b/dev-support/smart-apply-patch.sh index 3e7b16d974..e3d001a596 100755 --- a/dev-support/smart-apply-patch.sh +++ b/dev-support/smart-apply-patch.sh @@ -14,6 +14,7 @@ set -e PATCH_FILE=$1 +DRY_RUN=$2 if [ -z "$PATCH_FILE" ]; then echo usage: $0 patch-file exit 1 @@ -100,6 +101,11 @@ else cleanup 1; fi +# If this is a dry run then exit instead of applying the patch +if [[ -n $DRY_RUN ]]; then + cleanup 0; +fi + echo Going to apply patch with: $PATCH -p$PLEVEL $PATCH -p$PLEVEL -E < $PATCH_FILE diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index 2d77071e5a..ccc7a6f65d 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -207,7 +207,7 @@ checkout () { } ############################################################################### -setup () { +downloadPatch () { ### Download latest patch file (ignoring .htm and .html) when run from patch process if [[ $JENKINS == "true" ]] ; then $WGET -q -O $PATCH_DIR/jira http://issues.apache.org/jira/browse/$defect @@ -240,6 +240,25 @@ setup () { cleanupAndExit 0 fi fi +} + +############################################################################### +verifyPatch () { + # Before building, check to make sure that the patch is valid + $bindir/smart-apply-patch.sh $PATCH_DIR/patch dryrun + if [[ $? != 0 ]] ; then + echo "PATCH APPLICATION FAILED" + JIRA_COMMENT="$JIRA_COMMENT + + -1 patch. The patch command could not apply the patch." + return 1 + else + return 0 + fi +} + +############################################################################### +buildWithPatch () { echo "" echo "" echo "======================================================================" @@ -886,9 +905,15 @@ if [[ $JENKINS == "true" ]] ; then exit 100 fi fi -setup +downloadPatch +verifyPatch +(( RESULT = RESULT + $? )) +if [[ $RESULT != 0 ]] ; then + submitJiraComment 1 + cleanupAndExit 1 +fi +buildWithPatch checkAuthor -RESULT=$? if [[ $JENKINS == "true" ]] ; then cleanUpXml @@ -896,7 +921,8 @@ fi checkTests (( RESULT = RESULT + $? )) applyPatch -if [[ $? != 0 ]] ; then +(( RESULT = RESULT + $? )) +if [[ $RESULT != 0 ]] ; then submitJiraComment 1 cleanupAndExit 1 fi diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 51ed152ba8..9126d8fe9e 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -85,6 +85,9 @@ Trunk (unreleased changes) HADOOP-8434. Add tests for Configuration setter methods. (Madhukara Phatak via suresh) + HADOOP-8523. test-patch.sh doesn't validate patches before building + (Jack Dintruff via jeagles) + BUG FIXES HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.