You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by iv...@apache.org on 2012/11/27 10:50:59 UTC

svn commit: r1414044 - in /zookeeper/bookkeeper/trunk: ./ bin/

Author: ivank
Date: Tue Nov 27 09:50:56 2012
New Revision: 1414044

URL: http://svn.apache.org/viewvc?rev=1414044&view=rev
Log:
BOOKKEEPER-471: Add scripts for preCommit testing (ivank)

Added:
    zookeeper/bookkeeper/trunk/bin/
    zookeeper/bookkeeper/trunk/bin/find-new-patch-available-jiras   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-00-clean   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-05-patch-raw-analysis   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-08-rat   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-09-javadoc   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-10-compile   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-11-findbugs   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-20-tests   (with props)
    zookeeper/bookkeeper/trunk/bin/test-patch-30-dist   (with props)
Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/pom.xml

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1414044&r1=1414043&r2=1414044&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Tue Nov 27 09:50:56 2012
@@ -152,6 +152,8 @@ Trunk (unreleased changes)
 
       BOOKKEEPER-467: Allocate ports for testing dynamically (ivank)
 
+      BOOKKEEPER-471: Add scripts for preCommit testing (ivank)
+
       bookkeeper-server:
 
         BOOKKEEPER-328: Bookie DeathWatcher is missing thread name (Rakesh via sijie)

