You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by tu...@apache.org on 2012/08/22 20:27:46 UTC

svn commit: r1376180 - /incubator/oozie/trunk/bin/

Author: tucu
Date: Wed Aug 22 18:27:45 2012
New Revision: 1376180

URL: http://svn.apache.org/viewvc?rev=1376180&view=rev
Log:
Improvements to test-patch script (tucu)

Added:
    incubator/oozie/trunk/bin/test-patch-09-javadoc   (with props)
    incubator/oozie/trunk/bin/test-patch-15-backwards-compatibility   (with props)
    incubator/oozie/trunk/bin/test-patch-30-distro   (with props)
Modified:
    incubator/oozie/trunk/bin/test-patch
    incubator/oozie/trunk/bin/test-patch-00-clean
    incubator/oozie/trunk/bin/test-patch-05-patch-raw-analysis
    incubator/oozie/trunk/bin/test-patch-08-rat
    incubator/oozie/trunk/bin/test-patch-10-compile
    incubator/oozie/trunk/bin/test-patch-20-tests
    incubator/oozie/trunk/bin/test-patch-XX-template
    incubator/oozie/trunk/bin/test-patch-find-new-patch-available-jiras

Modified: incubator/oozie/trunk/bin/test-patch
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch (original)
+++ incubator/oozie/trunk/bin/test-patch Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+  set -x
+fi
+
 BASEDIR=$(pwd)
 TESTPATCHDIR=${BASEDIR}/test-patch
 TOOLSDIR=${TESTPATCHDIR}/tools
@@ -34,56 +38,74 @@ JIRAISSUE=""
 PATCHFILE=""
 TASKSTORUN=""
 TASKSTOSKIP=""
-VCSCLEANUP="true"
+RESETSCM="false"
+DIRTYSCM="false"
 STDOUT="/dev/null"
 MVNPASSTHRU=""
 
 ###############################################################################
-testPatchPrepare() {
-  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
-}
-###############################################################################
-vcsCleanup() {
-  vcsCleaned=false
+gitOrSvn() {
+  SCM="NONE"
   which git &> /dev/null
   if [[ $? == 0 ]] ; then
     git status &> /dev/null
     if [[ $? == 0 ]] ; then
-      git reset --hard HEAD > /dev/null
-      git clean -f -d > /dev/null
-      vcsCleaned=true
+      SCM="git"
     fi
   fi
-  if [ "$vcsCleaned" != "true" ] ; then
+  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
-        vcsCleaned=true
       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
-  if [ "${vcsCleaned}" = "false" ] ; then
-    echo
-    echo "WARNING: Current directory, it is not under a source control system"
-    echo
+}
+###############################################################################
+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 [ -z "$JIRACLI" ] ; then
+    if [[ "$JIRACLI" != "" && "$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
@@ -97,10 +119,14 @@ updateJira() {
         (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
-    echo "Adding comment to JIRA"
-    comment=`cat ${SUMMARYFILE}`
-    $JIRACLI -s $JIRAURL -a addcomment -u $JIRAUSER -p "$JIRAPASSWORD" --comment "$comment" --issue $JIRAISSUE
   fi
 }
 ###############################################################################
@@ -112,6 +138,7 @@ cleanupAndExit() {
 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>]"
@@ -120,7 +147,6 @@ printUsage() {
   echo "          [-D<MVN PROPERTY>...]"
   echo "          [-P<MVN PROFILE>...]"
   echo "          [--list-tasks]"
-  echo "          [--no-cleanup]"
   echo "          [--verbose]"
   echo
 }
@@ -161,8 +187,11 @@ parseArgs() {
     -P*)
       MVNPASSTHRU="${MVNPASSTHRU} $i"
       ;;
-    --no-cleanup)
-      VCSCLEANUP=false
+    --reset-scm)
+      RESETSCM="true"
+      ;;
+    --dirty-scm)
+      DIRTYSCM="true"
       ;;
     --verbose)
       VERBOSEOPTION="--verbose"
