knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject knox git commit: [KNOX-169] - Test issue for patch test automation via PreCommit-Knox-Build job
Date Fri, 29 Jan 2016 19:35:54 GMT
Repository: knox
Updated Branches:
  refs/heads/master 432494a17 -> 0cab1fc80


[KNOX-169] - Test issue for patch test automation via PreCommit-Knox-Build job


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/0cab1fc8
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/0cab1fc8
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/0cab1fc8

Branch: refs/heads/master
Commit: 0cab1fc8068d9094b9c4913e7dd2c84a03120eef
Parents: 432494a
Author: Kevin Minder <kminder@apache.org>
Authored: Fri Jan 29 14:35:43 2016 -0500
Committer: Kevin Minder <kminder@apache.org>
Committed: Fri Jan 29 14:35:49 2016 -0500

----------------------------------------------------------------------
 ...test-patch-find-new-patch-available-jiras.sh |    4 +-
 dev-support/test-patch.sh                       | 1117 +++++-------------
 2 files changed, 317 insertions(+), 804 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/0cab1fc8/dev-support/test-patch-find-new-patch-available-jiras.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch-find-new-patch-available-jiras.sh b/dev-support/test-patch-find-new-patch-available-jiras.sh
index 3a3b639..317be6b 100755
--- a/dev-support/test-patch-find-new-patch-available-jiras.sh
+++ b/dev-support/test-patch-find-new-patch-available-jiras.sh
@@ -34,6 +34,7 @@ printUsage() {
   echo "          [--script-debug]"
   echo
 }