Added: zookeeper/bookkeeper/trunk/bin/find-new-patch-available-jiras
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/find-new-patch-available-jiras?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/find-new-patch-available-jiras (added)
+++ zookeeper/bookkeeper/trunk/bin/find-new-patch-available-jiras Tue Nov 27 09:50:56 2012
@@ -0,0 +1,129 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TEMPDIR=${BASEDIR}/tmp
+
+JIRAAVAILPATCHQUERY="https://issues.apache.org/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+in+%28BOOKKEEPER%29+AND+status+%3D+%22Patch+Available%22+ORDER+BY+updated+DESC&tempMax=1000"
+TESTPATCHJOBURL="https://builds.apache.org/job/bookkeeper-trunk-precommit-build"
+TOKEN=""
+SUBMIT="false"
+DELETEHISTORYFILE="false"
+
+RUNTESTSFILE=${BASEDIR}/TESTED_PATCHES.txt
+
+printUsage() {
+    echo "Usage: $0 <OPTIONS>"
+    echo "          --submit --token=<BOOKKEEPER PRECOMMIT JOB TOKEN>"
+    echo "          [--delete-history-file]"
+    echo "          [--script-debug]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --submit)
+            SUBMIT="true"
+            ;;
+        --token=*)
+            TOKEN=${i#*=}
+            ;;
+        --script-debug)
+            DEBUG="-x"
+            ;;
+        --delete-history-file)
+            DELETEHISTORYFILE="true"
+            ;;
+        *)
+            echo "Invalid option"
+            echo
+            printUsage
+            exit 1
+            ;;
+        esac
+    done
+    if [[ "$SUBMIT" == "true" && "${TOKEN}" == "" ]] ; then
+        echo "Token has not been specified"
+        echo
+        printUsage
+        exit 1
+    fi
+}
+
+###############################################################################
+findAndSubmitAvailablePatches() {
+    ## Grab all the key (issue numbers) and largest attachment id for each item in the XML
+    curl --fail --location --retry 3 "${JIRAAVAILPATCHQUERY}" > ${TEMPDIR}/patch-availables.xml
+    if [ "$?" != "0" ] ; then
+        echo "Could not retrieve available patches from JIRA"
+        exit 1
+    fi
+    xpath -e "//item/key/text() | //item/attachments/attachment[not(../attachment/@id > @id)]/@id" \
+        ${TEMPDIR}/patch-availables.xml > ${TEMPDIR}/patch-attachments.element
+
+    ### Replace newlines with nothing, then replace id=" with =, then replace " with newline
+    ### to yield lines with pairs (issueNumber,largestAttachmentId). Example: BOOKKEEPER-123,456984
+    cat ${TEMPDIR}/patch-attachments.element \
+        | awk '{ if ( $1 ~ /^BOOKKEEPER\-/) {JIRA=$1 }; if ($1 ~ /id=/) { print JIRA","$1} }' \
+        | sed 's/id\="//' | sed 's/"//' > ${TEMPDIR}/patch-availables.pair
+
+    ### Iterate through issue list and find the (issueNumber,largestAttachmentId) pairs that have
+    ### not been tested (ie don't already exist in the patch_tested.txt file
+    touch ${RUNTESTSFILE}
+    cat ${TEMPDIR}/patch-availables.pair | while read PAIR ; do
+        set +e
+        COUNT=`grep -c "$PAIR" ${RUNTESTSFILE}`
+        set -e
+        if [ "$COUNT" -lt "1" ] ; then
+        ### Parse $PAIR into project, issue number, and attachment id
+            ISSUE=`echo $PAIR | sed -e "s/,.*$//"`
+            echo "Found new patch for issue $ISSUE"
+            if [ "$SUBMIT" == "true" ]; then
+            ### Kick off job
+                echo "Submitting job for issue $ISSUE"
+                curl --fail --location --retry 3 \
+                    "${TESTPATCHJOBURL}/buildWithParameters?token=${TOKEN}&JIRA_NUMBER=${ISSUE}" > /dev/null
+                if [ "$?" != "0" ] ; then
+                    echo "Could not submit precommit job for $ISSUE"
+                    exit 1
+                fi
+            fi
+            ### Mark this pair as tested by appending to file
+            echo "$PAIR" >> ${RUNTESTSFILE}
+        fi
+    done
+}
+###############################################################################
+
+mkdir -p ${TEMPDIR} 2>&1 $STDOUT
+
+parseArgs "$@"
+
+if [ -n "${DEBUG}" ] ; then
+    set -x
+fi
+
+if [ "${DELETEHISTORYFILE}" == "true" ] ; then
+    rm ${RUNTESTSFILE}
+fi
+
+findAndSubmitAvailablePatches
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/find-new-patch-available-jiras
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch Tue Nov 27 09:50:56 2012
@@ -0,0 +1,415 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TESTPATCHDIRNAME=test-patch
+TESTPATCHDIR=${BASEDIR}/${TESTPATCHDIRNAME}
+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=""
+JIRAPASSWORD=""
+
+
+VERBOSEOPTION=""
+JIRAISSUE=""
+PATCHFILE=""
+TASKSTORUN=""
+TASKSTOSKIP=""
+RESETSCM="false"
+DIRTYSCM="false"
+STDOUT="/dev/null"
+MVNPASSTHRU=""
+
+###############################################################################
+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 -e $TESTPATCHDIRNAME > /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 -p ${TESTPATCHDIR} 2> /dev/null
+    rm -rf ${REPORTDIR} 2> /dev/null
+    rm -rf ${TEMPDIR} 2> /dev/null
+    mkdir -p ${TOOLSDIR} 2> /dev/null
+    mkdir -p ${TEMPDIR} 2> /dev/null
+    mkdir -p ${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
+    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
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --jira=*)
+            JIRAISSUE=${i#*=}
+            ;;
+        --patch=*)
+            PATCHFILE=${i#*=}
+            ;;
+        --tasks=*)
+            TASKSTORUN=${i#*=}
+            ;;
+        --skip-tasks=*)
+            TASKSTOSKIP=${i#*=}
+            ;;
+        --list-tasks)
+            listTasks
+            cleanupAndExit 0
+            ;;
+        --jira-cli=*)
+            JIRACLI=${i#*=}
+            ;;
+        --jira-user=*)
+            JIRAUSER=${i#*=}
+            ;;
+        --jira-password=*)
+            JIRAPASSWORD=${i#*=}
+            JIRAUPDATE="true"
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        --reset-scm)
+            RESETSCM="true"
+            ;;
+        --dirty-scm)
+            DIRTYSCM="true"
+            ;;
+        --verbose)
+            VERBOSEOPTION="--verbose"
+            STDOUT="/dev/stdout"
+            ;;
+        *)
+            echo "Invalid option"
+            echo
+            printUsage
+            exit 1
+            ;;
+        esac
+    done
+
+    if [[ "${JIRAISSUE}" == "" && "${PATCHFILE}" == "" ]] ; then
+        echo "Either --jira or --patch option must be specified"
+        echo
+        printUsage
+        exit 1
+    fi
+    if [[ "${JIRAISSUE}" != "" && "${PATCHFILE}" != "" ]] ; then
+        echo "Cannot specify --jira or --patch options together"
+        echo
+        printUsage
+        exit 1
+    fi
+    if [[ "${RESETSCM}" == "false" && "${DIRTYSCM}" == "false" ]] ; then
+        echo "Either --reset-scm or --dirty-scm option must be specified"
+        echo
+        printUsage
+        exit 1
+    fi
+    if [[ "${RESETSCM}" == "true" && "${DIRTYSCM}" == "true" ]] ; then
+        echo "Cannot specify --reset-scm and --dirty-scm options together"
+        echo
+        printUsage
+        exit 1
+    fi
+}
+
+###############################################################################
+listTasks() {
+    echo "Available Tasks:"
+    echo ""
+    getAllTasks
+    for taskFile in ${TASKFILES} ; do
+        taskName=`bash $taskFile --taskname`
+        echo "  $taskName"
+    done
+    echo
+}
+###############################################################################
+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
+    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 "Could not download patch for ${JIRAISSUE} from ${patchURL}"
+        echo
+        cleanupAndExit 1
+    fi
+    echo "JIRA ${JIRAISSUE}, patch downloaded at `date` from ${patchURL}" 
+    echo
+    echo "Patch <a href=\"$relativePatchURL\">$relativePatchURL</a> downloaded at $(date)" >> ${SUMMARYFILE}
+    echo "" >> ${SUMMARYFILE}
+}
+###############################################################################
+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
+    patch -f -E -p0 < ${PATCHFILE} > ${REPORTDIR}/APPLY-PATCH.txt
+    if [[ $? != 0 ]] ; then
+        echo "ODD!, dry run passed, but patch failed to apply to head of branch"
+        echo
+        cleanupAndExit 1
+    fi
+    echo "" >> $STDOUT
+    echo "Patch applied"
+    echo "{color:green}+1 PATCH_APPLIES{color}" >> $SUMMARYFILE
+    echo
+}
+###############################################################################
+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
+}
+###############################################################################
+getAllTasks() {
+    TASKFILES=`ls -a bin/test\-patch\-[0-9][0-9]\-*`
+}
+###############################################################################
+prePatchRun() {
+    echo "Pre patch"
+    for taskFile in ${TASKFILES} ; do
+        run $taskFile pre
+    done
+    echo
+}
+###############################################################################
+postPatchRun() {
+    echo "Post patch"
+    for taskFile in ${TASKFILES} ; do
+        run $taskFile post
+    done
+    echo
+}
+###############################################################################
+createReports() {
+    echo "Reports"
+    for taskFile in ${TASKFILES} ; do
+        run $taskFile report
+    done
+    echo
+}
+###############################################################################
+
+echo
+
+parseArgs "$@"
+
+prepareTestPatchDirs
+
+echo "" > ${SUMMARYFILE}
+
+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 "Testing patch ${PATCHFILE}"
+    echo
+    echo "Testing patch ${PATCHFILE}" >> ${SUMMARYFILE}
+    echo "" >> ${SUMMARYFILE}
+fi
+
+prepareSCM
+
+echo "" >> ${SUMMARYFILE}
+
+if [ "${PATCHFILE}" == "" ] ; then
+    downloadPatch ${JIRAISSUE}
+fi
+
+echo "----------------------------" >> ${SUMMARYFILE}
+echo "" >> ${SUMMARYFILE}
+getAllTasks
+prePatchRun
+applyPatch
+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
+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
+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
+
+cat ${SUMMARYFILE} | sed -e 's/{color}//' -e 's/{color:green}//' -e 's/{color:red}//' -e 's/^\.//' -e 's/^\*//' -e 's/\*$//' > ${SUMMARYFILETXT}
+
+cat ${SUMMARYFILETXT}
+
+cleanupAndExit `expr $MINUSONES != 0`

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-00-clean
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-00-clean?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-00-clean (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-00-clean Tue Nov 27 09:50:56 2012
@@ -0,0 +1,98 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="CLEAN"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+MVNPASSTHRU=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR>) [-D<VALUE>...] [-P<VALUE>...]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        esac
+    done
+    if [[ "${OP}" == "" || "${TEMPDIR}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+
+
+parseArgs "$@"
+
+case $OP in
+pre)
+    mvn clean ${MVNPASSTHRU} > ${TEMPDIR}/${TASKNAME}.txt
+    EXITCODE=$?
+    # removing files created by dependency:copy-dependencies
+    rm -f */lib/*
+    exit $EXITCODE
+    ;;
+post)
+    ;;
+report)
+    echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-00-clean
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-05-patch-raw-analysis
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-05-patch-raw-analysis?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-05-patch-raw-analysis (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-05-patch-raw-analysis Tue Nov 27 09:50:56 2012
@@ -0,0 +1,153 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="RAW_PATCH_ANALYSIS"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+PATCHFILE=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR> --reportdir=<REPORT DIR> --summaryfile=<SUMMARY FILE>)"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        --patchfile=*)
+            PATCHFILE=${i#*=}
+            ;;
+        esac
+    done
+    if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" || "${PATCHFILE}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+checkNoAuthors() {
+    authorTags=`grep "^+ " ${PATCHFILE} | grep -c -i -e ".*\*.* @author"`
+    if [[ ${authorTags} != 0 ]] ; then
+        REPORT+=("{color:red}-1{color} the patch seems to contain ${authorTags} line(s) with @author tags")
+    else
+        REPORT+=("{color:green}+1{color} the patch does not introduce any @author tags")
+    fi
+}
+###############################################################################
+checkNoTabs() {
+    tabs=`grep "^+ " ${PATCHFILE} | grep -c -P "\t"`
+    if [[ ${tabs} != 0 ]] ; then
+        REPORT+=("{color:red}-1{color} the patch contains ${tabs} line(s) with tabs")
+    else
+        REPORT+=("{color:green}+1{color} the patch does not introduce any tabs")
+    fi
+}
+###############################################################################
+checkNoTrailingSpaces() {
+    trailingSpaces=`grep "^+ " ${PATCHFILE} | grep -c -e " $"`
+    if [[ ${trailingSpaces} != 0 ]] ; then
+        REPORT+=("{color:red}-1{color} the patch contains ${trailingSpaces} line(s) with trailing spaces")
+    else
+        REPORT+=("{color:green}+1{color} the patch does not introduce any trailing spaces")
+    fi
+}
+###############################################################################
+checkLinesLength() {
+  # We check for > 120 to account for the "+" sign
+    longLines=`grep "^+ " ${PATCHFILE} | awk 'BEGIN{count=0}{if ( length > 121 ) { count=count+1} }END{ print count}'`
+    if [[ ${longLines} != 0 ]] ; then
+        REPORT+=("{color:red}-1{color} the patch contains ${longLines} line(s) longer than 120 characters")
+    else
+        REPORT+=("{color:green}+1{color} the patch does not introduce any line longer than 120")
+    fi
+}
+###############################################################################
+checkForTestcases() {
+    testcases=`grep -c -i -e '^+++.*/test' ${PATCHFILE}`
+    if [[ ${testcases} == 0 ]] ; then
+        REPORT+=("{color:red}-1{color} the patch does not add/modify any testcase")
+    #reverting for summary +1 calculation
+        testcases=1
+    else
+        REPORT+=("{color:green}+1{color} the patch does adds/modifies ${testcases} testcase(s)")
+    #reverting for summary +1 calculation
+        testcases=0
+    fi
+}
+###############################################################################
+
+parseArgs "$@"
+
+case $OP in
+pre)
+    ;;
+post)
+    ;;
+report)
+    REPORT=()
+    checkNoAuthors
+    checkNoTabs
+    checkNoTrailingSpaces
+    checkLinesLength
+    checkForTestcases
+    total=`expr $authorTags + $tabs + $trailingSpaces + $longLines + $testcases`
+    if [[ $total == 0 ]] ; then
+        echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    else
+        echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    fi
+    for line in "${REPORT[@]}" ; do
+        echo ".    ${line}" >> $SUMMARYFILE
+    done
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-05-patch-raw-analysis
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-08-rat
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-08-rat?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-08-rat (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-08-rat Tue Nov 27 09:50:56 2012
@@ -0,0 +1,125 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="RAT"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+STDOUT="/dev/null"
+MVNPASSTHRU=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR> --reportdir=<REPORT DIR> --summaryfile=<SUMMARY FILE>) [-D<VALUE>...] [-P<VALUE>...]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        --verbose)
+            STDOUT="/dev/stdout"
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        esac
+    done
+    if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+checkForWarnings() {
+    cleanWarns=`grep -c '\!?????' ${REPORTDIR}/${TASKNAME}-clean.txt`
+    patchWarns=`grep -c '\!?????' ${REPORTDIR}/${TASKNAME}-patch.txt`
+    newWarns=`expr $patchWarns - $cleanWarns`
+    if [[ $newWarns -le 0 ]] ; then
+        REPORT+=("{color:green}+1{color} the patch does not seem to introduce new RAT warnings")
+        newWarns=0
+    else
+        REPORT+=("{color:red}-1{color} the patch seems to introduce $newWarns new RAT warning(s)")
+        newWarns=1
+    fi
+    if [[ $cleanWarns != 0 ]] ; then
+        REPORT+=("{color:red}WARNING: the current HEAD has $cleanWarns RAT warning(s), they should be addressed ASAP{color}")
+    fi
+}
+###############################################################################
+
+
+parseArgs "$@"
+
+case $OP in
+pre)
+    mvn apache-rat:check ${MVNPASSTHRU} > $STDOUT
+    cp target/rat.txt ${REPORTDIR}/${TASKNAME}-clean.txt
+    ;;
+post)
+    mvn apache-rat:check ${MVNPASSTHRU} > $STDOUT
+    cp target/rat.txt ${REPORTDIR}/${TASKNAME}-patch.txt
+    ;;
+report)
+    checkForWarnings
+    if [[ $newWarns == 0 ]] ; then
+        echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    else
+        echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    fi
+    for line in "${REPORT[@]}" ; do
+        echo ".    ${line}" >> $SUMMARYFILE
+    done
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-08-rat
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-09-javadoc
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-09-javadoc?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-09-javadoc (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-09-javadoc Tue Nov 27 09:50:56 2012
@@ -0,0 +1,118 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="JAVADOC"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+MVNPASSTHRU=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR> --reportdir=<REPORT DIR> --summaryfile=<SUMMARY FILE>) [-D<VALUE>...] [-P<VALUE>...]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        esac
+    done
+    if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+checkForWarnings() {
+    cleanWarns=`grep '\[WARNING\]' ${REPORTDIR}/${TASKNAME}-clean.txt | awk '/Javadoc Warnings/,EOF' | grep warning | awk 'BEGIN {total = 0} {total += 1} END {print total}'`
+    patchWarns=`grep '\[WARNING\]' ${REPORTDIR}/${TASKNAME}-patch.txt | awk '/Javadoc Warnings/,EOF' | grep warning | awk 'BEGIN {total = 0} {total += 1} END {print total}'`
+    newWarns=`expr $patchWarns - $cleanWarns`
+    if [[ $newWarns -le 0 ]] ; then
+        REPORT+=("{color:green}+1{color} the patch does not seem to introduce new Javadoc warnings")
+        newWarns=0
+    else
+        REPORT+=("{color:red}-1{color} the patch seems to introduce $newWarns new Javadoc warning(s)")
+        newWarns=1
+    fi
+    if [[ $cleanWarns != 0 ]] ; then
+        REPORT+=("{color:red}WARNING{color}: the current HEAD has $cleanWarns Javadoc warning(s)")
+    fi
+}
+###############################################################################
+
+parseArgs "$@"
+
+case $OP in
+pre)
+    mvn clean javadoc:aggregate ${MVNPASSTHRU} > ${REPORTDIR}/${TASKNAME}-clean.txt
+    ;;
+post)
+    mvn clean javadoc:aggregate ${MVNPASSTHRU} > ${REPORTDIR}/${TASKNAME}-patch.txt
+    ;;
+report)
+    checkForWarnings
+    if [[ $newWarns == 0 ]] ; then
+        echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    else
+        echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    fi
+    for line in "${REPORT[@]}" ; do
+        echo ".    ${line}" >> $SUMMARYFILE
+    done
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-09-javadoc
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-10-compile
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-10-compile?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-10-compile (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-10-compile Tue Nov 27 09:50:56 2012
@@ -0,0 +1,144 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="COMPILE"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+STDOUT="/dev/null"
+MVNPASSTHRU=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR> --reportdir=<REPORT DIR> --summaryfile=<SUMMARY FILE>) [--verbose] [-D<VALUE>...] [-P<VALUE>...]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        --verbose)
+            STDOUT="/dev/stdout"
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        esac
+    done
+    if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+checkForWarnings() {
+    grep '\[WARNING\]' ${REPORTDIR}/${TASKNAME}-clean.txt > ${TEMPDIR}/${TASKNAME}-javacwarns-clean.txt
+    grep '\[WARNING\]' ${REPORTDIR}/${TASKNAME}-patch.txt > ${TEMPDIR}/${TASKNAME}-javacwarns-patch.txt
+    cleanWarns=`cat ${TEMPDIR}/${TASKNAME}-javacwarns-clean.txt | awk 'BEGIN {total = 0} {total += 1} END {print total}'`
+    patchWarns=`cat ${TEMPDIR}/${TASKNAME}-javacwarns-patch.txt | awk 'BEGIN {total = 0} {total += 1} END {print total}'`
+    newWarns=`expr $patchWarns - $cleanWarns`
+    if [[ $newWarns -le 0 ]] ; then
+        REPORT+=("{color:green}+1{color} the patch does not seem to introduce new javac warnings")
+        newWarns=0
+    else
+        REPORT+=("{color:red}-1{color} the patch seems to introduce $newWarns new javac warning(s)")
+        newWarns=1
+    fi
+    if [[ $cleanWarns != 0 ]] ; then
+        REPORT+=("{color:red}WARNING{color}: the current HEAD has $cleanWarns javac warning(s)")
+    fi
+}
+###############################################################################
+
+
+parseArgs "$@"
+
+case $OP in
+pre)
+    mvn clean package -DskipTests ${MVNPASSTHRU} | tee ${REPORTDIR}/${TASKNAME}-clean.txt >> $STDOUT
+    if [[ ${PIPESTATUS[0]} == 0 ]] ; then
+        echo "{color:green}+1{color} HEAD compiles" >> ${TEMPDIR}/${TASKNAME}-compile.txt
+    else
+        echo "{color:red}-1{color} HEAD does not compile" >> ${TEMPDIR}/${TASKNAME}-compile.txt
+    fi
+    ;;
+post)
+    mvn clean package -DskipTests ${MVNPASSTHRU} | tee ${REPORTDIR}/${TASKNAME}-patch.txt >> $STDOUT
+    if [[ ${PIPESTATUS[0]} == 0 ]] ; then
+        echo "{color:green}+1{color} patch compiles" >> ${TEMPDIR}/${TASKNAME}-compile.txt
+    else
+        echo "{color:red}-1{color} patch does not compile" >> ${TEMPDIR}/${TASKNAME}-compile.txt
+    fi
+    ;;
+report)
+    REPORT=()
+    compileErrors=0
+    while read line; do
+        REPORT+=("$line")
+        if [[ "$line" =~ "-1" ]] ; then
+            compileErrors=1
+        fi
+    done < ${TEMPDIR}/${TASKNAME}-compile.txt
+    checkForWarnings
+    total=`expr $compileErrors + $newWarns`
+    if [[ $total == 0 ]] ; then
+        echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    else
+        echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    fi
+    for line in "${REPORT[@]}" ; do
+        echo ".    ${line}" >> $SUMMARYFILE
+    done
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-10-compile
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-11-findbugs
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-11-findbugs?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-11-findbugs (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-11-findbugs Tue Nov 27 09:50:56 2012
@@ -0,0 +1,156 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="FINDBUGS"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+STDOUT="/dev/null"
+MVNPASSTHRU=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR> --reportdir=<REPORT DIR> --summaryfile=<SUMMARY FILE>) [-D<VALUE>...] [-P<VALUE>...]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        --verbose)
+            STDOUT="/dev/stdout"
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        esac
+    done
+    if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+checkForWarnings() {
+    cleanBugs=0
+    patchBugs=0
+    for m in $(getModules); do
+        MODNAME=$(echo $m | sed 's/\///')
+
+        m_cleanBugs=$(cat ${REPORTDIR}/${TASKNAME}-${MODNAME}-clean.xml \
+            | sed 's/<\/BugInstance>/<\/BugInstance>\n/g' | grep BugInstance | wc -l)
+        m_patchBugs=$(cat ${REPORTDIR}/${TASKNAME}-${MODNAME}-patch.xml \
+            | sed 's/<\/BugInstance>/<\/BugInstance>\n/g' | grep BugInstance | wc -l)
+        m_newBugs=`expr $m_patchBugs - $m_cleanBugs`
+        if [[ $m_newBugs != 0 ]] ; then
+            BUGMODULES="$MODNAME $BUGMODULES"
+        fi
+
+        cleanBugs=$(($cleanBugs+$m_cleanBugs))
+        patchBugs=$(($patchBugs+$m_patchBugs))
+    done
+
+    BUGMODULES=$(echo $BUGMODULES | sed 's/^ *//' | sed 's/ *$//')
+    newBugs=`expr $patchBugs - $cleanBugs`
+    if [[ $newBugs -le 0 ]] ; then
+        REPORT+=("{color:green}+1{color} the patch does not seem to introduce new Findbugs warnings")
+        newBugs=0
+    else
+        REPORT+=("{color:red}-1{color} the patch seems to introduce $patchBugs new Findbugs warning(s) in module(s) [$BUGMODULES]")
+        newBugs=1
+    fi
+    if [[ $cleanBugs != 0 ]] ; then
+        REPORT+=("{color:red}WARNING: the current HEAD has $cleanWarns Findbugs warning(s), they should be addressed ASAP{color}")
+    fi
+}
+
+###############################################################################
+
+getModules() {
+    find . -name pom.xml | sed 's/^.\///' | sed 's/pom.xml$//' | grep -v compat
+}
+###############################################################################
+
+copyFindbugsXml() {
+    TAG=$1
+    for m in $(getModules); do
+        MODNAME=$(echo $m | sed 's/\///')
+        cp ${m}target/findbugsXml.xml ${REPORTDIR}/${TASKNAME}-${MODNAME}-$TAG.xml
+    done
+}
+
+parseArgs "$@"
+
+
+case $OP in
+pre)
+    mvn findbugs:findbugs ${MVNPASSTHRU} > $STDOUT
+    copyFindbugsXml clean
+    ;;
+post)
+    mvn findbugs:findbugs ${MVNPASSTHRU} > $STDOUT
+    copyFindbugsXml patch
+    ;;
+report)
+    checkForWarnings
+    if [[ $newBugs == 0 ]] ; then
+        echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    else
+        echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+    fi
+    for line in "${REPORT[@]}" ; do
+        echo ".    ${line}" >> $SUMMARYFILE
+    done
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-11-findbugs
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-20-tests
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-20-tests?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-20-tests (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-20-tests Tue Nov 27 09:50:56 2012
@@ -0,0 +1,125 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="TESTS"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+STDOUT="/dev/null"
+MVNPASSTHRU=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR> --reportdir=<REPORT DIR> --summaryfile=<SUMMARY FILE>) [--verbose] [-D<VALUE>...] [-P<VALUE>...]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        --verbose)
+            STDOUT="/dev/stdout"
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        esac
+    done
+    if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+
+parseArgs "$@"
+
+case $OP in
+pre)
+    ;;
+post)
+    # must use package instead of test so that compat-deps shaded jars are correct
+    mvn package ${MVNPASSTHRU} -Dmaven.test.failure.ignore=true \
+        -Dmaven.test.error.ignore=true -fae \
+        -Dtest.timeout=7200 | tee ${TEMPDIR}/${TASKNAME}.out >> $STDOUT
+    exitCode=${PIPESTATUS[0]}
+    echo "$exitCode" >  ${TEMPDIR}/${TASKNAME}.exitCode
+    ;;
+report)
+    failedTests=` find . -name '*\.txt' | grep target/surefire-reports | xargs grep  "<<< FAILURE" | grep -v "Tests run:" | sed 's/.*\.txt\://' | sed 's/ .*//'`
+    testsRun=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $3}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print count}'`
+    testsFailed=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $5}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print count}'`
+    testsErrors=`grep "Tests run:" ${TEMPDIR}/${TASKNAME}.out | grep -v " Time elapsed:" | awk '{print $7}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print count}'`
+    hasFailures=`expr $testsFailed + $testsErrors`
+    testsExitCode=`cat ${TEMPDIR}/${TASKNAME}.exitCode`
+    if [[ $hasFailures != 0 ]] ; then
+        echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+        echo ".    Tests run: $testsRun" >> $SUMMARYFILE
+        echo ".    Tests failed: $testsFailed" >> $SUMMARYFILE
+        echo ".    Tests errors: $testsErrors" >> $SUMMARYFILE
+        echo "" >> ${SUMMARYFILE}
+        echo ".    The patch failed the following testcases:" >> $SUMMARYFILE
+        echo "" >> ${SUMMARYFILE}
+        echo "${failedTests}" | sed 's/^/.      /' >> $SUMMARYFILE
+        echo "" >> ${SUMMARYFILE}
+    else
+        if [[ "$testsExitCode" != "0" ]] ; then
+            echo "{color:red}-1 ${TASKNAME}{color} - patch does not compile, cannot run testcases" >> $SUMMARYFILE
+        else
+            echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+            echo ".    Tests run: $testsRun" >> $SUMMARYFILE
+        fi
+    fi
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-20-tests
------------------------------------------------------------------------------
    svn:executable = *