@@ -172,15 +201,33 @@ parseArgs() {
       echo "Invalid option"
       echo
       printUsage
-      cleanupAndExit 1
+      exit 1
       ;;
     esac
   done
-  if [ "${JIRAISSUE}${PATCHFILE}" == "" ] ; then
-    echo "Either --jira or --patch options must be specified"
+  if [[ "${JIRAISSUE}" == "" && "${PATCHFILE}" == "" ]] ; then
+    echo "Either --jira or --patch option must be specified"
     echo
     printUsage
-    cleanupAndExit 1
+    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
 }
 ###############################################################################
@@ -245,7 +292,7 @@ run() {
   task=`bash $1 --taskname`
   if [[ "${TASKSTORUN}" == "" || "${TASKSTORUN}" =~ "${task}" ]] ; then
     if [[ ! "${TASKSTOSKIP}" =~ "${task}" ]] ; then
-      echo "  Running test task ${task}"
+      echo "  Running test-patch task ${task}"
       outputFile="`basename $1`-$2.out"
       $1 --op=$2 --tempdir=${TEMPDIR} --reportdir=${REPORTDIR} \
          --summaryfile=${SUMMARYFILE} --patchfile=${PATCHFILE} ${MVNPASSTHRU} \
@@ -292,17 +339,18 @@ echo
 
 parseArgs "$@"
 
-if [ "${VCSCLEANUP}" == "true" ] ; then
-  vcsCleanup
-fi
+prepareTestPatchDirs
 
-testPatchPrepare
+echo "" > ${SUMMARYFILE}
+
+prepareSCM
+
+echo "" >> ${SUMMARYFILE}
 
 if [ "${PATCHFILE}" == "" ] ; then
   downloadPatch ${JIRAISSUE}
   echo "Testing JIRA ${JIRAISSUE}"
   echo
-  echo "" > ${SUMMARYFILE}
   echo "Testing JIRA ${JIRAISSUE}" >> ${SUMMARYFILE}
   echo "" >> ${SUMMARYFILE}
 else
@@ -312,7 +360,6 @@ else
   fi
   echo "Testing patch ${PATCHFILE}"
   echo
-  echo "" > ${SUMMARYFILE}
   echo "Testing patch ${PATCHFILE}" >> ${SUMMARYFILE}
   echo "" >> ${SUMMARYFILE}
 fi

Modified: incubator/oozie/trunk/bin/test-patch-00-clean
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-00-clean?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-00-clean (original)
+++ incubator/oozie/trunk/bin/test-patch-00-clean Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   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=""

Modified: incubator/oozie/trunk/bin/test-patch-05-patch-raw-analysis
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-05-patch-raw-analysis?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-05-patch-raw-analysis (original)
+++ incubator/oozie/trunk/bin/test-patch-05-patch-raw-analysis Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   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=""
@@ -53,12 +57,6 @@ parseArgs() {
     --patchfile=*)
       PATCHFILE=${i#*=}
       ;;
-    *)
-      echo "Invalid option"
-      echo
-      printUsage
-      cleanupAndExit 1
-      ;;
     esac
   done
   if [[ "${TASKNAME}" == "" || "${OP}" == "" || "${TEMPDIR}" == "" || "${REPORTDIR}" == "" || "${SUMMARYFILE}" == "" || "${PATCHFILE}" == "" ]] ; then
@@ -78,47 +76,47 @@ parseArgs() {
 checkNoAuthors() {
   authorTags=`grep "^+ " ${PATCHFILE} | grep -c -i -e ".*\*.* @author"`
   if [[ ${authorTags} != 0 ]] ; then
-    RAW_REPORT+=("-1 the patch seems to contain ${authorTags} line(s) with @author tags")
+    REPORT+=("-1 the patch seems to contain ${authorTags} line(s) with @author tags")
   else
-    RAW_REPORT+=("+1 the patch does not introduce any @author tags")
+    REPORT+=("+1 the patch does not introduce any @author tags")
   fi
 }
 ###############################################################################
 checkNoTabs() {
   tabs=`grep "^+ " ${PATCHFILE} | grep -c -P "\t"`
   if [[ ${tabs} != 0 ]] ; then
-    RAW_REPORT+=("-1 the patch contains ${tabs} line(s) with tabs")
+    REPORT+=("-1 the patch contains ${tabs} line(s) with tabs")
   else
-    RAW_REPORT+=("+1 the patch does not introduce any tabs")
+    REPORT+=("+1 the patch does not introduce any tabs")
   fi
 }
 ###############################################################################
 checkNoTrailingSpaces() {
   trailingSpaces=`grep "^+ " ${PATCHFILE} | grep -c -e " $"`
   if [[ ${trailingSpaces} != 0 ]] ; then
-    RAW_REPORT+=("-1 the patch contains ${trailingSpaces} line(s) with trailing spaces")
+    REPORT+=("-1 the patch contains ${trailingSpaces} line(s) with trailing spaces")
   else
-    RAW_REPORT+=("+1 the patch does not introduce any trailing spaces")
+    REPORT+=("+1 the patch does not introduce any trailing spaces")
   fi
 }
 ###############################################################################
 checkLinesLength() {
   longLines=`grep "^+ " ${PATCHFILE} | awk 'BEGIN{count=0}{if ( length > 132 ) { count=count+1} }END{ print count}'`
   if [[ ${longLines} != 0 ]] ; then
-    RAW_REPORT+=("-1 the patch contains ${longLines} line(s) longer than 132 characters")
+    REPORT+=("-1 the patch contains ${longLines} line(s) longer than 132 characters")
   else
-    RAW_REPORT+=("+1 the patch does not introduce any line longer than 132")
+    REPORT+=("+1 the patch does not introduce any line longer than 132")
   fi
 }
 ###############################################################################
 checkForTestcases() {
   testcases=`grep -c -i -e '^+++.*/test' ${PATCHFILE}`
   if [[ ${testcases} == 0 ]] ; then
-    RAW_REPORT+=("-1 the patch does not add/modify any testcase")
+    REPORT+=("-1 the patch does not add/modify any testcase")
     #reverting for summary +1 calculation
     testcases=1
   else
-    RAW_REPORT+=("+1 the patch does adds/modifies ${testcases} testcase(s)")
+    REPORT+=("+1 the patch does adds/modifies ${testcases} testcase(s)")
     #reverting for summary +1 calculation
     testcases=0
   fi
@@ -133,7 +131,7 @@ case $OP in
   post)
     ;;
   report)
-    RAW_REPORT=()
+    REPORT=()
     checkNoAuthors
     checkNoTabs
     checkNoTrailingSpaces
@@ -145,7 +143,7 @@ case $OP in
     else
       echo "-1 ${TASKNAME}" >> $SUMMARYFILE
     fi
-    for line in "${RAW_REPORT[@]}" ; do
+    for line in "${REPORT[@]}" ; do
       echo "    ${line}" >> $SUMMARYFILE
     done
     ;;

Modified: incubator/oozie/trunk/bin/test-patch-08-rat
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-08-rat?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-08-rat (original)
+++ incubator/oozie/trunk/bin/test-patch-08-rat Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   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=""
@@ -73,18 +77,18 @@ parseArgs() {
 }
 ###############################################################################
 checkForWarnings() {
-  cleanWarns=`grep -c '\!?????' ${TEMPDIR}/${TASKNAME}-ratwarns-clean.txt`
-  patchWarns=`grep -c '\!?????' ${TEMPDIR}/${TASKNAME}-ratwarns-patch.txt`
+  cleanWarns=`grep -c '\!?????' ${REPORTDIR}/${TASKNAME}-clean.txt`
+  patchWarns=`grep -c '\!?????' ${REPORTDIR}/${TASKNAME}-patch.txt`
   newWarns=`expr $patchWarns - $cleanWarns`
   if [[ $newWarns -le 0 ]] ; then
-    RAW_REPORT+=("+1 the patch does not seem to introduce new RAT warnings")
+    REPORT+=("+1 the patch does not seem to introduce new RAT warnings")
     newWarns=0
   else
-    RAW_REPORT+=("-1 the patch seems to introduce $newWarns new RAT warning(s)")
+    REPORT+=("-1 the patch seems to introduce $newWarns new RAT warning(s)")
     newWarns=1
   fi
   if [[ $cleanWarns != 0 ]] ; then
-    RAW_REPORT+=("WARNING: the current HEAD has $cleanWarns RAT warning(s), they should be addressed ASAP")
+    REPORT+=("WARNING: the current HEAD has $cleanWarns RAT warning(s), they should be addressed ASAP")
   fi
 }
 ###############################################################################
@@ -94,10 +98,10 @@ parseArgs "$@"
 
 case $OP in
   pre)