+
 ###############################################################################
 parseArgs() {
   for i in $*
@@ -66,6 +67,7 @@ parseArgs() {
     exit 1
   fi
 }
+
 ###############################################################################
 findAndSubmitAvailablePatches() {
 
@@ -108,7 +110,7 @@ done
 }
 ###############################################################################
 
-mkdir ${TEMPDIR} 2>&1 $STDOUT
+mkdir -p ${TEMPDIR} 2>&1 $STDOUT
 
 parseArgs "$@"
 

http://git-wip-us.apache.org/repos/asf/knox/blob/0cab1fc8/dev-support/test-patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh
index d443344..d139833 100644
--- a/dev-support/test-patch.sh
+++ b/dev-support/test-patch.sh
@@ -1,4 +1,5 @@
-#!/usr/bin/env bash
+#!/bin/bash
+#
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
 #   You may obtain a copy of the License at
@@ -11,892 +12,402 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
-
-#set -x
-ulimit -n 1024
-
-### Setup some variables.  
-### SVN_REVISION and BUILD_URL are set by Hudson if it is run by patch process
-### Read variables from properties file
-bindir=$(dirname $0)
-
-# Defaults
-if [ -z "$MAVEN_HOME" ]; then
-  MVN=mvn
-else
-  MVN=$MAVEN_HOME/bin/mvn
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+  set -x
 fi
 
-PROJECT_NAME=Knox
-JENKINS=false
-PATCH_DIR=/tmp
-SUPPORT_DIR=/tmp
 BASEDIR=$(pwd)
-
-PS=${PS:-ps}
-AWK=${AWK:-awk}
-WGET=${WGET:-wget}
-SVN=${SVN:-svn}
-GREP=${GREP:-grep}
-PATCH=${PATCH:-patch}
-DIFF=${DIFF:-diff}
-JIRACLI=${JIRA:-jira}
-FINDBUGS_HOME=${FINDBUGS_HOME}
-FORREST_HOME=${FORREST_HOME}
-ECLIPSE_HOME=${ECLIPSE_HOME}
+TESTPATCHDIR=${BASEDIR}/test-patch
+TOOLSDIR=${TESTPATCHDIR}/tools
+TEMPDIR=${TESTPATCHDIR}/tmp
+REPORTDIR=${TESTPATCHDIR}/reports
+SUMMARYFILE=${REPORTDIR}/TEST-SUMMARY.jira
+SUMMARYFILETXT=${REPORTDIR}/TEST-SUMMARY.txt
+
+JIRAHOST="https://issues.apache.org"
+JIRAURL="${JIRAHOST}/jira"
+JIRAURLISSUEPREFIX="${JIRAURL}/browse/"
+
+JIRAUPDATE="false"
+JIRAUSER="knoxqa"
+JIRAPASSWORD=""
+
+
+VERBOSEOPTION=""
+JIRAISSUE=""
+PATCHFILE=""
+TASKSTORUN=""
+TASKSTOSKIP=""
+RESETSCM="false"
+DIRTYSCM="false"
+STDOUT="/dev/null"
+MVNPASSTHRU=""
 
 ###############################################################################
-printUsage() {
-  echo "Usage: $0 [options] patch-file | defect-number"
-  echo
-  echo "Where:"
-  echo "  patch-file is a local patch file containing the changes to test"
-  echo "  defect-number is a JIRA defect number (e.g. 'HADOOP-1234') to test (Jenkins only)"
+gitOrSvn() {
+  SCM="NONE"
+  which git &> /dev/null
+  if [[ $? == 0 ]] ; then
+    git status &> /dev/null
+    if [[ $? == 0 ]] ; then
+      SCM="git"
+    fi
+  fi
+  if [ "${SCM}" == "NONE" ] ; then
+    which svn &> /dev/null
+    if [[ $? == 0 ]] ; then
+      svnOutput=`svn status 2>&1`
+      if [[  "$svnOutput" != *"is not a working copy" ]] ; then
+        SCM="svn"
+      fi
+    fi
+  fi
+  if [ "${SCM}" == "NONE" ] ; then
+    echo "The current workspace is not under Source Control (GIT or SVN)"
+    exit 1
+  fi
+}
+###############################################################################
+prepareSCM() {
+  gitOrSvn
+  if [ "${DIRTYSCM}" != "true" ] ; then
+    if [ "${RESETSCM}" == "true" ] ; then
+      if [ "${SCM}" == "git" ] ; then
+        git reset --hard HEAD > /dev/null
+        git clean -f -d > /dev/null
+      fi
+      if [ "${SCM}" == "svn" ] ; then
+        svn revert -R . > /dev/null
+        svn status | grep "\?" | awk '{print $2}' | xargs rm -rf
+      fi
+    else
+      echo "It should not happen DIRTYSCM=false & RESETSCM=false"
+      exit 1
+    fi
+    echo "Cleaning local ${SCM} workspace" >> ${SUMMARYFILE}
+  else
+    echo "WARNING: Running test-patch on a dirty local ${SCM} workspace" >> ${SUMMARYFILE}
+  fi
+}
+###############################################################################
+prepareTestPatchDirs() {
+  mkdir ${TESTPATCHDIR} 2> /dev/null
+  rm -rf ${REPORTDIR} 2> /dev/null
+  rm -rf ${TEMPDIR} 2> /dev/null
+  mkdir ${TOOLSDIR} 2> /dev/null
+  mkdir ${TEMPDIR} 2> /dev/null
+  mkdir ${REPORTDIR} 2> /dev/null
+  if [ ! -e "${TESTPATCHDIR}" ] ; then
+    echo "Could not create test-patch/ dir"
+    exit 1
+  fi
+}
+###############################################################################
+updateJira() {
+  if [[ "${JIRAUPDATE}" != "" && "${JIRAISSUE}" != "" ]] ; then
+    if [[ "$JIRAPASSWORD" != "" ]] ; then
+      JIRACLI=${TOOLSDIR}/jira-cli/jira.sh
+      if [ ! -e "${JIRACLI}" ] ; then
+        curl https://bobswift.atlassian.net/wiki/download/attachments/16285777/jira-cli-2.6.0-distribution.zip
> ${TEMPDIR}/jira-cli.zip
+        if [ $? != 0 ] ; then
+         echo
+         echo "Could not download jira-cli tool, thus no JIRA updating"
+         echo
+         exit 1
+        fi
+        mkdir ${TEMPDIR}/jira-cli-tmp
+        (cd ${TEMPDIR}/jira-cli-tmp;jar xf ${TEMPDIR}/jira-cli.zip; mv jira-cli-2.6.0 ${TOOLSDIR}/jira-cli)
+        chmod u+x ${JIRACLI}
+      fi
+      echo "Adding comment to JIRA"
+      comment=`cat ${SUMMARYFILE}`
+      $JIRACLI -s $JIRAURL -a addcomment -u $JIRAUSER -p "$JIRAPASSWORD" --comment "$comment"
--issue $JIRAISSUE
+      echo
+    else
+      echo "Skipping JIRA update"
+      echo
+    fi
+  fi
+}
+###############################################################################
+cleanupAndExit() {
+  updateJira
+  echo "test-patch exit code: $1"
   echo
-  echo "Options:"
-  echo "--patch-dir=<dir>      The directory for working and output files (default
'/tmp')"
-  echo "--basedir=<dir>        The directory to apply the patch to (default current
directory)"
-  echo "--mvn-cmd=<cmd>        The 'mvn' command to use (default \$MAVEN_HOME/bin/mvn,
or 'mvn')"
-  echo "--ps-cmd=<cmd>         The 'ps' command to use (default 'ps')"
-  echo "--awk-cmd=<cmd>        The 'awk' command to use (default 'awk')"
-  echo "--svn-cmd=<cmd>        The 'svn' command to use (default 'svn')"
-  echo "--grep-cmd=<cmd>       The 'grep' command to use (default 'grep')"
-  echo "--patch-cmd=<cmd>      The 'patch' command to use (default 'patch')"
-  echo "--diff-cmd=<cmd>       The 'diff' command to use (default 'diff')"
-  echo "--findbugs-home=<path> Findbugs home directory (default FINDBUGS_HOME environment
variable)"
-  echo "--forrest-home=<path>  Forrest home directory (default FORREST_HOME environment
variable)"
-  echo "--dirty-workspace      Allow the local SVN workspace to have uncommitted changes"
-  echo "--run-tests            Run all tests below the base directory"
+  exit $1
+}
+###############################################################################
+printUsage() {
+  echo "Usage: $0 <OPTIONS>"
+  echo "          (--jira=<JIRA ISSUE> | --patch=<PATCH PATH>)"
+  echo "          (--reset-scm | --dirty-scm)"
+  echo "          [--tasks=<TASK,...>]"
+  echo "          [--skip-tasks=<TASK,...>]"
+  echo "          [--jira-cli=<JIRA CLIENT>]"
+  echo "          [--jira-user=<JIRA USER>]"
+  echo "          [--jira-password=<JIRA PASSWORD>]"
+  echo "          [-D<MVN PROPERTY>...]"
+  echo "          [-P<MVN PROFILE>...]"
+  echo "          [--list-tasks]"
+  echo "          [--verbose]"
   echo
-  echo "Jenkins-only options:"
-  echo "--jenkins              Run by Jenkins (runs tests and posts results to JIRA)"
-  echo "--support-dir=<dir>    The directory to find support files in"
-  echo "--wget-cmd=<cmd>       The 'wget' command to use (default 'wget')"
-  echo "--jira-cmd=<cmd>       The 'jira' command to use (default 'jira')"
-  echo "--jira-user=<user>     The username for the 'jira' command"
-  echo "--jira-password=<pw>   The password for the 'jira' command"
-  echo "--eclipse-home=<path>  Eclipse home directory (default ECLIPSE_HOME environment
variable)"
 }
