2009-05-19 04:56:52 +00:00
#!/usr/bin/env bash
2009-08-17 03:53:27 +00:00
# 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.
2009-05-19 04:56:52 +00:00
#set -x
### Setup some variables.
2014-08-28 06:12:57 +00:00
### BUILD_URL is set by Hudson if it is run by patch process
2010-11-02 05:33:05 +00:00
### Read variables from properties file
2011-06-14 15:05:39 +00:00
bindir = $( dirname $0 )
2009-05-19 04:56:52 +00:00
2011-08-09 20:28:48 +00:00
# Defaults
2011-08-05 14:28:30 +00:00
if [ -z " $MAVEN_HOME " ] ; then
MVN = mvn
else
MVN = $MAVEN_HOME /bin/mvn
fi
2011-08-09 20:28:48 +00:00
PROJECT_NAME = Hadoop
JENKINS = false
PATCH_DIR = /tmp
SUPPORT_DIR = /tmp
BASEDIR = $( pwd )
2012-10-18 21:05:07 +00:00
BUILD_NATIVE = true
2011-08-09 20:28:48 +00:00
PS = ${ PS :- ps }
2011-08-05 14:28:30 +00:00
AWK = ${ AWK :- awk }
2011-08-09 20:28:48 +00:00
WGET = ${ WGET :- wget }
2014-08-28 06:12:57 +00:00
GIT = ${ GIT :- git }
2011-08-09 20:28:48 +00:00
GREP = ${ GREP :- grep }
PATCH = ${ PATCH :- patch }
2012-04-30 21:47:51 +00:00
DIFF = ${ DIFF :- diff }
2011-08-09 20:28:48 +00:00
JIRACLI = ${ JIRA :- jira }
FINDBUGS_HOME = ${ FINDBUGS_HOME }
FORREST_HOME = ${ FORREST_HOME }
ECLIPSE_HOME = ${ ECLIPSE_HOME }
2011-08-05 14:28:30 +00:00
2009-05-19 04:56:52 +00:00
###############################################################################
2011-08-09 20:28:48 +00:00
printUsage( ) {
echo " Usage: $0 [options] patch-file | defect-number "
echo
echo "Where:"
echo " patch-file is a local patch file containing the changes to test"
echo " defect-number is a JIRA defect number (e.g. 'HADOOP-1234') to test (Jenkins only)"
echo
echo "Options:"
echo "--patch-dir=<dir> The directory for working and output files (default '/tmp')"
echo "--basedir=<dir> The directory to apply the patch to (default current directory)"
echo "--mvn-cmd=<cmd> The 'mvn' command to use (default \$MAVEN_HOME/bin/mvn, or 'mvn')"
echo "--ps-cmd=<cmd> The 'ps' command to use (default 'ps')"
echo "--awk-cmd=<cmd> The 'awk' command to use (default 'awk')"
2014-08-28 06:12:57 +00:00
echo "--git-cmd=<cmd> The 'git' command to use (default 'git')"
2011-08-09 20:28:48 +00:00
echo "--grep-cmd=<cmd> The 'grep' command to use (default 'grep')"
echo "--patch-cmd=<cmd> The 'patch' command to use (default 'patch')"
2012-04-30 21:47:51 +00:00
echo "--diff-cmd=<cmd> The 'diff' command to use (default 'diff')"
2011-08-09 20:28:48 +00:00
echo "--findbugs-home=<path> Findbugs home directory (default FINDBUGS_HOME environment variable)"
echo "--forrest-home=<path> Forrest home directory (default FORREST_HOME environment variable)"
2014-08-28 06:12:57 +00:00
echo "--dirty-workspace Allow the local git workspace to have uncommitted changes"
2011-09-08 18:39:11 +00:00
echo "--run-tests Run all tests below the base directory"
2012-10-18 21:05:07 +00:00
echo "--build-native=<bool> If true, then build native components (default 'true')"
2011-08-09 20:28:48 +00:00
echo
echo "Jenkins-only options:"
echo "--jenkins Run by Jenkins (runs tests and posts results to JIRA)"
echo "--support-dir=<dir> The directory to find support files in"
echo "--wget-cmd=<cmd> The 'wget' command to use (default 'wget')"
echo "--jira-cmd=<cmd> The 'jira' command to use (default 'jira')"
echo "--jira-password=<pw> The password for the 'jira' command"
echo "--eclipse-home=<path> Eclipse home directory (default ECLIPSE_HOME environment variable)"
}
2009-05-19 04:56:52 +00:00
2011-08-09 20:28:48 +00:00
###############################################################################
parseArgs( ) {
for i in $*
do
case $i in
--jenkins)
JENKINS = true
2009-05-19 04:56:52 +00:00
; ;
2011-08-09 20:28:48 +00:00
--patch-dir= *)
PATCH_DIR = ${ i #*= }
; ;
--support-dir= *)
SUPPORT_DIR = ${ i #*= }
; ;
--basedir= *)
BASEDIR = ${ i #*= }
; ;
--mvn-cmd= *)
MVN = ${ i #*= }
; ;
--ps-cmd= *)
PS = ${ i #*= }
; ;
--awk-cmd= *)
AWK = ${ i #*= }
; ;
--wget-cmd= *)
WGET = ${ i #*= }
; ;
2014-08-28 06:12:57 +00:00
--git-cmd= *)
GIT = ${ i #*= }
2011-08-09 20:28:48 +00:00
; ;
--grep-cmd= *)
GREP = ${ i #*= }
; ;
--patch-cmd= *)
PATCH = ${ i #*= }
; ;
2012-04-30 21:47:51 +00:00
--diff-cmd= *)
DIFF = ${ i #*= }
; ;
2011-08-09 20:28:48 +00:00
--jira-cmd= *)
JIRACLI = ${ i #*= }
; ;
--jira-password= *)
JIRA_PASSWD = ${ i #*= }
; ;
--findbugs-home= *)
FINDBUGS_HOME = ${ i #*= }
; ;
--forrest-home= *)
FORREST_HOME = ${ i #*= }
; ;
--eclipse-home= *)
ECLIPSE_HOME = ${ i #*= }
; ;
--dirty-workspace)
DIRTY_WORKSPACE = true
2009-05-19 04:56:52 +00:00
; ;
2011-09-08 18:39:11 +00:00
--run-tests)
RUN_TESTS = true
; ;
2012-10-18 21:05:07 +00:00
--build-native= *)
BUILD_NATIVE = ${ i #*= }
; ;
2009-05-19 04:56:52 +00:00
*)
2011-08-09 20:28:48 +00:00
PATCH_OR_DEFECT = $i
2009-05-19 04:56:52 +00:00
; ;
2011-08-09 20:28:48 +00:00
esac
done
2012-10-18 21:05:07 +00:00
if [ [ $BUILD_NATIVE = = "true" ] ] ; then
NATIVE_PROFILE = -Pnative
REQUIRE_TEST_LIB_HADOOP = -Drequire.test.libhadoop
fi
2011-08-09 20:28:48 +00:00
if [ -z " $PATCH_OR_DEFECT " ] ; then
printUsage
exit 1
fi
if [ [ $JENKINS = = "true" ] ] ; then
echo "Running in Jenkins mode"
defect = $PATCH_OR_DEFECT
ECLIPSE_PROPERTY = " -Declipse.home= $ECLIPSE_HOME "
else
echo "Running in developer mode"
JENKINS = false
### PATCH_FILE contains the location of the patchfile
PATCH_FILE = $PATCH_OR_DEFECT
if [ [ ! -e " $PATCH_FILE " ] ] ; then
echo " Unable to locate the patch file $PATCH_FILE "
cleanupAndExit 0
fi
### Check if $PATCH_DIR exists. If it does not exist, create a new directory
if [ [ ! -e " $PATCH_DIR " ] ] ; then
mkdir " $PATCH_DIR "
if [ [ $? = = 0 ] ] ; then
echo " $PATCH_DIR has been created "
else
echo " Unable to create $PATCH_DIR "
cleanupAndExit 0
fi
fi
### Obtain the patch filename to append it to the version number
defect = ` basename $PATCH_FILE `
fi
2009-05-19 04:56:52 +00:00
}
###############################################################################
checkout ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Testing patch for ${ defect } . "
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
### When run by a developer, if the workspace contains modifications, do not continue
2011-08-09 20:28:48 +00:00
### unless the --dirty-workspace option was set
2014-08-28 06:12:57 +00:00
status = ` $GIT status --porcelain`
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "false" ] ] ; then
if [ [ " $status " != "" && -z $DIRTY_WORKSPACE ] ] ; then
2009-05-19 04:56:52 +00:00
echo "ERROR: can't run in a workspace that contains the following modifications"
echo " $status "
cleanupAndExit 1
fi
2011-08-02 16:37:57 +00:00
echo
2009-05-19 04:56:52 +00:00
else
cd $BASEDIR
2014-08-28 06:12:57 +00:00
$GIT reset --hard
$GIT clean -xdf
$GIT checkout trunk
$GIT pull --rebase
2009-05-19 04:56:52 +00:00
fi
2014-08-28 06:12:57 +00:00
GIT_REVISION = ` git rev-parse --verify --short HEAD`
2009-05-19 04:56:52 +00:00
return $?
}
###############################################################################
2012-07-06 20:04:51 +00:00
downloadPatch ( ) {
2009-05-19 04:56:52 +00:00
### Download latest patch file (ignoring .htm and .html) when run from patch process
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "true" ] ] ; then
2009-05-19 04:56:52 +00:00
$WGET -q -O $PATCH_DIR /jira http://issues.apache.org/jira/browse/$defect
if [ [ ` $GREP -c 'Patch Available' $PATCH_DIR /jira` = = 0 ] ] ; then
echo " $defect is not \"Patch Available\". Exiting. "
cleanupAndExit 0
fi
relativePatchURL = ` $GREP -o '"/jira/secure/attachment/[0-9]*/[^"]*' $PATCH_DIR /jira | $GREP -v -e 'htm[l]*$' | sort | tail -1 | $GREP -o '/jira/secure/attachment/[0-9]*/[^"]*' `
patchURL = " http://issues.apache.org ${ relativePatchURL } "
patchNum = ` echo $patchURL | $GREP -o '[0-9]*/' | $GREP -o '[0-9]*' `
echo " $defect patch is being downloaded at `date` from "
echo " $patchURL "
$WGET -q -O $PATCH_DIR /patch $patchURL
2014-08-28 06:12:57 +00:00
VERSION = ${ GIT_REVISION } _${ defect } _PATCH-${ patchNum }
2009-05-19 04:56:52 +00:00
JIRA_COMMENT = " Here are the results of testing the latest attachment
$patchURL
2014-08-28 06:12:57 +00:00
against trunk revision ${ GIT_REVISION } ."
2009-05-19 04:56:52 +00:00
### Copy in any supporting files needed by this process
cp -r $SUPPORT_DIR /lib/* ./lib
#PENDING: cp -f $SUPPORT_DIR/etc/checkstyle* ./src/test
### Copy the patch file to $PATCH_DIR
else
VERSION = PATCH-${ defect }
cp $PATCH_FILE $PATCH_DIR /patch
if [ [ $? = = 0 ] ] ; then
echo " Patch file $PATCH_FILE copied to $PATCH_DIR "
else
echo " Could not copy $PATCH_FILE to $PATCH_DIR "
cleanupAndExit 0
fi
fi
2012-07-06 20:04:51 +00:00
}
###############################################################################
verifyPatch ( ) {
# Before building, check to make sure that the patch is valid
$bindir /smart-apply-patch.sh $PATCH_DIR /patch dryrun
if [ [ $? != 0 ] ] ; then
echo "PATCH APPLICATION FAILED"
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:red} -1 patch{ color} . The patch command could not apply the patch."
2012-07-06 20:04:51 +00:00
return 1
else
return 0
fi
}
###############################################################################
2013-07-11 18:52:52 +00:00
prebuildWithoutPatch ( ) {
2009-05-19 04:56:52 +00:00
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
2010-11-02 05:33:05 +00:00
echo " Pre-build trunk to verify trunk stability and javac warnings"
2009-05-19 04:56:52 +00:00
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2011-09-08 18:39:11 +00:00
if [ [ ! -d hadoop-common-project ] ] ; then
cd $bindir /..
echo " Compiling $( pwd ) "
echo " $MVN clean test -DskipTests > $PATCH_DIR /trunkCompile.txt 2>&1 "
$MVN clean test -DskipTests > $PATCH_DIR /trunkCompile.txt 2>& 1
if [ [ $? != 0 ] ] ; then
echo "Top-level trunk compilation is broken?"
2013-07-11 18:52:52 +00:00
JIRA_COMMENT = " $JIRA_COMMENT
{ color:red} -1 patch{ color} . Top-level trunk compilation may be broken."
return 1
2011-09-08 18:39:11 +00:00
fi
cd -
fi
echo " Compiling $( pwd ) "
2011-08-29 18:24:21 +00:00
echo " $MVN clean test -DskipTests -D ${ PROJECT_NAME } PatchProcess -Ptest-patch > $PATCH_DIR /trunkJavacWarnings.txt 2>&1 "
$MVN clean test -DskipTests -D${ PROJECT_NAME } PatchProcess -Ptest-patch > $PATCH_DIR /trunkJavacWarnings.txt 2>& 1
2009-05-19 04:56:52 +00:00
if [ [ $? != 0 ] ] ; then
echo "Trunk compilation is broken?"
2013-07-11 18:52:52 +00:00
JIRA_COMMENT = " $JIRA_COMMENT
{ color:red} -1 patch{ color} . Trunk compilation may be broken."
return 1
2009-05-19 04:56:52 +00:00
fi
2014-02-06 00:13:34 +00:00
echo " $MVN clean test javadoc:javadoc -DskipTests -Pdocs -D ${ PROJECT_NAME } PatchProcess > $PATCH_DIR /trunkJavadocWarnings.txt 2>&1 "
$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${ PROJECT_NAME } PatchProcess > $PATCH_DIR /trunkJavadocWarnings.txt 2>& 1
if [ [ $? != 0 ] ] ; then
echo "Trunk javadoc compilation is broken?"
JIRA_COMMENT = " $JIRA_COMMENT
{ color:red} -1 patch{ color} . Trunk compilation may be broken."
return 1
fi
2013-07-11 18:52:52 +00:00
return 0
2009-05-19 04:56:52 +00:00
}
###############################################################################
### Check for @author tags in the patch
checkAuthor ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Checking there are no @author tags in the patch."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
authorTags = ` $GREP -c -i '@author' $PATCH_DIR /patch`
echo " There appear to be $authorTags @author tags in the patch. "
if [ [ $authorTags != 0 ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:red} -1 @author{ color} . The patch appears to contain $authorTags @author tags which the Hadoop community has agreed to not allow in code contributions."
2009-05-19 04:56:52 +00:00
return 1
fi
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:green} +1 @author{ color} . The patch does not contain any @author tags."
2009-05-19 04:56:52 +00:00
return 0
}
###############################################################################
2013-03-25 04:34:29 +00:00
### Check for tests in the patch
2009-05-19 04:56:52 +00:00
checkTests ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Checking there are new or changed tests in the patch."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2012-04-05 13:57:09 +00:00
testReferences = ` $GREP -c -i -e '^+++.*/test' $PATCH_DIR /patch`
2009-05-19 04:56:52 +00:00
echo " There appear to be $testReferences test files referenced in the patch. "
if [ [ $testReferences = = 0 ] ] ; then
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "true" ] ] ; then
2009-05-19 04:56:52 +00:00
patchIsDoc = ` $GREP -c -i 'title="documentation' $PATCH_DIR /jira`
if [ [ $patchIsDoc != 0 ] ] ; then
echo "The patch appears to be a documentation patch that doesn't require tests."
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-28 14:16:20 +00:00
{ color:green} +0 tests included{ color} . The patch appears to be a documentation patch that doesn' t require tests."
2009-05-19 04:56:52 +00:00
return 0
fi
fi
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 20:56:40 +00:00
{ color:red} -1 tests included{ color} . The patch doesn' t appear to include any new or modified tests.
2009-06-23 04:45:15 +00:00
Please justify why no new tests are needed for this patch.
Also please list what manual steps were performed to verify this patch."
2009-05-19 04:56:52 +00:00
return 1
fi
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 20:56:40 +00:00
{ color:green} +1 tests included{ color} . The patch appears to include $testReferences new or modified test files."
2013-03-25 04:34:29 +00:00
return 0
2009-05-19 04:56:52 +00:00
}
2009-09-15 13:17:07 +00:00
cleanUpXml ( ) {
cd $BASEDIR /conf
for file in ` ls *.xml.template`
do
rm -f ` basename $file .template`
done
cd $BASEDIR
}
2009-05-19 04:56:52 +00:00
###############################################################################
### Attempt to apply the patch
applyPatch ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Applying patch."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2011-06-14 15:05:39 +00:00
export PATCH
$bindir /smart-apply-patch.sh $PATCH_DIR /patch
2009-05-19 04:56:52 +00:00
if [ [ $? != 0 ] ] ; then
echo "PATCH APPLICATION FAILED"
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:red} -1 patch{ color} . The patch command could not apply the patch."
2009-05-19 04:56:52 +00:00
return 1
fi
return 0
}
###############################################################################
2014-02-06 00:13:34 +00:00
calculateJavadocWarnings( ) {
WARNING_FILE = " $1 "
RET = $( egrep " ^[0-9]+ warnings $" " $WARNING_FILE " | awk '{sum+=$1} END {print sum}' )
}
2009-05-19 04:56:52 +00:00
### Check there are no javadoc warnings
checkJavadocWarnings ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Determining number of patched javadoc warnings."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2011-08-29 18:24:21 +00:00
echo " $MVN clean test javadoc:javadoc -DskipTests -Pdocs -D ${ PROJECT_NAME } PatchProcess > $PATCH_DIR /patchJavadocWarnings.txt 2>&1 "
2011-08-11 16:49:59 +00:00
if [ -d hadoop-project ] ; then
2012-05-01 00:21:38 +00:00
( cd hadoop-project; $MVN install > /dev/null 2>& 1)
2011-08-11 16:49:59 +00:00
fi
2011-08-25 19:31:02 +00:00
if [ -d hadoop-common-project/hadoop-annotations ] ; then
2012-05-01 00:21:38 +00:00
( cd hadoop-common-project/hadoop-annotations; $MVN install > /dev/null 2>& 1)
2011-08-11 16:49:59 +00:00
fi
2011-08-29 18:24:21 +00:00
$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${ PROJECT_NAME } PatchProcess > $PATCH_DIR /patchJavadocWarnings.txt 2>& 1
2014-02-06 00:13:34 +00:00
calculateJavadocWarnings " $PATCH_DIR /trunkJavadocWarnings.txt "
numTrunkJavadocWarnings = $RET
calculateJavadocWarnings " $PATCH_DIR /patchJavadocWarnings.txt "
numPatchJavadocWarnings = $RET
grep -i warning " $PATCH_DIR /trunkJavadocWarnings.txt " > " $PATCH_DIR /trunkJavadocWarningsFiltered.txt "
grep -i warning " $PATCH_DIR /patchJavadocWarnings.txt " > " $PATCH_DIR /patchJavadocWarningsFiltered.txt "
diff -u " $PATCH_DIR /trunkJavadocWarningsFiltered.txt " \
" $PATCH_DIR /patchJavadocWarningsFiltered.txt " > \
" $PATCH_DIR /diffJavadocWarnings.txt "
rm -f " $PATCH_DIR /trunkJavadocWarningsFiltered.txt " " $PATCH_DIR /patchJavadocWarningsFiltered.txt "
echo " There appear to be $numTrunkJavadocWarnings javadoc warnings before the patch and $numPatchJavadocWarnings javadoc warnings after applying the patch. "
if [ [ $numTrunkJavadocWarnings != "" && $numPatchJavadocWarnings != "" ] ] ; then
if [ [ $numPatchJavadocWarnings -gt $numTrunkJavadocWarnings ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
2009-05-19 04:56:52 +00:00
2014-02-06 00:13:34 +00:00
{ color:red} -1 javadoc{ color} . The javadoc tool appears to have generated ` expr $(( $numPatchJavadocWarnings - $numTrunkJavadocWarnings )) ` warning messages.
2014-09-29 18:15:41 +00:00
See $BUILD_URL /artifact/patchprocess/diffJavadocWarnings.txt for details."
2014-02-06 00:13:34 +00:00
return 1
fi
2009-05-19 04:56:52 +00:00
fi
JIRA_COMMENT = " $JIRA_COMMENT
2014-02-06 00:13:34 +00:00
{ color:green} +1 javadoc{ color} . There were no new javadoc warning messages."
2010-11-02 05:33:05 +00:00
return 0
2009-05-19 04:56:52 +00:00
}
###############################################################################
### Check there are no changes in the number of Javac warnings
checkJavacWarnings ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Determining number of patched javac warnings."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2012-10-18 21:05:07 +00:00
echo " $MVN clean test -DskipTests -D ${ PROJECT_NAME } PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR /patchJavacWarnings.txt 2>&1 "
$MVN clean test -DskipTests -D${ PROJECT_NAME } PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR /patchJavacWarnings.txt 2>& 1
2009-08-04 19:01:51 +00:00
if [ [ $? != 0 ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
2009-05-19 04:56:52 +00:00
2012-09-25 14:22:17 +00:00
{ color:red} -1 javac{ color:red} . The patch appears to cause the build to fail."
2012-05-10 21:09:08 +00:00
return 2
2009-08-04 19:01:51 +00:00
fi
2009-05-19 04:56:52 +00:00
### Compare trunk and patch javac warning numbers
if [ [ -f $PATCH_DIR /patchJavacWarnings.txt ] ] ; then
2012-04-30 21:47:51 +00:00
$GREP '\[WARNING\]' $PATCH_DIR /trunkJavacWarnings.txt > $PATCH_DIR /filteredTrunkJavacWarnings.txt
$GREP '\[WARNING\]' $PATCH_DIR /patchJavacWarnings.txt > $PATCH_DIR /filteredPatchJavacWarnings.txt
trunkJavacWarnings = ` cat $PATCH_DIR /filteredTrunkJavacWarnings.txt | $AWK 'BEGIN {total = 0} {total += 1} END {print total}' `
patchJavacWarnings = ` cat $PATCH_DIR /filteredPatchJavacWarnings.txt | $AWK 'BEGIN {total = 0} {total += 1} END {print total}' `
2009-05-19 04:56:52 +00:00
echo " There appear to be $trunkJavacWarnings javac compiler warnings before the patch and $patchJavacWarnings javac compiler warnings after applying the patch. "
if [ [ $patchJavacWarnings != "" && $trunkJavacWarnings != "" ] ] ; then
2009-07-01 00:56:15 +00:00
if [ [ $patchJavacWarnings -gt $trunkJavacWarnings ] ] ; then
2009-05-19 04:56:52 +00:00
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:red} -1 javac{ color} . The applied patch generated $patchJavacWarnings javac compiler warnings ( more than the trunk' s current $trunkJavacWarnings warnings) ."
2012-04-30 21:47:51 +00:00
$DIFF $PATCH_DIR /filteredTrunkJavacWarnings.txt $PATCH_DIR /filteredPatchJavacWarnings.txt > $PATCH_DIR /diffJavacWarnings.txt
2014-09-29 18:15:41 +00:00
JIRA_COMMENT_FOOTER = " Javac warnings: $BUILD_URL /artifact/patchprocess/diffJavacWarnings.txt
2012-04-30 21:47:51 +00:00
$JIRA_COMMENT_FOOTER "
2009-05-19 04:56:52 +00:00
return 1
fi
fi
fi
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:green} +1 javac{ color} . The applied patch does not increase the total number of javac compiler warnings."
2009-05-19 04:56:52 +00:00
return 0
}
###############################################################################
### Check there are no changes in the number of release audit (RAT) warnings
checkReleaseAuditWarnings ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Determining number of patched release audit warnings."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2012-05-01 00:21:38 +00:00
echo " $MVN apache-rat:check -D ${ PROJECT_NAME } PatchProcess > $PATCH_DIR /patchReleaseAuditOutput.txt 2>&1 "
$MVN apache-rat:check -D${ PROJECT_NAME } PatchProcess > $PATCH_DIR /patchReleaseAuditOutput.txt 2>& 1
2011-08-24 21:35:38 +00:00
find $BASEDIR -name rat.txt | xargs cat > $PATCH_DIR /patchReleaseAuditWarnings.txt
2009-05-19 04:56:52 +00:00
### Compare trunk and patch release audit warning numbers
if [ [ -f $PATCH_DIR /patchReleaseAuditWarnings.txt ] ] ; then
patchReleaseAuditWarnings = ` $GREP -c '\!?????' $PATCH_DIR /patchReleaseAuditWarnings.txt`
echo ""
echo ""
2012-05-01 21:46:58 +00:00
echo " There appear to be $patchReleaseAuditWarnings release audit warnings after applying the patch. "
if [ [ $patchReleaseAuditWarnings != "" ] ] ; then
if [ [ $patchReleaseAuditWarnings -gt 0 ] ] ; then
2009-05-19 04:56:52 +00:00
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 20:56:40 +00:00
{ color:red} -1 release audit{ color} . The applied patch generated $patchReleaseAuditWarnings release audit warnings."
2009-05-19 04:56:52 +00:00
$GREP '\!?????' $PATCH_DIR /patchReleaseAuditWarnings.txt > $PATCH_DIR /patchReleaseAuditProblems.txt
2010-11-05 03:48:48 +00:00
echo "Lines that start with ????? in the release audit report indicate files that do not have an Apache license header." >> $PATCH_DIR /patchReleaseAuditProblems.txt
2014-09-29 18:15:41 +00:00
JIRA_COMMENT_FOOTER = " Release audit warnings: $BUILD_URL /artifact/patchprocess/patchReleaseAuditProblems.txt
2009-05-19 04:56:52 +00:00
$JIRA_COMMENT_FOOTER "
return 1
fi
fi
fi
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 20:56:40 +00:00
{ color:green} +1 release audit{ color} . The applied patch does not increase the total number of release audit warnings."
2009-05-19 04:56:52 +00:00
return 0
}
###############################################################################
### Check there are no changes in the number of Checkstyle warnings
checkStyle ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Determining number of patched checkstyle warnings."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
echo "THIS IS NOT IMPLEMENTED YET"
echo ""
echo ""
2011-08-29 18:24:21 +00:00
echo " $MVN test checkstyle:checkstyle -DskipTests -D ${ PROJECT_NAME } PatchProcess "
$MVN test checkstyle:checkstyle -DskipTests -D${ PROJECT_NAME } PatchProcess
2011-08-02 16:37:57 +00:00
2010-10-25 18:59:28 +00:00
JIRA_COMMENT_FOOTER = " Checkstyle results: $BUILD_URL /artifact/trunk/build/test/checkstyle-errors.html
2009-05-19 04:56:52 +00:00
$JIRA_COMMENT_FOOTER "
### TODO: calculate actual patchStyleErrors
# patchStyleErrors=0
# if [[ $patchStyleErrors != 0 ]] ; then
# JIRA_COMMENT="$JIRA_COMMENT
#
2012-09-25 14:22:17 +00:00
# {color:red}-1 checkstyle{color}. The patch generated $patchStyleErrors code style errors."
2009-05-19 04:56:52 +00:00
# return 1
# fi
# JIRA_COMMENT="$JIRA_COMMENT
#
2012-09-25 14:22:17 +00:00
# {color:green}+1 checkstyle{color}. The patch generated 0 code style errors."
2009-05-19 04:56:52 +00:00
return 0
}
2012-05-09 14:08:28 +00:00
###############################################################################
### Install the new jars so tests and findbugs can find all of the updated jars
buildAndInstall ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Installing all of the jars"
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
echo " $MVN install -Dmaven.javadoc.skip=true -DskipTests -D ${ PROJECT_NAME } PatchProcess "
$MVN install -Dmaven.javadoc.skip= true -DskipTests -D${ PROJECT_NAME } PatchProcess
return $?
}
2009-05-19 04:56:52 +00:00
###############################################################################
### Check there are no changes in the number of Findbugs warnings
checkFindbugsWarnings ( ) {
2010-11-19 00:44:11 +00:00
findbugs_version = ` ${ FINDBUGS_HOME } /bin/findbugs -version`
2009-05-19 04:56:52 +00:00
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Determining number of patched Findbugs warnings."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2012-05-01 00:21:38 +00:00
modules = $( findModules)
rc = 0
for module in $modules ;
do
cd $module
echo " Running findbugs in $module "
module_suffix = ` basename ${ module } `
echo " $MVN clean test findbugs:findbugs -DskipTests -D ${ PROJECT_NAME } PatchProcess < /dev/null > $PATCH_DIR /patchFindBugsOutput ${ module_suffix } .txt 2>&1 "
$MVN clean test findbugs:findbugs -DskipTests -D${ PROJECT_NAME } PatchProcess < /dev/null > $PATCH_DIR /patchFindBugsOutput${ module_suffix } .txt 2>& 1
( ( rc = rc + $? ) )
cd -
done
2011-08-02 16:37:57 +00:00
2012-05-01 00:21:38 +00:00
if [ $rc != 0 ] ; then
2009-05-19 04:56:52 +00:00
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:red} -1 findbugs{ color} . The patch appears to cause Findbugs ( version ${ findbugs_version } ) to fail."
2009-05-19 04:56:52 +00:00
return 1
fi
2011-08-11 16:49:59 +00:00
findbugsWarnings = 0
for file in $( find $BASEDIR -name findbugsXml.xml)
do
relative_file = ${ file # $BASEDIR / } # strip leading $BASEDIR prefix
if [ ! $relative_file = = "target/findbugsXml.xml" ] ; then
module_suffix = ${ relative_file %/target/findbugsXml.xml } # strip trailing path
2011-08-25 19:31:02 +00:00
module_suffix = ` basename ${ module_suffix } `
2011-08-11 16:49:59 +00:00
fi
cp $file $PATCH_DIR /patchFindbugsWarnings${ module_suffix } .xml
$FINDBUGS_HOME /bin/setBugDatabaseInfo -timestamp "01/01/2000" \
$PATCH_DIR /patchFindbugsWarnings${ module_suffix } .xml \
$PATCH_DIR /patchFindbugsWarnings${ module_suffix } .xml
newFindbugsWarnings = ` $FINDBUGS_HOME /bin/filterBugs -first "01/01/2000" $PATCH_DIR /patchFindbugsWarnings${ module_suffix } .xml \
$PATCH_DIR /newPatchFindbugsWarnings${ module_suffix } .xml | $AWK '{print $1}' `
echo " Found $newFindbugsWarnings Findbugs warnings ( $file ) "
findbugsWarnings = $(( findbugsWarnings+newFindbugsWarnings))
$FINDBUGS_HOME /bin/convertXmlToText -html \
$PATCH_DIR /newPatchFindbugsWarnings${ module_suffix } .xml \
$PATCH_DIR /newPatchFindbugsWarnings${ module_suffix } .html
2011-09-12 11:22:38 +00:00
if [ [ $newFindbugsWarnings > 0 ] ] ; then
2014-09-29 18:15:41 +00:00
JIRA_COMMENT_FOOTER = " Findbugs warnings: $BUILD_URL /artifact/patchprocess/newPatchFindbugsWarnings ${ module_suffix } .html
2009-05-19 04:56:52 +00:00
$JIRA_COMMENT_FOOTER "
2011-09-12 11:22:38 +00:00
fi
2011-08-11 16:49:59 +00:00
done
2010-11-02 05:33:05 +00:00
2012-05-01 21:46:58 +00:00
if [ [ $findbugsWarnings -gt 0 ] ] ; then
2009-05-19 04:56:52 +00:00
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:red} -1 findbugs{ color} . The patch appears to introduce $findbugsWarnings new Findbugs ( version ${ findbugs_version } ) warnings."
2009-05-19 04:56:52 +00:00
return 1
fi
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 14:22:17 +00:00
{ color:green} +1 findbugs{ color} . The patch does not introduce any new Findbugs ( version ${ findbugs_version } ) warnings."
2009-05-19 04:56:52 +00:00
return 0
}
2011-12-12 20:45:30 +00:00
###############################################################################
### Verify eclipse:eclipse works
checkEclipseGeneration ( ) {
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Running mvn eclipse:eclipse."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2012-05-01 00:21:38 +00:00
echo " $MVN eclipse:eclipse -D ${ PROJECT_NAME } PatchProcess > $PATCH_DIR /patchEclipseOutput.txt 2>&1 "
$MVN eclipse:eclipse -D${ PROJECT_NAME } PatchProcess > $PATCH_DIR /patchEclipseOutput.txt 2>& 1
2011-12-12 20:45:30 +00:00
if [ [ $? != 0 ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 20:56:40 +00:00
{ color:red} -1 eclipse:eclipse{ color} . The patch failed to build with eclipse:eclipse."
2011-12-12 20:45:30 +00:00
return 1
fi
JIRA_COMMENT = " $JIRA_COMMENT
2012-09-25 20:56:40 +00:00
{ color:green} +1 eclipse:eclipse{ color} . The patch built with eclipse:eclipse."
2011-12-12 20:45:30 +00:00
return 0
}
2009-05-19 04:56:52 +00:00
###############################################################################
2011-08-24 21:35:38 +00:00
### Run the tests
runTests ( ) {
2009-05-19 04:56:52 +00:00
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
2011-08-24 21:35:38 +00:00
echo " Running tests."
2009-05-19 04:56:52 +00:00
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
2011-10-18 23:48:15 +00:00
2012-05-01 00:21:38 +00:00
failed_tests = ""
modules = $( findModules)
2012-10-08 18:34:14 +00:00
#
# If we are building hadoop-hdfs-project, we must build the native component
# of hadoop-common-project first. In order to accomplish this, we move the
# hadoop-hdfs subprojects to the end of the list so that common will come
# first.
#
# Of course, we may not be building hadoop-common at all-- in this case, we
# explicitly insert a mvn compile -Pnative of common, to ensure that the
# native libraries show up where we need them.
#
building_common = 0
for module in $modules ; do
if [ [ $module = = hadoop-hdfs-project* ] ] ; then
hdfs_modules = " $hdfs_modules $module "
elif [ [ $module = = hadoop-common-project* ] ] ; then
ordered_modules = " $ordered_modules $module "
building_common = 1
else
ordered_modules = " $ordered_modules $module "
fi
done
2012-11-14 17:49:02 +00:00
if [ -n " $hdfs_modules " ] ; then
2012-10-08 18:34:14 +00:00
ordered_modules = " $ordered_modules $hdfs_modules "
if [ [ $building_common -eq 0 ] ] ; then
echo " Building hadoop-common with -Pnative in order to provide \
libhadoop.so to the hadoop-hdfs unit tests."
2012-10-18 21:05:07 +00:00
echo " $MVN compile $NATIVE_PROFILE -D ${ PROJECT_NAME } PatchProcess "
if ! $MVN compile $NATIVE_PROFILE -D${ PROJECT_NAME } PatchProcess; then
2012-10-08 18:34:14 +00:00
JIRA_COMMENT = " $JIRA_COMMENT
{ color:red} -1 core tests{ color} . Failed to build the native portion \
of hadoop-common prior to running the unit tests in $ordered_modules "
return 1
fi
fi
fi
2013-08-12 17:03:36 +00:00
failed_test_builds = ""
test_timeouts = ""
2012-10-08 18:34:14 +00:00
for module in $ordered_modules ; do
2012-05-01 00:21:38 +00:00
cd $module
2013-08-12 17:03:36 +00:00
module_suffix = ` basename ${ module } `
test_logfile = $PATCH_DIR /testrun_${ module_suffix } .txt
2012-05-01 00:21:38 +00:00
echo " Running tests in $module "
2012-10-18 21:05:07 +00:00
echo " $MVN clean install -fn $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D ${ PROJECT_NAME } PatchProcess "
2013-08-12 17:03:36 +00:00
$MVN clean install -fae $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${ PROJECT_NAME } PatchProcess > $test_logfile 2>& 1
test_build_result = $?
cat $test_logfile
module_test_timeouts = ` $AWK '/^Running / { if (last) { print last } last=$2 } /^Tests run: / { last="" }' $test_logfile `
if [ [ -n " $module_test_timeouts " ] ] ; then
test_timeouts = " $test_timeouts
$module_test_timeouts "
fi
2012-05-01 00:21:38 +00:00
module_failed_tests = ` find . -name 'TEST*.xml' | xargs $GREP -l -E "<failure|<error" | sed -e "s|.*target/surefire-reports/TEST-| |g" | sed -e "s|\.xml||g" `
if [ [ -n " $module_failed_tests " ] ] ; then
failed_tests = " ${ failed_tests }
${ module_failed_tests } "
fi
2013-08-12 17:03:36 +00:00
if [ [ $test_build_result != 0 && -z " $module_failed_tests " && -z " $module_test_timeouts " ] ] ; then
failed_test_builds = " $module $failed_test_builds "
fi
2012-05-01 00:21:38 +00:00
cd -
done
2013-08-12 17:03:36 +00:00
result = 0
comment_prefix = " {color:red}-1 core tests{color}."
2012-04-11 15:24:19 +00:00
if [ [ -n " $failed_tests " ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
2009-05-19 04:56:52 +00:00
2013-08-12 17:03:36 +00:00
$comment_prefix The patch failed these unit tests in $modules :
2010-11-19 00:44:11 +00:00
$failed_tests "
2013-08-12 17:03:36 +00:00
comment_prefix = " "
result = 1
2009-05-19 04:56:52 +00:00
fi
2013-08-12 17:03:36 +00:00
if [ [ -n " $test_timeouts " ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
$comment_prefix The following test timeouts occurred in $modules :
$test_timeouts "
comment_prefix = " "
result = 1
fi
if [ [ -n " $failed_test_builds " ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
$comment_prefix The test build failed in $failed_test_builds "
result = 1
fi
if [ [ $result = = 0 ] ] ; then
JIRA_COMMENT = " $JIRA_COMMENT
2009-05-19 04:56:52 +00:00
2012-09-25 20:56:40 +00:00
{ color:green} +1 core tests{ color} . The patch passed unit tests in $modules ."
2013-08-12 17:03:36 +00:00
fi
return $result
2009-05-19 04:56:52 +00:00
}
2012-05-01 00:21:38 +00:00
###############################################################################
# Find the maven module containing the given file.
findModule ( ) {
dir = ` dirname $1 `
while [ 1 ]
do
if [ -f " $dir /pom.xml " ]
then
echo $dir
return
else
dir = ` dirname $dir `
fi
done
}
findModules ( ) {
# Come up with a list of changed files into $TMP
TMP = /tmp/tmp.paths.$$
2012-10-12 01:17:10 +00:00
$GREP '^+++ \|^--- ' $PATCH_DIR /patch | cut -c '5-' | $GREP -v /dev/null | sort | uniq > $TMP
2012-05-01 00:21:38 +00:00
# if all of the lines start with a/ or b/, then this is a git patch that
# was generated without --no-prefix
if ! $GREP -qv '^a/\|^b/' $TMP ; then
sed -i -e 's,^[ab]/,,' $TMP
fi
# Now find all the modules that were changed
TMP_MODULES = /tmp/tmp.modules.$$
for file in $( cut -f 1 $TMP | sort | uniq) ; do
echo $( findModule $file ) >> $TMP_MODULES
done
rm $TMP
# Filter out modules without code
CHANGED_MODULES = ""
for module in $( cat $TMP_MODULES | sort | uniq) ; do
$GREP "<packaging>pom</packaging>" $module /pom.xml > /dev/null
if [ " $? " != 0 ] ; then
CHANGED_MODULES = " $CHANGED_MODULES $module "
fi
done
rm $TMP_MODULES
echo $CHANGED_MODULES
}
2009-05-19 04:56:52 +00:00
###############################################################################
### Submit a comment to the defect's Jira
submitJiraComment ( ) {
local result = $1
### Do not output the value of JIRA_COMMENT_FOOTER when run by a developer
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "false" ] ] ; then
2009-05-19 04:56:52 +00:00
JIRA_COMMENT_FOOTER = ""
fi
if [ [ $result = = 0 ] ] ; then
2012-09-25 14:22:17 +00:00
comment = " {color:green}+1 overall{color}. $JIRA_COMMENT
2009-05-19 04:56:52 +00:00
$JIRA_COMMENT_FOOTER "
else
2012-09-25 14:22:17 +00:00
comment = " {color:red}-1 overall{color}. $JIRA_COMMENT
2009-05-19 04:56:52 +00:00
$JIRA_COMMENT_FOOTER "
fi
### Output the test result to the console
echo "
$comment "
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "true" ] ] ; then
2009-05-19 04:56:52 +00:00
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Adding comment to Jira."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
### Update Jira with a comment
export USER = hudson
2010-04-15 03:08:09 +00:00
$JIRACLI -s https://issues.apache.org/jira -a addcomment -u hadoopqa -p $JIRA_PASSWD --comment " $comment " --issue $defect
$JIRACLI -s https://issues.apache.org/jira -a logout -u hadoopqa -p $JIRA_PASSWD
2009-05-19 04:56:52 +00:00
fi
}
###############################################################################
### Cleanup files
cleanupAndExit ( ) {
local result = $1
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "true" ] ] ; then
2009-05-19 04:56:52 +00:00
if [ -e " $PATCH_DIR " ] ; then
mv $PATCH_DIR $BASEDIR
fi
fi
echo ""
echo ""
echo "======================================================================"
echo "======================================================================"
echo " Finished build."
echo "======================================================================"
echo "======================================================================"
echo ""
echo ""
exit $result
}
###############################################################################
###############################################################################
###############################################################################
JIRA_COMMENT = ""
2010-10-25 18:59:28 +00:00
JIRA_COMMENT_FOOTER = " Console output: $BUILD_URL /console
2009-05-19 04:56:52 +00:00
This message is automatically generated."
### Check if arguments to the script have been specified properly or not
parseArgs $@
cd $BASEDIR
checkout
RESULT = $?
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "true" ] ] ; then
2009-05-19 04:56:52 +00:00
if [ [ $RESULT != 0 ] ] ; then
exit 100
fi
fi
2012-07-06 20:04:51 +00:00
downloadPatch
verifyPatch
( ( RESULT = RESULT + $? ) )
if [ [ $RESULT != 0 ] ] ; then
submitJiraComment 1
cleanupAndExit 1
fi
2013-07-11 18:52:52 +00:00
prebuildWithoutPatch
( ( RESULT = RESULT + $? ) )
if [ [ $RESULT != 0 ] ] ; then
submitJiraComment 1
cleanupAndExit 1
fi
2009-05-19 04:56:52 +00:00
checkAuthor
2012-09-29 21:24:06 +00:00
( ( RESULT = RESULT + $? ) )
2009-05-19 04:56:52 +00:00
2011-08-09 20:28:48 +00:00
if [ [ $JENKINS = = "true" ] ] ; then
2009-09-15 13:17:07 +00:00
cleanUpXml
fi
2009-11-03 22:53:08 +00:00
checkTests
2009-05-19 04:56:52 +00:00
( ( RESULT = RESULT + $? ) )
applyPatch
2012-07-10 21:05:41 +00:00
APPLY_PATCH_RET = $?
( ( RESULT = RESULT + $APPLY_PATCH_RET ) )
if [ [ $APPLY_PATCH_RET != 0 ] ] ; then
2009-05-19 04:56:52 +00:00
submitJiraComment 1
cleanupAndExit 1
fi
checkJavacWarnings
2012-05-10 21:09:08 +00:00
JAVAC_RET = $?
#2 is returned if the code could not compile
if [ [ $JAVAC_RET = = 2 ] ] ; then
submitJiraComment 1
cleanupAndExit 1
fi
( ( RESULT = RESULT + $JAVAC_RET ) )
checkJavadocWarnings
2009-05-19 04:56:52 +00:00
( ( RESULT = RESULT + $? ) )
2010-11-02 05:33:05 +00:00
### Checkstyle not implemented yet
#checkStyle
#(( RESULT = RESULT + $? ))
2012-05-09 14:08:28 +00:00
buildAndInstall
2013-01-14 15:14:39 +00:00
checkEclipseGeneration
( ( RESULT = RESULT + $? ) )
2009-05-19 04:56:52 +00:00
checkFindbugsWarnings
( ( RESULT = RESULT + $? ) )
checkReleaseAuditWarnings
( ( RESULT = RESULT + $? ) )
2011-09-08 18:39:11 +00:00
### Run tests for Jenkins or if explictly asked for by a developer
if [ [ $JENKINS = = "true" || $RUN_TESTS = = "true" ] ] ; then
2011-08-24 21:35:38 +00:00
runTests
2009-05-19 04:56:52 +00:00
( ( RESULT = RESULT + $? ) )
fi
2010-10-25 18:59:28 +00:00
JIRA_COMMENT_FOOTER = " Test results: $BUILD_URL /testReport/
2009-05-19 04:56:52 +00:00
$JIRA_COMMENT_FOOTER "
submitJiraComment $RESULT
cleanupAndExit $RESULT