-    mvn apache-rat:check ${MVNPASSTHRU} > ${TEMPDIR}/${TASKNAME}-ratwarns-clean.txt
+    mvn apache-rat:check ${MVNPASSTHRU} > ${REPORTDIR}/${TASKNAME}-clean.txt
     ;;
   post)
-    mvn apache-rat:check ${MVNPASSTHRU} > ${TEMPDIR}/${TASKNAME}-ratwarns-patch.txt
+    mvn apache-rat:check ${MVNPASSTHRU} > ${REPORTDIR}/${TASKNAME}-patch.txt
     ;;
   report)
     checkForWarnings
@@ -106,7 +110,7 @@ case $OP in
     else
       echo "-1 ${TASKNAME}" >> $SUMMARYFILE
     fi
-    for line in "${RAW_REPORT[@]}" ; do
+    for line in "${REPORT[@]}" ; do
       echo "    ${line}" >> $SUMMARYFILE
     done
     ;;

Added: incubator/oozie/trunk/bin/test-patch-09-javadoc
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-09-javadoc?rev=1376180&view=auto
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-09-javadoc (added)
+++ incubator/oozie/trunk/bin/test-patch-09-javadoc Wed Aug 22 18:27:45 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+=("+1 the patch does not seem to introduce new Javadoc warnings")
+    newWarns=0
+  else
+    REPORT+=("-1 the patch seems to introduce $newWarns new Javadoc warning(s)")
+    newWarns=1
+  fi
+  if [[ $cleanWarns != 0 ]] ; then
+    REPORT+=("WARNING: the current HEAD has $cleanWarns Javadoc warning(s)")
+  fi
+}
+###############################################################################
+
+parseArgs "$@"
+
+case $OP in
+  pre)
+    mvn clean javadoc:javadoc ${MVNPASSTHRU} > ${REPORTDIR}/${TASKNAME}-clean.txt
+    ;;
+  post)
+    mvn clean javadoc:javadoc ${MVNPASSTHRU} > ${REPORTDIR}/${TASKNAME}-patch.txt
+    ;;
+  report)
+    checkForWarnings
+    if [[ $newWarns == 0 ]] ; then
+      echo "+1 ${TASKNAME}" >> $SUMMARYFILE
+    else
+      echo "-1 ${TASKNAME}" >> $SUMMARYFILE
+    fi
+    for line in "${REPORT[@]}" ; do
+      echo "    ${line}" >> $SUMMARYFILE
+    done
+    ;;
+esac
+
+exit 0