-
 ###############################################################################
 parseArgs() {
   for i in $*
   do
     case $i in
-    --jenkins)
-      JENKINS=true
-      ;;
-    --patch-dir=*)
-      PATCH_DIR=${i#*=}
-      ;;
-    --support-dir=*)
-      SUPPORT_DIR=${i#*=}
-      ;;
-    --basedir=*)
-      BASEDIR=${i#*=}
-      ;;
-    --mvn-cmd=*)
-      MVN=${i#*=}
+    --jira=*)
+      JIRAISSUE=${i#*=}
       ;;
-    --ps-cmd=*)
-      PS=${i#*=}
+    --patch=*)
+      PATCHFILE=${i#*=}
       ;;
-    --awk-cmd=*)
-      AWK=${i#*=}
+    --tasks=*)
+      TASKSTORUN=${i#*=}
       ;;
-    --wget-cmd=*)
-      WGET=${i#*=}
+    --skip-tasks=*)
+      TASKSTOSKIP=${i#*=}
       ;;
-    --svn-cmd=*)
-      SVN=${i#*=}
-      ;;
-    --grep-cmd=*)
-      GREP=${i#*=}
-      ;;
-    --patch-cmd=*)
-      PATCH=${i#*=}
-      ;;
-    --diff-cmd=*)
-      DIFF=${i#*=}
+    --list-tasks)
+      listTasks
+      cleanupAndExit 0
       ;;
-    --jira-cmd=*)
+    --jira-cli=*)
       JIRACLI=${i#*=}
       ;;
     --jira-user=*)
-      JIRA_USER=${i#*=}
+      JIRAUSER=${i#*=}
       ;;
     --jira-password=*)
-      JIRA_PASSWD=${i#*=}
+      JIRAPASSWORD=${i#*=}
+      JIRAUPDATE="true"
       ;;
-    --findbugs-home=*)
-      FINDBUGS_HOME=${i#*=}
+    -D*)
+      MVNPASSTHRU="${MVNPASSTHRU} $i"
       ;;
-    --forrest-home=*)
-      FORREST_HOME=${i#*=}
+    -P*)
+      MVNPASSTHRU="${MVNPASSTHRU} $i"
       ;;
-    --eclipse-home=*)
-      ECLIPSE_HOME=${i#*=}
+    --reset-scm)
+      RESETSCM="true"
       ;;
-    --dirty-workspace)
-      DIRTY_WORKSPACE=true
+    --dirty-scm)
+      DIRTYSCM="true"
       ;;
-    --run-tests)
-      RUN_TESTS=true
+    --verbose)
+      VERBOSEOPTION="--verbose"
+      STDOUT="/dev/stdout"
       ;;
     *)
-      PATCH_OR_DEFECT=$i
+      echo "Invalid option"
+      echo
+      printUsage
+      exit 1
       ;;
     esac
   done
-  if [ -z "$PATCH_OR_DEFECT" ]; then
+  if [[ "${JIRAISSUE}" == "" && "${PATCHFILE}" == "" ]] ; then
+    echo "Either --jira or --patch option must be specified"
+    echo
     printUsage
     exit 1
   fi
-  if [[ $JENKINS == "true" ]] ; then
-    echo "Running in Jenkins mode"
-    defect=$PATCH_OR_DEFECT
-    ECLIPSE_PROPERTY="-Declipse.home=$ECLIPSE_HOME"
-    
-    if [[ ! -e "$PATCH_DIR" ]] ; then
-      echo ""
-      echo "ERROR: No such the patch dir ($PATCH_DIR)"
-      echo ""
-      cleanupAndExit 0
-    fi
-  else
-    echo "Running in developer mode"
-    JENKINS=false
-    ### PATCH_FILE contains the location of the patchfile
-    PATCH_FILE=$PATCH_OR_DEFECT
-    if [[ ! -e "$PATCH_FILE" ]] ; then
-      echo "Unable to locate the patch file $PATCH_FILE"
-      cleanupAndExit 0
-    fi
-    ### Check if $PATCH_DIR exists. If it does not exist, create a new directory
-    if [[ ! -e "$PATCH_DIR" ]] ; then
-      mkdir "$PATCH_DIR"
-      if [[ $? == 0 ]] ; then 
-        echo "$PATCH_DIR has been created"
-      else
-        echo "Unable to create $PATCH_DIR"
-        cleanupAndExit 0
-      fi
-    fi
-    ### Obtain the patch filename to append it to the version number
-    defect=`basename $PATCH_FILE`
+  if [[ "${JIRAISSUE}" != "" && "${PATCHFILE}" != "" ]] ; then
+    echo "Cannot specify --jira or --patch options together"
+    echo
+    printUsage
+    exit 1
   fi
-}
-
-###############################################################################
-checkout () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Testing patch for ${defect}."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  ### When run by a developer, if the workspace contains modifications, do not continue
-  ### unless the --dirty-workspace option was set
-  status=`$SVN stat --ignore-externals | sed -e '/^X[ ]*/D'`
-  if [[ $JENKINS == "false" ]] ; then
-    if [[ "$status" != "" && -z $DIRTY_WORKSPACE ]] ; then
-      echo "ERROR: can't run in a workspace that contains the following modifications"
-      echo "$status"
-      cleanupAndExit 1
-    fi
+  if [[ "${RESETSCM}" == "false" && "${DIRTYSCM}" == "false" ]] ; then
+    echo "Either --reset-scm or --dirty-scm option must be specified"
     echo
-  else   
-    cd $BASEDIR
-    $SVN revert -R .
-    rm -rf `$SVN status --no-ignore`
-    $SVN update
+    printUsage
+    exit 1
   fi
