diff --git dev-support/test-patch.sh dev-support/test-patch.sh index d3e1fc3..ee54010 100755 --- dev-support/test-patch.sh +++ dev-support/test-patch.sh @@ -43,6 +43,9 @@ FINDBUGS_HOME=${FINDBUGS_HOME} FORREST_HOME=${FORREST_HOME} ECLIPSE_HOME=${ECLIPSE_HOME} +RED=$(tput setaf 1) +RESET_COLOR=$(tput sgr0) + ############################################################################### printUsage() { echo "Usage: $0 [options] patch-file | defect-number" @@ -327,6 +330,22 @@ checkTests () { } ############################################################################### +### Check there are no compilation errors, passing a file to be parsed. +checkCompilationErrors() { + local file=$1 + COMPILATION_ERROR=false + eval $( awk '/ERROR/ {print "COMPILATION_ERROR=true"}' $file) + if $COMPILATION_ERROR ; then + echo -e "${RED}======================================================================" + echo -e "${RED} There are compilation errors." + echo -e "${RED}======================================================================" + $AWK '/ERROR/ { print $0}' $file + echo -e "${RESET_COLOR}" + cleanupAndExit 1 + fi +} + +############################################################################### ### Attempt to apply the patch applyPatch () { echo "" @@ -389,6 +408,7 @@ checkJavadocWarnings () { echo "$MVN clean package javadoc:javadoc -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1" export MAVEN_OPTS="${MAVEN_OPTS}" $MVN clean package javadoc:javadoc -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1 + checkCompilationErrors $PATCH_DIR/patchJavadocWarnings.txt javadocWarnings=`$GREP '\[WARNING\]' $PATCH_DIR/patchJavadocWarnings.txt | $AWK '/Javadoc Warnings/,EOF' | $GREP warning | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'` echo "" echo "" @@ -422,12 +442,6 @@ checkJavacWarnings () { echo "$MVN clean package -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavacWarnings.txt 2>&1" export MAVEN_OPTS="${MAVEN_OPTS}" $MVN clean package -DskipTests -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavacWarnings.txt 2>&1 - if [[ $? != 0 ]] ; then - JIRA_COMMENT="$JIRA_COMMENT - - {color:red}-1 javac{color}. The patch appears to cause mvn compile goal to fail." - return 1 - fi ### Compare trunk and patch javac warning numbers if [[ -f $PATCH_DIR/patchJavacWarnings.txt ]] ; then trunkJavacWarnings=`$GREP '\[WARNING\]' $PATCH_DIR/trunkJavacWarnings.txt | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'`