Propchange: incubator/oozie/trunk/bin/test-patch-09-javadoc
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/oozie/trunk/bin/test-patch-10-compile
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-10-compile?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-10-compile (original)
+++ incubator/oozie/trunk/bin/test-patch-10-compile Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   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=""
@@ -83,10 +87,10 @@ checkForWarnings() {
   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
-    RAW_REPORT+=("+1 the patch does not seem to introduce new javac warnings")
+    REPORT+=("+1 the patch does not seem to introduce new javac warnings")
     newWarns=0
   else
-    RAW_REPORT+=("-1 the patch seems to introduce $newWarns new javac warning(s)")
+    REPORT+=("-1 the patch seems to introduce $newWarns new javac warning(s)")
     newWarns=1
   fi
 }
@@ -113,10 +117,10 @@ case $OP in
     fi
     ;;
   report)
-    RAW_REPORT=()
+    REPORT=()
     compileErrors=0
     while read line; do
-      RAW_REPORT+=("$line")
+      REPORT+=("$line")
       if [[ "$line" =~ "-1" ]] ; then
         compileErrors=1
       fi
@@ -128,7 +132,7 @@ case $OP in
     else
       echo "-1 ${TASKNAME}" >> $SUMMARYFILE
     fi
-    for line in "${RAW_REPORT[@]}" ; do
+    for line in "${REPORT[@]}" ; do
       echo "    ${line}" >> $SUMMARYFILE
     done
     ;;