-  return $?
-}
-
-###############################################################################
-downloadPatch () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Downloading patch for ${defect}."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  ### 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
-    if [[ `$GREP -c 'Patch Available' $PATCH_DIR/jira` == 0 ]] ; then
-      echo "$defect is not \"Patch Available\".  Exiting."
-      cleanupAndExit 0
-    fi
-    relativePatchURL=`$GREP -o '"/jira/secure/attachment/[0-9]*/[^"]*' $PATCH_DIR/jira |
$GREP -v -e 'htm[l]*$' | sort | tail -1 | $GREP -o '/jira/secure/attachment/[0-9]*/[^"]*'`
-    patchURL="http://issues.apache.org${relativePatchURL}"
-    patchNum=`echo $patchURL | $GREP -o '[0-9]*/' | $GREP -o '[0-9]*'`
-    echo "$defect patch is being downloaded at `date` from"
-    echo "$patchURL"
-    $WGET -q -O $PATCH_DIR/patch $patchURL
-    VERSION=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-    JIRA_COMMENT="Here are the results of testing the latest attachment 
-  $patchURL
-  against trunk revision ${SVN_REVISION}."
-
-    ### Copy in any supporting files needed by this process
-    cp -r $SUPPORT_DIR/lib/* ./lib
-    #PENDING: cp -f $SUPPORT_DIR/etc/checkstyle* ./src/test
-  ### Copy the patch file to $PATCH_DIR
-  else
-    VERSION=PATCH-${defect}
-    cp $PATCH_FILE $PATCH_DIR/patch
-    if [[ $? == 0 ]] ; then
-      echo "Patch file $PATCH_FILE copied to $PATCH_DIR"
-    else
-      echo "Could not copy $PATCH_FILE to $PATCH_DIR"
-      cleanupAndExit 0
-    fi
+  if [[ "${RESETSCM}" == "true" && "${DIRTYSCM}" == "true" ]] ; then
+    echo "Cannot specify --reset-scm and --dirty-scm options together"
+    echo
+    printUsage
+    exit 1
   fi
 }
-
 ###############################################################################
-verifyPatch () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Simulating the application of the downloaded patch"
-  echo "======================================================================"
-  echo "======================================================================"
+listTasks() {
+  echo "Available Tasks:"
   echo ""
-  echo ""
-  # Before building, check to make sure that the patch is valid
-  ${PATCH} -t --dry-run -p0 < $PATCH_DIR/patch
-  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
+  getAllTasks
+  for taskFile in ${TASKFILES} ; do
+    taskName=`bash $taskFile --taskname`
+    echo "  $taskName"
+  done
+  echo
 }
-
 ###############################################################################
-buildTrunk () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo " Pre-build trunk to verify trunk stability and javac, javadoc warnings" 
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "Compiling $(pwd)"
-  echo "$MVN clean test -DskipTests > $PATCH_DIR/trunkJavacWarnings.txt 2>&1"
-  $MVN clean test -DskipTests > $PATCH_DIR/trunkJavacWarnings.txt 2>&1
-  if [[ $? != 0 ]] ; then
-    echo "Trunk compilation is broken?"
+downloadPatch () {
+  PATCHFILE=${TEMPDIR}/test.patch
+  jiraPage=${TEMPDIR}/jira.txt
+  curl "${JIRAURLISSUEPREFIX}${JIRAISSUE}" > ${jiraPage}
+  if [[ `grep -c 'Patch Available' ${jiraPage}` == 0 ]] ; then
+    echo "$JIRAISSUE is not \"Patch Available\".  Exiting."
+    echo
     cleanupAndExit 1
   fi
-
-  echo ""
-  echo "Generating Javadocs"
-  echo "$MVN test javadoc:javadoc -DskipTests > $PATCH_DIR/trunkJavadocsWarnings.txt 2>&1"
-  $MVN test javadoc:javadoc -DskipTests > $PATCH_DIR/trunkJavadocWarnings.txt 2>&1
-}
-
-###############################################################################
-### Check for @author tags in the patch
-checkAuthor () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Checking there are no @author tags in the patch."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  authorTags=`$GREP -c -i '@author' $PATCH_DIR/patch`
-  echo "There appear to be $authorTags @author tags in the patch."
-  if [[ $authorTags != 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 @author.  The patch appears to contain $authorTags @author tags which the Hadoop community
has agreed to not allow in code contributions."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 @author.  The patch does not contain any @author tags."
-  return 0
-}
-
-###############################################################################
-### Check for tests in the patch
-checkTests () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Checking there are new or changed tests in the patch."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  testReferences=`$GREP -c -i -e '^+++.*/test' $PATCH_DIR/patch`
-  echo "There appear to be $testReferences test files referenced in the patch."
-  if [[ $testReferences == 0 ]] ; then
-    if [[ $JENKINS == "true" ]] ; then
-      patchIsDoc=`$GREP -c -i 'title="documentation' $PATCH_DIR/jira`
-      if [[ $patchIsDoc != 0 ]] ; then
-        echo "The patch appears to be a documentation patch that doesn't require tests."
-        JIRA_COMMENT="$JIRA_COMMENT
-
-    +0 tests included.  The patch appears to be a documentation patch that doesn't require
tests."
-        return 0
-      fi
-    fi
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 tests included.  The patch doesn't appear to include any new or modified tests.
-                        Please justify why no new tests are needed for this patch.
-                        Also please list what manual steps were performed to verify this
patch."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 tests included.  The patch appears to include $testReferences new or modified test
files."
-  return 0
-}
-
-cleanUpXml () {
-  cd $BASEDIR/conf
-  for file in `ls *.xml.template`
-    do
-      rm -f `basename $file .template`
-    done
-  cd $BASEDIR  
-}
-
-###############################################################################
-### Attempt to apply the patch
-applyPatch () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Applying patch."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  export PATCH
-  ${PATCH} -p0 < $PATCH_DIR/patch
+  relativePatchURL=`grep -o '"/jira/secure/attachment/[0-9]*/[^"]*' ${jiraPage} \
+                   | grep -v -e 'htm[l]*$' | sort | tail -1 \
+                   | grep -o '/jira/secure/attachment/[0-9]*/[^"]*'`
+  patchURL="${JIRAHOST}${relativePatchURL}"
+  patchNum=`echo $patchURL | grep -o '[0-9]*/' | grep -o '[0-9]*'`
+  curl ${patchURL} > ${PATCHFILE}
   if [[ $? != 0 ]] ; then