Added: zookeeper/bookkeeper/trunk/bin/test-patch-30-dist
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bin/test-patch-30-dist?rev=1414044&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bin/test-patch-30-dist (added)
+++ zookeeper/bookkeeper/trunk/bin/test-patch-30-dist Tue Nov 27 09:50:56 2012
@@ -0,0 +1,106 @@
+#!/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
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+    set -x
+fi
+
+BASEDIR=$(pwd)
+TASKNAME="DISTRO"
+OP=""
+TEMPDIR=""
+REPORTDIR=""
+SUMMARYFILE=""
+STDOUT="/dev/null"
+MVNPASSTHRU=""
+
+###############################################################################
+cleanupAndExit() {
+    exit $1
+}
+###############################################################################
+printUsage() {
+    echo "Usage: $0 --taskname | (--op=pre|post|report --tempdir=<TEMP DIR> --reportdir=<REPORT DIR> --summaryfile=<SUMMARY FILE>) [--verbose] [-D<VALUE>...] [-P<VALUE>...]"
+    echo
+}
+###############################################################################
+parseArgs() {
+    for i in $*
+    do
+        case $i in
+        --taskname)
+            echo ${TASKNAME}
+            exit 0
+            ;;
+        --op=*)
+            OP=${i#*=}
+            ;;
+        --tempdir=*)
+            TEMPDIR=${i#*=}
+            ;;
+        --reportdir=*)
+            REPORTDIR=${i#*=}
+            ;;
+        --summaryfile=*)
+            SUMMARYFILE=${i#*=}
+            ;;
+        --verbose)
+            STDOUT="/dev/stdout"
+            ;;
+        -D*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        -P*)
+            MVNPASSTHRU="${MVNPASSTHRU} $i"
+            ;;
+        esac
+    done
+    if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" ]] ; then
+        echo "Missing options"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+    if [[ "${OP}" != "pre" && "${OP}" != "post" && "${OP}" != "report" ]] ; then
+        echo "Invalid operation"
+        echo
+        printUsage
+        cleanupAndExit 1
+    fi
+}
+###############################################################################
+
+parseArgs "$@"
+
+case $OP in
+pre)
+    ;;
+post)
+    mvn package assembly:single -DskipTests | tee ${REPORTDIR}/${TASKNAME}.out >> $STDOUT
+    exitCode=${PIPESTATUS[0]}
+    echo "$exitCode" >  ${TEMPDIR}/${TASKNAME}.exitCode
+    ;;
+report)
+    exitCode=`cat ${TEMPDIR}/${TASKNAME}.exitCode`
+    if [[ "$exitCode" != "0" ]] ; then
+        echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+        echo ".    {color:red}-1{color} distro tarball fails with the patch" >> $SUMMARYFILE
+    else
+        echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+        echo ".    {color:green}+1{color} distro tarball builds with the patch " >> $SUMMARYFILE
+    fi
+    ;;
+esac
+
+exit 0

Propchange: zookeeper/bookkeeper/trunk/bin/test-patch-30-dist
------------------------------------------------------------------------------
    svn:executable = *

Modified: zookeeper/bookkeeper/trunk/pom.xml
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/pom.xml?rev=1414044&r1=1414043&r2=1414044&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/pom.xml (original)
+++ zookeeper/bookkeeper/trunk/pom.xml Tue Nov 27 09:50:56 2012
@@ -115,6 +115,7 @@
             <exclude>CHANGES.txt</exclude>
             <exclude>**/README</exclude>
             <exclude>**/apidocs/*</exclude>
+	    <exclude>test-patch/**/*</exclude>
           </excludes>
         </configuration>
       </plugin>