Added: incubator/oozie/trunk/bin/test-patch-15-backwards-compatibility
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-15-backwards-compatibility?rev=1376180&view=auto
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-15-backwards-compatibility (added)
+++ incubator/oozie/trunk/bin/test-patch-15-backwards-compatibility Wed Aug 22 18:27:45 2012
@@ -0,0 +1,120 @@
+#!/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="BACKWARDS_COMPATIBILITY"
+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
+}
+###############################################################################
+checkJPAAnnotations() {
+  annotations=`grep -c -E "^(\+|\-).*(@Column|@Lob|@Basic|@Entity|@Transient)" ${PATCHFILE}`
+  if [[ ${annotations} != 0 ]] ; then
+    REPORT+=("-1 the patch seems to change ${annotations} line(s) with JPA Entity/Colum/Basic/Lob/Transient annotations")
+  else
+    REPORT+=("+1 the patch does not change any JPA Entity/Colum/Basic/Lob/Transient annotations")
+  fi
+}
+###############################################################################
+checkJPAFiles() {
+  persistenceXml=`grep -c -i -E '^\+\+\+.*/persistence.xml' ${PATCHFILE}`
+  ormXml=`grep -c -i -E '^\+\+\+.*/*-orm.xml' ${PATCHFILE}`
+  jpaFiles=`expr $persistenceXml + $ormXml`
+  if [[ ${jpaFiles} != 0 ]] ; then
+    REPORT+=("-1 the patch modifies ${jpaFiles} JPA file(s), persistence.xml or *-orm.xml")
+  else
+    REPORT+=("+1 the patch does not modify JPA files")
+  fi
+}
+###############################################################################
+
+parseArgs "$@"
+
+case $OP in
+  pre)
+    ;;
+  post)
+    ;;
+  report)
+    REPORT=()
+    checkJPAAnnotations
+    checkJPAFiles
+    total=`expr $annotations + $jpaFiles`
+    if [[ $total == 0 ]] ; then
+      echo "+1 ${TASKNAME}" >> $SUMMARYFILE
+    else
+      echo "-1 ${TASKNAME}" >> $SUMMARYFILE
+    fi
+    for line in "${REPORT[@]}" ; do
+      echo "    ${line}" >> $SUMMARYFILE
+    done
+    ;;
+esac
+
+exit 0

Propchange: incubator/oozie/trunk/bin/test-patch-15-backwards-compatibility
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/oozie/trunk/bin/test-patch-20-tests
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-20-tests?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-20-tests (original)
+++ incubator/oozie/trunk/bin/test-patch-20-tests Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   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=""
@@ -86,7 +90,7 @@ case $OP in
     mvn test ${MVNPASSTHRU} -Dmaven.test.failure.ignore=true \
         -Dmaven.test.error.ignore=true -fae -Doozie.test.waitfor.ratio=3 \
         -Dtest.timeout=7200 | tee ${TEMPDIR}/${TASKNAME}.out >> $STDOUT
-
+    exitCode=${PIPESTATUS[0]}
     if [[ ! "${MVNPASSTHRU}" =~ "-Dtest=" || ("${MVNPASSTHRU}" =~ "TestHiveActionExecutor" || "${MVNPASSTHRU}" =~ "TestHiveMain") ]] ; then
         # we need to do this 2nd run because Pig 0.9 and Hive 0.9 require different
         # versions of antlr. Once we move to Pig 0.10 then we don't need this.