-    echo "PATCH APPLICATION FAILED"
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 patch.  The patch command could not apply the patch."
-    return 1
+    echo "Could not download patch for ${JIRAISSUE} from ${patchURL}"
+    echo
+    cleanupAndExit 1
   fi
-  return 0
+  echo "JIRA ${JIRAISSUE}, patch downloaded at `date` from ${patchURL}"
+  echo
 }
-
 ###############################################################################
-### Check there are no javadoc warnings
-checkJavadocWarnings () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched javadoc warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$MVN test javadoc:javadoc -DskipTests > $PATCH_DIR/patchJavadocWarnings.txt 2>&1"
-  $MVN test javadoc:javadoc -DskipTests > $PATCH_DIR/patchJavadocWarnings.txt 2>&1
-
-  $GREP '\[WARNING\]' $PATCH_DIR/trunkJavadocWarnings.txt | $AWK '/Javadoc Warnings/,EOF'
| $GREP warning > $PATCH_DIR/filteredTrunkJavadocWarnings.txt
-  $GREP '\[WARNING\]' $PATCH_DIR/patchJavadocWarnings.txt | $AWK '/Javadoc Warnings/,EOF'
| $GREP warning > $PATCH_DIR/filteredPatchJavadocWarnings.txt
-
-  trunkJavadocWarnings=`cat $PATCH_DIR/filteredTrunkJavadocWarnings.txt | $AWK 'BEGIN {total
= 0} {total += 1} END {print total}'`
-  patchJavadocWarnings=`cat $PATCH_DIR/filteredPatchJavadocWarnings.txt | $AWK 'BEGIN {total
= 0} {total += 1} END {print total}'`
-  echo ""
-  echo ""
-  echo "There appear to be $trunkJavadocWarnings javadoc warnings before the patch and $patchJavadocWarnings
javadoc warnings after applying the patch."
-
-  if [[ $patchJavadocWarnings != "" && $trunkJavadocWarnings != "" ]] ; then
-    if [[ $patchJavadocWarnings -gt $trunkJavadocWarnings ]] ; then
-    ### if patch warning greater than trunk warning
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 javadoc.  The applied patch generated $patchJavadocWarnings javadoc warnings (more
than the trunk's current $trunkJavadocWarnings warnings)."
-    return 1
-    fi
+applyPatch() {
+  echo "Applying patch" >> $STDOUT
+  echo "" >> $STDOUT
+  patch -f -E --dry-run -p0 < ${PATCHFILE} | tee ${REPORTDIR}/APPLY-PATCH.txt \
+        >> $STDOUT
+  if [[  ${PIPESTATUS[0]} != 0 ]] ; then
+    echo "Patch failed to apply to head of branch"
+    echo "{color:red}-1{color} Patch failed to apply to head of branch" >> ${SUMMARYFILE}
+    echo "" >> ${SUMMARYFILE}
+    echo "----------------------------" >> ${SUMMARYFILE}
+    echo
+    cleanupAndExit 1
   fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 javadoc.  The applied patch does not increase the total number of javadoc warnings."
-  return 0
-}
-
-###############################################################################
-### Check there are no changes in the number of Javac warnings
-checkJavacWarnings () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched javac warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$MVN clean test -DskipTests > $PATCH_DIR/patchJavacWarnings.txt 2>&1"
-  $MVN clean test -DskipTests > $PATCH_DIR/patchJavacWarnings.txt 2>&1
+  patch -f -E -p0 < ${PATCHFILE} > ${REPORTDIR}/APPLY-PATCH.txt
   if [[ $? != 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 javac.  The patch appears to cause the build to fail."
-    return 2
-  fi
-  ### Compare trunk and patch javac warning numbers
-  if [[ -f $PATCH_DIR/patchJavacWarnings.txt ]] ; then
-    $GREP '\[WARNING\]' $PATCH_DIR/trunkJavacWarnings.txt > $PATCH_DIR/filteredTrunkJavacWarnings.txt
-    $GREP '\[WARNING\]' $PATCH_DIR/patchJavacWarnings.txt > $PATCH_DIR/filteredPatchJavacWarnings.txt
-    trunkJavacWarnings=`cat $PATCH_DIR/filteredTrunkJavacWarnings.txt | $AWK 'BEGIN {total
= 0} {total += 1} END {print total}'`
-    patchJavacWarnings=`cat $PATCH_DIR/filteredPatchJavacWarnings.txt | $AWK 'BEGIN {total
= 0} {total += 1} END {print total}'`
-    echo ""
-    echo ""
-    echo "There appear to be $trunkJavacWarnings javac compiler warnings before the patch
and $patchJavacWarnings javac compiler warnings after applying the patch."
-    if [[ $patchJavacWarnings != "" && $trunkJavacWarnings != "" ]] ; then
-      if [[ $patchJavacWarnings -gt $trunkJavacWarnings ]] ; then
-        JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 javac.  The applied patch generated $patchJavacWarnings javac compiler warnings (more
than the trunk's current $trunkJavacWarnings warnings)."
-
-    $DIFF $PATCH_DIR/filteredTrunkJavacWarnings.txt $PATCH_DIR/filteredPatchJavacWarnings.txt
> $PATCH_DIR/diffJavacWarnings.txt 
-        JIRA_COMMENT_FOOTER="Javac warnings: $BUILD_URL/artifact/trunk/patchprocess/diffJavacWarnings.txt
-$JIRA_COMMENT_FOOTER"
-
-        return 1
-      fi
-    fi
+    echo "ODD!, dry run passed, but patch failed to apply to head of branch"
+    echo
+    cleanupAndExit 1
   fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 javac.  The applied patch does not increase the total number of javac compiler warnings."
-  return 0
+  echo "" >> $STDOUT
+  echo "Patch applied"
+  echo "{color:green}+1 PATCH_APPLIES{color}" >> $SUMMARYFILE
+  echo
 }
-
 ###############################################################################
-### Check there are no changes in the number of release audit (RAT) warnings
-checkReleaseAuditWarnings () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched release audit warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$MVN apache-rat:check > $PATCH_DIR/patchReleaseAuditOutput.txt 2>&1"
-  $MVN apache-rat:check > $PATCH_DIR/patchReleaseAuditOutput.txt 2>&1
-  find $BASEDIR -name rat.txt | xargs cat > $PATCH_DIR/patchReleaseAuditWarnings.txt
-
-  ### Compare trunk and patch release audit warning numbers
-  if [[ -f $PATCH_DIR/patchReleaseAuditWarnings.txt ]] ; then
-    patchReleaseAuditWarnings=`$GREP -c '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt`
-    echo ""
-    echo ""
-    echo "There appear to be $patchReleaseAuditWarnings release audit warnings after applying
the patch."
-    if [[ $patchReleaseAuditWarnings != "" ]] ; then
-      if [[ $patchReleaseAuditWarnings -gt 0 ]] ; then
-        JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 release audit.  The applied patch generated $patchReleaseAuditWarnings release audit
warnings."
-        $GREP '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt > $PATCH_DIR/patchReleaseAuditProblems.txt
-        echo "Lines that start with ????? in the release audit report indicate files that
do not have an Apache license header." >> $PATCH_DIR/patchReleaseAuditProblems.txt
-        JIRA_COMMENT_FOOTER="Release audit warnings: $BUILD_URL/artifact/trunk/patchprocess/patchReleaseAuditProblems.txt
-$JIRA_COMMENT_FOOTER"
-        return 1
+run() {
+  task=`bash $1 --taskname`
+  if [[ "${TASKSTORUN}" == "" || "${TASKSTORUN}" =~ "${task}" ]] ; then
+    if [[ ! "${TASKSTOSKIP}" =~ "${task}" ]] ; then
+      echo "  Running test-patch task ${task}"
+      outputFile="`basename $1`-$2.out"
+      $1 --op=$2 --tempdir=${TEMPDIR} --reportdir=${REPORTDIR} \
+         --summaryfile=${SUMMARYFILE} --patchfile=${PATCHFILE} ${MVNPASSTHRU} \
+         ${VERBOSEOPTION} | tee ${TEMPDIR}/${outputFile} >> $STDOUT
+      if [[ $? != 0 ]] ; then
+        echo "  Failure, check for details ${TEMPDIR}/${outputFile}"
+        echo
+        cleanupAndExit 1
       fi
     fi
   fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 release audit.  The applied patch does not increase the total number of release audit
warnings."
-  return 0
 }
-
 ###############################################################################
-### Check there are no changes in the number of Checkstyle warnings
-checkStyle () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched checkstyle warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$MVN test checkstyle:checkstyle -DskipTests > $PATCH_DIR/patchStyleErrors.txt
2>&1"
-  $MVN test checkstyle:checkstyle -DskipTests > $PATCH_DIR/patchStyleErrors.txt 2>&1
-
-# JIRA_COMMENT_FOOTER="Checkstyle results: $BUILD_URL/artifact/trunk/build/test/checkstyle-errors.html
-# $JIRA_COMMENT_FOOTER"
-
-  ### calculate actual patchStyleErrors
-  patchStyleErrors=0
-  if [[ -f target/munged/checkstyle-result.xml ]] ; then
-    $GREP -i '<error' target/munged/checkstyle-result.xml > $PATCH_DIR/filteredPatchCheckstyleWarnings.txt
-    patchStyleErrors=`cat $PATCH_DIR/filteredPatchCheckstyleWarnings.txt | $AWK 'BEGIN {total
= 0} {total += 1} END {print total}'`
-    echo ""
-    echo ""
-    echo "There appear to be $patchStyleErrors checkstyle warnings after applying the patch."
-  fi
-
-  if [[ $patchStyleErrors != 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 checkstyle.  The patch generated $patchStyleErrors code style errors."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 checkstyle.  The patch generated 0 code style errors."
-  return 0
+getAllTasks() {
+  TASKFILES=`ls -a bin/test\-patch\-[0-9][0-9]\-*`
 }
-
 ###############################################################################
-### Install the new jars so tests and findbugs can find all of the updated jars 
-buildAndInstall () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Installing all of the jars"
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$MVN install -Dmaven.javadoc.skip=true -DskipTests"
-  $MVN install -Dmaven.javadoc.skip=true -DskipTests
-  return $?
-}
-
-
-###############################################################################
-### Check there are no changes in the number of Findbugs warnings
-checkFindbugsWarnings () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched Findbugs warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  findbugs_version=`${FINDBUGS_HOME}/bin/findbugs -version`
-
-  modules=$(findModules)
-  rc=0
-  for module in $modules;
-  do
-    cd $module
-    echo "  Running findbugs in $module"
-    module_suffix=`basename ${module}`
-    echo "$MVN test findbugs:findbugs -DskipTests < /dev/null > $PATCH_DIR/patchFindBugsOutput${module_suffix}.txt
2>&1" 
-    $MVN test findbugs:findbugs -DskipTests < /dev/null > $PATCH_DIR/patchFindBugsOutput${module_suffix}.txt
2>&1
-    (( rc = rc + $? ))
-    cd -
+prePatchRun() {
+  echo "Pre patch"
+  for taskFile in ${TASKFILES} ; do
+    run $taskFile pre
   done
-
-  if [ $rc != 0 ] ; then
-JIRA_COMMENT_FOOTER="Findbugs results: $BUILD_URL/findbugsResult
-$JIRA_COMMENT_FOOTER"
-
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 findbugs.  The patch appears to cause Findbugs (version ${findbugs_version}) to fail."
-    return 1
-  fi
-    
-  findbugsWarnings=0
-  for file in $(find $BASEDIR -name findbugsXml.xml)
-  do
-    relative_file=${file#$BASEDIR/} # strip leading $BASEDIR prefix
-    if [ ! $relative_file == "target/munged/findbugsXml.xml" ]; then
-      module_suffix=${relative_file%/target/munged/findbugsXml.xml} # strip trailing path
-      module_suffix=`basename ${module_suffix}`
-    fi
-    
-    cp $file $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
-    $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
-      $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
-      $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
-    newFindbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
\
-      $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml | $AWK '{print $1}'`
-    echo "Found $newFindbugsWarnings Findbugs warnings ($file)"
-    findbugsWarnings=$((findbugsWarnings+newFindbugsWarnings))
-    $FINDBUGS_HOME/bin/convertXmlToText -html \
-      $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml \
-      $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.html
-    if [[ $newFindbugsWarnings > 0 ]] ; then
-      JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/trunk/patchprocess/newPatchFindbugsWarnings${module_suffix}.html
-$JIRA_COMMENT_FOOTER"
-    fi
-  done
-
-  if [[ $findbugsWarnings -gt 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 findbugs.  The patch appears to introduce $findbugsWarnings new Findbugs (version
${findbugs_version}) warnings."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 findbugs.  The patch does not introduce any new Findbugs (version ${findbugs_version})
warnings."
-  return 0
+  echo
 }
-
 ###############################################################################
-### Run the tests
-runTests () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Running ALL tests."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-
-  failed_tests=""
-
-  # Run tests for all of the modules.
-  $MVN test -fn
-  module_failed_tests=`find . -name 'TEST*.xml' | xargs $GREP  -l -E "<failure|<error"
| sed -e "s|.*target/munged/surefire-reports/TEST-|                  |g" | sed -e "s|\.xml||g"`
-  if [[ -n "$module_failed_tests" ]] ; then
-    failed_tests="${failed_tests}
-${module_failed_tests}"
-  fi
-
-#  modules=$(findModules)
-#  for module in $modules;
-#  do
-#    cd $module
-#    echo "  Running tests in $module"
-#    echo "  $MVN test -fn"
-#    $MVN test -fn
-#    module_failed_tests=`find . -name 'TEST*.xml' | xargs $GREP  -l -E "<failure|<error"
| sed -e "s|.*target/munged/surefire-reports/TEST-|                  |g" | sed -e "s|\.xml||g"`
-#    # With -fn mvn always exits with a 0 exit code.  Because of this we need to
-#    # find the errors instead of using the exit code.  We assume that if the build
-#    # failed a -1 is already given for that case
-#    if [[ -n "$module_failed_tests" ]] ; then
-#      failed_tests="${failed_tests}
-#${module_failed_tests}"
-#    fi
-#    cd -
-#  done
-  if [[ -n "$failed_tests" ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 core tests.  The patch failed these unit tests in $modules:
-$failed_tests"
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 core tests.  The patch passed unit tests in $modules."
-  return 0
+postPatchRun() {
+  echo "Post patch"
+  for taskFile in ${TASKFILES} ; do
+    run $taskFile post
+  done
+  echo
 }
-
 ###############################################################################
-# Find the maven module containing the given file.
-findModule (){
- dir=`dirname $1`
- while [ 1 ]
- do
-  if [ -f "$dir/pom.xml" ]
-  then
-    echo $dir
-    return
-  else
-    dir=`dirname $dir`
-  fi
- done
-}
-
-findModules () {
-  # Come up with a list of changed files into $TMP
-  TMP=/tmp/tmp.paths.$$
-  $GREP '^+++\|^---' $PATCH_DIR/patch | cut -c '5-' | $GREP -v /dev/null | sort | uniq >
$TMP
-  
-  # if all of the lines start with a/ or b/, then this is a git patch that
-  # was generated without --no-prefix
-  if ! $GREP -qv '^a/\|^b/' $TMP ; then
-    sed -i -e 's,^[ab]/,,' $TMP
-  fi
-  
-  # Now find all the modules that were changed
-  TMP_MODULES=/tmp/tmp.modules.$$
-  for file in $(cut -f 1 $TMP | sort | uniq); do
-    echo $(findModule $file) >> $TMP_MODULES
-  done
-  rm $TMP
-  
-  # Filter out modules without code 
-  CHANGED_MODULES=""
-  for module in $(cat $TMP_MODULES | sort | uniq); do
-    $GREP "<packaging>pom</packaging>" $module/pom.xml > /dev/null
-    if [ "$?" != 0 ]; then
-      CHANGED_MODULES="$CHANGED_MODULES $module"
-    fi
+createReports() {
+  echo "Reports"
+  for taskFile in ${TASKFILES} ; do
+    run $taskFile report
   done
-  rm $TMP_MODULES
-  echo $CHANGED_MODULES
+  echo
 }
-
 ###############################################################################
-### Submit a comment to the defect's Jira
-submitJiraComment () {
-  local result=$1
-  ### Do not output the value of JIRA_COMMENT_FOOTER when run by a developer
-  if [[  $JENKINS == "false" ]] ; then
-    JIRA_COMMENT_FOOTER=""
-  fi
-  if [[ $result == 0 ]] ; then
-    comment="+1 overall.  $JIRA_COMMENT
 
-$JIRA_COMMENT_FOOTER"
-  else
-    comment="-1 overall.  $JIRA_COMMENT
-
-$JIRA_COMMENT_FOOTER"
-  fi
-  ### Output the test result to the console
-  echo "
+echo
 
+parseArgs "$@"
 
+prepareTestPatchDirs
 
-$comment"  
+echo "" > ${SUMMARYFILE}
 
-  if [[ $JENKINS == "true" ]] ; then
-    echo ""
-    echo ""
-    echo "======================================================================"
-    echo "======================================================================"
-    echo "    Adding comment to Jira."
-    echo "======================================================================"
-    echo "======================================================================"
-    echo ""
-    echo ""
-    ### Update Jira with a comment
-    export USER=hudson
-    $JIRACLI -s https://issues.apache.org/jira -a addcomment -u $JIRA_USER -p $JIRA_PASSWD
--comment "$comment" --issue $defect
-    $JIRACLI -s https://issues.apache.org/jira -a logout -u $JIRA_USER -p $JIRA_PASSWD
-  fi
-}
-
-###############################################################################
-### Cleanup files
-cleanupAndExit () {
-  local result=$1
-  if [[ $JENKINS == "true" ]] ; then
-    if [ -e "$PATCH_DIR" ] ; then
-      mv $PATCH_DIR $BASEDIR
-    fi
+if [ "${PATCHFILE}" == "" ] ; then
+  echo "Testing JIRA ${JIRAISSUE}"
+  echo
+  echo "Testing JIRA ${JIRAISSUE}" >> ${SUMMARYFILE}
+  echo "" >> ${SUMMARYFILE}
+else
+  if [ ! -e ${PATCHFILE} ] ; then
+    echo "Patch file does not exist"
+    cleanupAndExit 1
   fi
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Finished build."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  exit $result
-}
-
-###############################################################################
-###############################################################################
-###############################################################################
-
-JIRA_COMMENT=""
-JIRA_COMMENT_FOOTER="Console output: $BUILD_URL/console
+  echo "Testing patch ${PATCHFILE}"
+  echo
+  echo "Testing patch ${PATCHFILE}" >> ${SUMMARYFILE}
+  echo "" >> ${SUMMARYFILE}
+fi
 
-This message is automatically generated."
+prepareSCM
 
-### Check if arguments to the script have been specified properly or not
-parseArgs $@
-cd $BASEDIR
+echo "" >> ${SUMMARYFILE}
 
-checkout
-RESULT=$?
-if [[ $JENKINS == "true" ]] ; then
-  if [[ $RESULT != 0 ]] ; then
-    exit 100
-  fi
-fi
-downloadPatch
-verifyPatch
-(( RESULT = RESULT + $? ))
-if [[ $RESULT != 0 ]] ; then
-  submitJiraComment 1
-  cleanupAndExit 1
+if [ "${PATCHFILE}" == "" ] ; then
+  downloadPatch ${JIRAISSUE}
 fi
-buildTrunk
-checkAuthor
 
-if [[ $JENKINS == "true" ]] ; then
-  cleanUpXml
-fi
-checkTests
-(( RESULT = RESULT + $? ))
+echo "----------------------------" >> ${SUMMARYFILE}
+echo "" >> ${SUMMARYFILE}
+getAllTasks
+prePatchRun
 applyPatch
-APPLY_PATCH_RET=$?
-(( RESULT = RESULT + $APPLY_PATCH_RET ))
-if [[ $APPLY_PATCH_RET != 0 ]] ; then
-  submitJiraComment 1
-  cleanupAndExit 1
+postPatchRun
+createReports
+echo "" >> ${SUMMARYFILE}
+echo "----------------------------" >> ${SUMMARYFILE}
+MINUSONES=`grep -c "\}\-1" ${SUMMARYFILE}`
+if [[ $MINUSONES == 0 ]]; then
+  echo "{color:green}*+1 Overall result, good!, no -1s*{color}" >> ${SUMMARYFILE}
+else
+  echo "{color:red}*-1 Overall result, please check the reported -1(s)*{color}" >>
${SUMMARYFILE}
 fi
-checkJavacWarnings
-JAVAC_RET=$?
-#2 is returned if the code could not compile
-if [[ $JAVAC_RET == 2 ]] ; then
-  submitJiraComment 1
-  cleanupAndExit 1
+echo "" >> ${SUMMARYFILE}
+WARNINGS=`grep -c "\}WARNING" ${SUMMARYFILE}`
+if [[ $WARNINGS != 0 ]]; then
+  echo "{color:red}.   There is at least one warning, please check{color}" >> ${SUMMARYFILE}
 fi
-(( RESULT = RESULT + $JAVAC_RET ))
-checkJavadocWarnings
-(( RESULT = RESULT + $? ))
-checkStyle
-(( RESULT = RESULT + $? ))
-checkFindbugsWarnings
-(( RESULT = RESULT + $? ))
-checkReleaseAuditWarnings
-(( RESULT = RESULT + $? ))
-buildAndInstall
-### Run tests for Jenkins or if explictly asked for by a developer
-if [[ $JENKINS == "true" || $RUN_TESTS == "true" ]] ; then
-  runTests
-  (( RESULT = RESULT + $? ))
+echo "" >> ${SUMMARYFILE}
+
+if [ ! -z "${JIRAISSUE}" ]; then
+  echo "The full output of the test-patch run is available at"  >> ${SUMMARYFILE}
+  echo ""  >> ${SUMMARYFILE}
+  echo ".   ${BUILD_URL}"  >> ${SUMMARYFILE}
+  echo ""  >> ${SUMMARYFILE}
+else
+  echo
+  echo "Refer to ${REPORTDIR} for detailed test-patch reports"
+  echo
 fi
-JIRA_COMMENT_FOOTER="Test results: $BUILD_URL/testReport/
-$JIRA_COMMENT_FOOTER"
 
-submitJiraComment $RESULT
-cleanupAndExit $RESULT
+cat ${SUMMARYFILE} | sed -e 's/{color}//' -e 's/{color:green}//' -e 's/{color:red}//' -e
's/^\.//' -e 's/^\*//' -e 's/\*$//' > ${SUMMARYFILETXT}
+
+cat ${SUMMARYFILETXT}
+
+grep "^+1 Overall result" ${SUMMARYFILETXT} &> /dev/null
+cleanupAndExit "$?"
\ No newline at end of file


Mime
View raw message