@@ -94,25 +98,31 @@ case $OP in
             -PtestHive -Dmaven.test.failure.ignore=true -Dmaven.test.error.ignore=true \
             -fae -Doozie.test.waitfor.ratio=3 -Dtest.timeout=7200 \
             | tee -a ${TEMPDIR}/${TASKNAME}.out >> $STDOUT
+        exitCode=`expr $exitCode + ${PIPESTATUS[0]}`
     fi
-    exit 0
+    echo "$exitCode" >  ${TEMPDIR}/${TASKNAME}.exitCode
     ;;
   report)
     failedTests=`find . -name 'TEST*.xml' | xargs grep  -l -E "<failure|<error" | sed -e "s|.*target/surefire-reports/TEST-|          |g" | sed -e "s|\.xml||g"`
     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 "Tests run: "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 "Tests failures: "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 "Tests errors: "count}'`
-    if [ -n "${failedTests}" ] ; then
-      echo "-1 ${TASKNAME} - the patch failed the following testcases:" >> $SUMMARYFILE
-      echo "" >> ${SUMMARYFILE}
-      echo "${failedTests}" >> $SUMMARYFILE
-      echo "" >> ${SUMMARYFILE}
+    testsExitCode=`cat ${TEMPDIR}/${TASKNAME}.exitCode`
+    if [[ "$testsExitCode" != "0" ]] ; then
+      if [ -n "${failedTests}" ] ; then
+        echo "-1 ${TASKNAME} - the patch failed the following testcases:" >> $SUMMARYFILE
+        echo "" >> ${SUMMARYFILE}
+        echo "${failedTests}" >> $SUMMARYFILE
+        echo "" >> ${SUMMARYFILE}
+      else
+        echo "-1 ${TASKNAME} - patch does not compile, cannot run testcases" >> $SUMMARYFILE
+      fi
     else
       echo "+1 ${TASKNAME}" >> $SUMMARYFILE
     fi
-    echo "  $testsRun" >> $SUMMARYFILE
-    echo "  $testsFailed" >> $SUMMARYFILE
-    echo "  $testsErrors" >> $SUMMARYFILE
+    echo "   $testsRun" >> $SUMMARYFILE
+    echo "   $testsFailed" >> $SUMMARYFILE
+    echo "   $testsErrors" >> $SUMMARYFILE
     ;;
 esac
 

Added: incubator/oozie/trunk/bin/test-patch-30-distro
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-30-distro?rev=1376180&view=auto
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-30-distro (added)
+++ incubator/oozie/trunk/bin/test-patch-30-distro Wed Aug 22 18:27:45 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 -DgenerateDocs -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 "-1 ${TASKNAME}" >> $SUMMARYFILE
+      echo "    -1 distro tarball fails with the patch" >> $SUMMARYFILE
+         else
+      echo "+1 ${TASKNAME}" >> $SUMMARYFILE
+      echo "    +1 distro tarball builds with the patch " >> $SUMMARYFILE
+    fi
+    ;;
+esac
+
+exit 0

Propchange: incubator/oozie/trunk/bin/test-patch-30-distro
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/oozie/trunk/bin/test-patch-XX-template
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-XX-template?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-XX-template (original)
+++ incubator/oozie/trunk/bin/test-patch-XX-template Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
+if [ "${TESTPATCHDEBUG}" == "true" ] ; then
+  set -x
+fi
+
 BASEDIR=$(pwd)
 TASKNAME="TASKTEMPLATE"
 OP=""

Modified: incubator/oozie/trunk/bin/test-patch-find-new-patch-available-jiras
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/bin/test-patch-find-new-patch-available-jiras?rev=1376180&r1=1376179&r2=1376180&view=diff
==============================================================================
--- incubator/oozie/trunk/bin/test-patch-find-new-patch-available-jiras (original)
+++ incubator/oozie/trunk/bin/test-patch-find-new-patch-available-jiras Wed Aug 22 18:27:45 2012
@@ -12,6 +12,10 @@
 #   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