test-patch.sh 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. #!/usr/bin/env bash
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS,
  10. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. # See the License for the specific language governing permissions and
  12. # limitations under the License.
  13. #set -x
  14. ulimit -n 1024
  15. ### Setup some variables.
  16. ### BUILD_URL is set by Hudson if it is run by patch process
  17. ### Read variables from properties file
  18. bindir=$(dirname $0)
  19. # Defaults
  20. if [ -z "$MAVEN_HOME" ]; then
  21. MVN=mvn
  22. else
  23. MVN=$MAVEN_HOME/bin/mvn
  24. fi
  25. PROJECT_NAME=Hadoop
  26. JENKINS=false
  27. PATCH_DIR=/tmp
  28. SUPPORT_DIR=/tmp
  29. BASEDIR=$(pwd)
  30. BUILD_NATIVE=true
  31. PS=${PS:-ps}
  32. AWK=${AWK:-awk}
  33. WGET=${WGET:-wget}
  34. GIT=${GIT:-git}
  35. GREP=${GREP:-grep}
  36. PATCH=${PATCH:-patch}
  37. DIFF=${DIFF:-diff}
  38. JIRACLI=${JIRA:-jira}
  39. FINDBUGS_HOME=${FINDBUGS_HOME}
  40. FORREST_HOME=${FORREST_HOME}
  41. ECLIPSE_HOME=${ECLIPSE_HOME}
  42. ###############################################################################
  43. printUsage() {
  44. echo "Usage: $0 [options] patch-file | defect-number"
  45. echo
  46. echo "Where:"
  47. echo " patch-file is a local patch file containing the changes to test"
  48. echo " defect-number is a JIRA defect number (e.g. 'HADOOP-1234') to test (Jenkins only)"
  49. echo
  50. echo "Options:"
  51. echo "--patch-dir=<dir> The directory for working and output files (default '/tmp')"
  52. echo "--basedir=<dir> The directory to apply the patch to (default current directory)"
  53. echo "--mvn-cmd=<cmd> The 'mvn' command to use (default \$MAVEN_HOME/bin/mvn, or 'mvn')"
  54. echo "--ps-cmd=<cmd> The 'ps' command to use (default 'ps')"
  55. echo "--awk-cmd=<cmd> The 'awk' command to use (default 'awk')"
  56. echo "--git-cmd=<cmd> The 'git' command to use (default 'git')"
  57. echo "--grep-cmd=<cmd> The 'grep' command to use (default 'grep')"
  58. echo "--patch-cmd=<cmd> The 'patch' command to use (default 'patch')"
  59. echo "--diff-cmd=<cmd> The 'diff' command to use (default 'diff')"
  60. echo "--findbugs-home=<path> Findbugs home directory (default FINDBUGS_HOME environment variable)"
  61. echo "--forrest-home=<path> Forrest home directory (default FORREST_HOME environment variable)"
  62. echo "--dirty-workspace Allow the local git workspace to have uncommitted changes"
  63. echo "--run-tests Run all tests below the base directory"
  64. echo "--build-native=<bool> If true, then build native components (default 'true')"
  65. echo
  66. echo "Jenkins-only options:"
  67. echo "--jenkins Run by Jenkins (runs tests and posts results to JIRA)"
  68. echo "--support-dir=<dir> The directory to find support files in"
  69. echo "--wget-cmd=<cmd> The 'wget' command to use (default 'wget')"
  70. echo "--jira-cmd=<cmd> The 'jira' command to use (default 'jira')"
  71. echo "--jira-password=<pw> The password for the 'jira' command"
  72. echo "--eclipse-home=<path> Eclipse home directory (default ECLIPSE_HOME environment variable)"
  73. }
  74. ###############################################################################
  75. parseArgs() {
  76. for i in $*
  77. do
  78. case $i in
  79. --jenkins)
  80. JENKINS=true
  81. ;;
  82. --patch-dir=*)
  83. PATCH_DIR=${i#*=}
  84. ;;
  85. --support-dir=*)
  86. SUPPORT_DIR=${i#*=}
  87. ;;
  88. --basedir=*)
  89. BASEDIR=${i#*=}
  90. ;;
  91. --mvn-cmd=*)
  92. MVN=${i#*=}
  93. ;;
  94. --ps-cmd=*)
  95. PS=${i#*=}
  96. ;;
  97. --awk-cmd=*)
  98. AWK=${i#*=}
  99. ;;
  100. --wget-cmd=*)
  101. WGET=${i#*=}
  102. ;;
  103. --git-cmd=*)
  104. GIT=${i#*=}
  105. ;;
  106. --grep-cmd=*)
  107. GREP=${i#*=}
  108. ;;
  109. --patch-cmd=*)
  110. PATCH=${i#*=}
  111. ;;
  112. --diff-cmd=*)
  113. DIFF=${i#*=}
  114. ;;
  115. --jira-cmd=*)
  116. JIRACLI=${i#*=}
  117. ;;
  118. --jira-password=*)
  119. JIRA_PASSWD=${i#*=}
  120. ;;
  121. --findbugs-home=*)
  122. FINDBUGS_HOME=${i#*=}
  123. ;;
  124. --forrest-home=*)
  125. FORREST_HOME=${i#*=}
  126. ;;
  127. --eclipse-home=*)
  128. ECLIPSE_HOME=${i#*=}
  129. ;;
  130. --dirty-workspace)
  131. DIRTY_WORKSPACE=true
  132. ;;
  133. --run-tests)
  134. RUN_TESTS=true
  135. ;;
  136. --build-native=*)
  137. BUILD_NATIVE=${i#*=}
  138. ;;
  139. *)
  140. PATCH_OR_DEFECT=$i
  141. ;;
  142. esac
  143. done
  144. if [[ $BUILD_NATIVE == "true" ]] ; then
  145. NATIVE_PROFILE=-Pnative
  146. REQUIRE_TEST_LIB_HADOOP=-Drequire.test.libhadoop
  147. fi
  148. if [ -z "$PATCH_OR_DEFECT" ]; then
  149. printUsage
  150. exit 1
  151. fi
  152. if [[ $JENKINS == "true" ]] ; then
  153. echo "Running in Jenkins mode"
  154. defect=$PATCH_OR_DEFECT
  155. ECLIPSE_PROPERTY="-Declipse.home=$ECLIPSE_HOME"
  156. else
  157. echo "Running in developer mode"
  158. JENKINS=false
  159. ### PATCH_FILE contains the location of the patchfile
  160. PATCH_FILE=$PATCH_OR_DEFECT
  161. if [[ ! -e "$PATCH_FILE" ]] ; then
  162. echo "Unable to locate the patch file $PATCH_FILE"
  163. cleanupAndExit 0
  164. fi
  165. ### Check if $PATCH_DIR exists. If it does not exist, create a new directory
  166. if [[ ! -e "$PATCH_DIR" ]] ; then
  167. mkdir "$PATCH_DIR"
  168. if [[ $? == 0 ]] ; then
  169. echo "$PATCH_DIR has been created"
  170. else
  171. echo "Unable to create $PATCH_DIR"
  172. cleanupAndExit 0
  173. fi
  174. fi
  175. ### Obtain the patch filename to append it to the version number
  176. defect=`basename $PATCH_FILE`
  177. fi
  178. }
  179. ###############################################################################
  180. checkout () {
  181. echo ""
  182. echo ""
  183. echo "======================================================================"
  184. echo "======================================================================"
  185. echo " Testing patch for ${defect}."
  186. echo "======================================================================"
  187. echo "======================================================================"
  188. echo ""
  189. echo ""
  190. ### When run by a developer, if the workspace contains modifications, do not continue
  191. ### unless the --dirty-workspace option was set
  192. status=`$GIT status --porcelain`
  193. if [[ $JENKINS == "false" ]] ; then
  194. if [[ "$status" != "" && -z $DIRTY_WORKSPACE ]] ; then
  195. echo "ERROR: can't run in a workspace that contains the following modifications"
  196. echo "$status"
  197. cleanupAndExit 1
  198. fi
  199. echo
  200. else
  201. cd $BASEDIR
  202. $GIT reset --hard
  203. $GIT clean -xdf
  204. $GIT checkout trunk
  205. $GIT pull --rebase
  206. fi
  207. GIT_REVISION=`git rev-parse --verify --short HEAD`
  208. return $?
  209. }
  210. ###############################################################################
  211. downloadPatch () {
  212. ### Download latest patch file (ignoring .htm and .html) when run from patch process
  213. if [[ $JENKINS == "true" ]] ; then
  214. $WGET -q -O $PATCH_DIR/jira http://issues.apache.org/jira/browse/$defect
  215. if [[ `$GREP -c 'Patch Available' $PATCH_DIR/jira` == 0 ]] ; then
  216. echo "$defect is not \"Patch Available\". Exiting."
  217. cleanupAndExit 0
  218. fi
  219. 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]*/[^"]*'`
  220. patchURL="http://issues.apache.org${relativePatchURL}"
  221. patchNum=`echo $patchURL | $GREP -o '[0-9]*/' | $GREP -o '[0-9]*'`
  222. echo "$defect patch is being downloaded at `date` from"
  223. echo "$patchURL"
  224. $WGET -q -O $PATCH_DIR/patch $patchURL
  225. VERSION=${GIT_REVISION}_${defect}_PATCH-${patchNum}
  226. JIRA_COMMENT="Here are the results of testing the latest attachment
  227. $patchURL
  228. against trunk revision ${GIT_REVISION}."
  229. ### Copy in any supporting files needed by this process
  230. cp -r $SUPPORT_DIR/lib/* ./lib
  231. #PENDING: cp -f $SUPPORT_DIR/etc/checkstyle* ./src/test
  232. ### Copy the patch file to $PATCH_DIR
  233. else
  234. VERSION=PATCH-${defect}
  235. cp $PATCH_FILE $PATCH_DIR/patch
  236. if [[ $? == 0 ]] ; then
  237. echo "Patch file $PATCH_FILE copied to $PATCH_DIR"
  238. else
  239. echo "Could not copy $PATCH_FILE to $PATCH_DIR"
  240. cleanupAndExit 0
  241. fi
  242. fi
  243. }
  244. ###############################################################################
  245. verifyPatch () {
  246. # Before building, check to make sure that the patch is valid
  247. $bindir/smart-apply-patch.sh $PATCH_DIR/patch dryrun
  248. if [[ $? != 0 ]] ; then
  249. echo "PATCH APPLICATION FAILED"
  250. JIRA_COMMENT="$JIRA_COMMENT
  251. {color:red}-1 patch{color}. The patch command could not apply the patch."
  252. return 1
  253. else
  254. return 0
  255. fi
  256. }
  257. ###############################################################################
  258. prebuildWithoutPatch () {
  259. echo ""
  260. echo ""
  261. echo "======================================================================"
  262. echo "======================================================================"
  263. echo " Pre-build trunk to verify trunk stability and javac warnings"
  264. echo "======================================================================"
  265. echo "======================================================================"
  266. echo ""
  267. echo ""
  268. if [[ ! -d hadoop-common-project ]]; then
  269. cd $bindir/..
  270. echo "Compiling $(pwd)"
  271. echo "$MVN clean test -DskipTests > $PATCH_DIR/trunkCompile.txt 2>&1"
  272. $MVN clean test -DskipTests > $PATCH_DIR/trunkCompile.txt 2>&1
  273. if [[ $? != 0 ]] ; then
  274. echo "Top-level trunk compilation is broken?"
  275. JIRA_COMMENT="$JIRA_COMMENT
  276. {color:red}-1 patch{color}. Top-level trunk compilation may be broken."
  277. return 1
  278. fi
  279. cd -
  280. fi
  281. echo "Compiling $(pwd)"
  282. echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess -Ptest-patch > $PATCH_DIR/trunkJavacWarnings.txt 2>&1"
  283. $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess -Ptest-patch > $PATCH_DIR/trunkJavacWarnings.txt 2>&1
  284. if [[ $? != 0 ]] ; then
  285. echo "Trunk compilation is broken?"
  286. JIRA_COMMENT="$JIRA_COMMENT
  287. {color:red}-1 patch{color}. Trunk compilation may be broken."
  288. return 1
  289. fi
  290. echo "$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavadocWarnings.txt 2>&1"
  291. $MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavadocWarnings.txt 2>&1
  292. if [[ $? != 0 ]] ; then
  293. echo "Trunk javadoc compilation is broken?"
  294. JIRA_COMMENT="$JIRA_COMMENT
  295. {color:red}-1 patch{color}. Trunk compilation may be broken."
  296. return 1
  297. fi
  298. return 0
  299. }
  300. ###############################################################################
  301. ### Check for @author tags in the patch
  302. checkAuthor () {
  303. echo ""
  304. echo ""
  305. echo "======================================================================"
  306. echo "======================================================================"
  307. echo " Checking there are no @author tags in the patch."
  308. echo "======================================================================"
  309. echo "======================================================================"
  310. echo ""
  311. echo ""
  312. authorTags=`$GREP -c -i '@author' $PATCH_DIR/patch`
  313. echo "There appear to be $authorTags @author tags in the patch."
  314. if [[ $authorTags != 0 ]] ; then
  315. JIRA_COMMENT="$JIRA_COMMENT
  316. {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."
  317. return 1
  318. fi
  319. JIRA_COMMENT="$JIRA_COMMENT
  320. {color:green}+1 @author{color}. The patch does not contain any @author tags."
  321. return 0
  322. }
  323. ###############################################################################
  324. ### Check for tests in the patch
  325. checkTests () {
  326. echo ""
  327. echo ""
  328. echo "======================================================================"
  329. echo "======================================================================"
  330. echo " Checking there are new or changed tests in the patch."
  331. echo "======================================================================"
  332. echo "======================================================================"
  333. echo ""
  334. echo ""
  335. testReferences=`$GREP -c -i -e '^+++.*/test' $PATCH_DIR/patch`
  336. echo "There appear to be $testReferences test files referenced in the patch."
  337. if [[ $testReferences == 0 ]] ; then
  338. if [[ $JENKINS == "true" ]] ; then
  339. patchIsDoc=`$GREP -c -i 'title="documentation' $PATCH_DIR/jira`
  340. if [[ $patchIsDoc != 0 ]] ; then
  341. echo "The patch appears to be a documentation patch that doesn't require tests."
  342. JIRA_COMMENT="$JIRA_COMMENT
  343. {color:green}+0 tests included{color}. The patch appears to be a documentation patch that doesn't require tests."
  344. return 0
  345. fi
  346. fi
  347. JIRA_COMMENT="$JIRA_COMMENT
  348. {color:red}-1 tests included{color}. The patch doesn't appear to include any new or modified tests.
  349. Please justify why no new tests are needed for this patch.
  350. Also please list what manual steps were performed to verify this patch."
  351. return 1
  352. fi
  353. JIRA_COMMENT="$JIRA_COMMENT
  354. {color:green}+1 tests included{color}. The patch appears to include $testReferences new or modified test files."
  355. return 0
  356. }
  357. cleanUpXml () {
  358. cd $BASEDIR/conf
  359. for file in `ls *.xml.template`
  360. do
  361. rm -f `basename $file .template`
  362. done
  363. cd $BASEDIR
  364. }
  365. ###############################################################################
  366. ### Attempt to apply the patch
  367. applyPatch () {
  368. echo ""
  369. echo ""
  370. echo "======================================================================"
  371. echo "======================================================================"
  372. echo " Applying patch."
  373. echo "======================================================================"
  374. echo "======================================================================"
  375. echo ""
  376. echo ""
  377. export PATCH
  378. $bindir/smart-apply-patch.sh $PATCH_DIR/patch
  379. if [[ $? != 0 ]] ; then
  380. echo "PATCH APPLICATION FAILED"
  381. JIRA_COMMENT="$JIRA_COMMENT
  382. {color:red}-1 patch{color}. The patch command could not apply the patch."
  383. return 1
  384. fi
  385. return 0
  386. }
  387. ###############################################################################
  388. calculateJavadocWarnings() {
  389. WARNING_FILE="$1"
  390. RET=$(egrep "^[0-9]+ warnings$" "$WARNING_FILE" | awk '{sum+=$1} END {print sum}')
  391. }
  392. ### Check there are no javadoc warnings
  393. checkJavadocWarnings () {
  394. echo ""
  395. echo ""
  396. echo "======================================================================"
  397. echo "======================================================================"
  398. echo " Determining number of patched javadoc warnings."
  399. echo "======================================================================"
  400. echo "======================================================================"
  401. echo ""
  402. echo ""
  403. echo "$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1"
  404. if [ -d hadoop-project ]; then
  405. (cd hadoop-project; $MVN install > /dev/null 2>&1)
  406. fi
  407. if [ -d hadoop-common-project/hadoop-annotations ]; then
  408. (cd hadoop-common-project/hadoop-annotations; $MVN install > /dev/null 2>&1)
  409. fi
  410. $MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1
  411. calculateJavadocWarnings "$PATCH_DIR/trunkJavadocWarnings.txt"
  412. numTrunkJavadocWarnings=$RET
  413. calculateJavadocWarnings "$PATCH_DIR/patchJavadocWarnings.txt"
  414. numPatchJavadocWarnings=$RET
  415. grep -i warning "$PATCH_DIR/trunkJavadocWarnings.txt" > "$PATCH_DIR/trunkJavadocWarningsFiltered.txt"
  416. grep -i warning "$PATCH_DIR/patchJavadocWarnings.txt" > "$PATCH_DIR/patchJavadocWarningsFiltered.txt"
  417. diff -u "$PATCH_DIR/trunkJavadocWarningsFiltered.txt" \
  418. "$PATCH_DIR/patchJavadocWarningsFiltered.txt" > \
  419. "$PATCH_DIR/diffJavadocWarnings.txt"
  420. rm -f "$PATCH_DIR/trunkJavadocWarningsFiltered.txt" "$PATCH_DIR/patchJavadocWarningsFiltered.txt"
  421. echo "There appear to be $numTrunkJavadocWarnings javadoc warnings before the patch and $numPatchJavadocWarnings javadoc warnings after applying the patch."
  422. if [[ $numTrunkJavadocWarnings != "" && $numPatchJavadocWarnings != "" ]] ; then
  423. if [[ $numPatchJavadocWarnings -gt $numTrunkJavadocWarnings ]] ; then
  424. JIRA_COMMENT="$JIRA_COMMENT
  425. {color:red}-1 javadoc{color}. The javadoc tool appears to have generated `expr $(($numPatchJavadocWarnings-$numTrunkJavadocWarnings))` warning messages.
  426. See $BUILD_URL/artifact/patchprocess/diffJavadocWarnings.txt for details."
  427. return 1
  428. fi
  429. fi
  430. JIRA_COMMENT="$JIRA_COMMENT
  431. {color:green}+1 javadoc{color}. There were no new javadoc warning messages."
  432. return 0
  433. }
  434. ###############################################################################
  435. ### Check there are no changes in the number of Javac warnings
  436. checkJavacWarnings () {
  437. echo ""
  438. echo ""
  439. echo "======================================================================"
  440. echo "======================================================================"
  441. echo " Determining number of patched javac warnings."
  442. echo "======================================================================"
  443. echo "======================================================================"
  444. echo ""
  445. echo ""
  446. echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1"
  447. $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1
  448. if [[ $? != 0 ]] ; then
  449. JIRA_COMMENT="$JIRA_COMMENT
  450. {color:red}-1 javac{color:red}. The patch appears to cause the build to fail."
  451. return 2
  452. fi
  453. ### Compare trunk and patch javac warning numbers
  454. if [[ -f $PATCH_DIR/patchJavacWarnings.txt ]] ; then
  455. $GREP '\[WARNING\]' $PATCH_DIR/trunkJavacWarnings.txt > $PATCH_DIR/filteredTrunkJavacWarnings.txt
  456. $GREP '\[WARNING\]' $PATCH_DIR/patchJavacWarnings.txt > $PATCH_DIR/filteredPatchJavacWarnings.txt
  457. trunkJavacWarnings=`cat $PATCH_DIR/filteredTrunkJavacWarnings.txt | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'`
  458. patchJavacWarnings=`cat $PATCH_DIR/filteredPatchJavacWarnings.txt | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'`
  459. echo "There appear to be $trunkJavacWarnings javac compiler warnings before the patch and $patchJavacWarnings javac compiler warnings after applying the patch."
  460. if [[ $patchJavacWarnings != "" && $trunkJavacWarnings != "" ]] ; then
  461. if [[ $patchJavacWarnings -gt $trunkJavacWarnings ]] ; then
  462. JIRA_COMMENT="$JIRA_COMMENT
  463. {color:red}-1 javac{color}. The applied patch generated $patchJavacWarnings javac compiler warnings (more than the trunk's current $trunkJavacWarnings warnings)."
  464. $DIFF $PATCH_DIR/filteredTrunkJavacWarnings.txt $PATCH_DIR/filteredPatchJavacWarnings.txt > $PATCH_DIR/diffJavacWarnings.txt
  465. JIRA_COMMENT_FOOTER="Javac warnings: $BUILD_URL/artifact/patchprocess/diffJavacWarnings.txt
  466. $JIRA_COMMENT_FOOTER"
  467. return 1
  468. fi
  469. fi
  470. fi
  471. JIRA_COMMENT="$JIRA_COMMENT
  472. {color:green}+1 javac{color}. The applied patch does not increase the total number of javac compiler warnings."
  473. return 0
  474. }
  475. ###############################################################################
  476. ### Check there are no changes in the number of release audit (RAT) warnings
  477. checkReleaseAuditWarnings () {
  478. echo ""
  479. echo ""
  480. echo "======================================================================"
  481. echo "======================================================================"
  482. echo " Determining number of patched release audit warnings."
  483. echo "======================================================================"
  484. echo "======================================================================"
  485. echo ""
  486. echo ""
  487. echo "$MVN apache-rat:check -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchReleaseAuditOutput.txt 2>&1"
  488. $MVN apache-rat:check -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchReleaseAuditOutput.txt 2>&1
  489. find $BASEDIR -name rat.txt | xargs cat > $PATCH_DIR/patchReleaseAuditWarnings.txt
  490. ### Compare trunk and patch release audit warning numbers
  491. if [[ -f $PATCH_DIR/patchReleaseAuditWarnings.txt ]] ; then
  492. patchReleaseAuditWarnings=`$GREP -c '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt`
  493. echo ""
  494. echo ""
  495. echo "There appear to be $patchReleaseAuditWarnings release audit warnings after applying the patch."
  496. if [[ $patchReleaseAuditWarnings != "" ]] ; then
  497. if [[ $patchReleaseAuditWarnings -gt 0 ]] ; then
  498. JIRA_COMMENT="$JIRA_COMMENT
  499. {color:red}-1 release audit{color}. The applied patch generated $patchReleaseAuditWarnings release audit warnings."
  500. $GREP '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt > $PATCH_DIR/patchReleaseAuditProblems.txt
  501. echo "Lines that start with ????? in the release audit report indicate files that do not have an Apache license header." >> $PATCH_DIR/patchReleaseAuditProblems.txt
  502. JIRA_COMMENT_FOOTER="Release audit warnings: $BUILD_URL/artifact/patchprocess/patchReleaseAuditProblems.txt
  503. $JIRA_COMMENT_FOOTER"
  504. return 1
  505. fi
  506. fi
  507. fi
  508. JIRA_COMMENT="$JIRA_COMMENT
  509. {color:green}+1 release audit{color}. The applied patch does not increase the total number of release audit warnings."
  510. return 0
  511. }
  512. ###############################################################################
  513. ### Check there are no changes in the number of Checkstyle warnings
  514. checkStyle () {
  515. echo ""
  516. echo ""
  517. echo "======================================================================"
  518. echo "======================================================================"
  519. echo " Determining number of patched checkstyle warnings."
  520. echo "======================================================================"
  521. echo "======================================================================"
  522. echo ""
  523. echo ""
  524. echo "THIS IS NOT IMPLEMENTED YET"
  525. echo ""
  526. echo ""
  527. echo "$MVN test checkstyle:checkstyle -DskipTests -D${PROJECT_NAME}PatchProcess"
  528. $MVN test checkstyle:checkstyle -DskipTests -D${PROJECT_NAME}PatchProcess
  529. JIRA_COMMENT_FOOTER="Checkstyle results: $BUILD_URL/artifact/trunk/build/test/checkstyle-errors.html
  530. $JIRA_COMMENT_FOOTER"
  531. ### TODO: calculate actual patchStyleErrors
  532. # patchStyleErrors=0
  533. # if [[ $patchStyleErrors != 0 ]] ; then
  534. # JIRA_COMMENT="$JIRA_COMMENT
  535. #
  536. # {color:red}-1 checkstyle{color}. The patch generated $patchStyleErrors code style errors."
  537. # return 1
  538. # fi
  539. # JIRA_COMMENT="$JIRA_COMMENT
  540. #
  541. # {color:green}+1 checkstyle{color}. The patch generated 0 code style errors."
  542. return 0
  543. }
  544. ###############################################################################
  545. ### Install the new jars so tests and findbugs can find all of the updated jars
  546. buildAndInstall () {
  547. echo ""
  548. echo ""
  549. echo "======================================================================"
  550. echo "======================================================================"
  551. echo " Installing all of the jars"
  552. echo "======================================================================"
  553. echo "======================================================================"
  554. echo ""
  555. echo ""
  556. echo "$MVN install -Dmaven.javadoc.skip=true -DskipTests -D${PROJECT_NAME}PatchProcess"
  557. $MVN install -Dmaven.javadoc.skip=true -DskipTests -D${PROJECT_NAME}PatchProcess
  558. return $?
  559. }
  560. ###############################################################################
  561. ### Check there are no changes in the number of Findbugs warnings
  562. checkFindbugsWarnings () {
  563. findbugs_version=`${FINDBUGS_HOME}/bin/findbugs -version`
  564. echo ""
  565. echo ""
  566. echo "======================================================================"
  567. echo "======================================================================"
  568. echo " Determining number of patched Findbugs warnings."
  569. echo "======================================================================"
  570. echo "======================================================================"
  571. echo ""
  572. echo ""
  573. modules=$(findModules)
  574. rc=0
  575. for module in $modules;
  576. do
  577. cd $module
  578. echo " Running findbugs in $module"
  579. module_suffix=`basename ${module}`
  580. echo "$MVN clean test findbugs:findbugs -DskipTests -D${PROJECT_NAME}PatchProcess < /dev/null > $PATCH_DIR/patchFindBugsOutput${module_suffix}.txt 2>&1"
  581. $MVN clean test findbugs:findbugs -DskipTests -D${PROJECT_NAME}PatchProcess < /dev/null > $PATCH_DIR/patchFindBugsOutput${module_suffix}.txt 2>&1
  582. (( rc = rc + $? ))
  583. cd -
  584. done
  585. if [ $rc != 0 ] ; then
  586. JIRA_COMMENT="$JIRA_COMMENT
  587. {color:red}-1 findbugs{color}. The patch appears to cause Findbugs (version ${findbugs_version}) to fail."
  588. return 1
  589. fi
  590. findbugsWarnings=0
  591. for file in $(find $BASEDIR -name findbugsXml.xml)
  592. do
  593. relative_file=${file#$BASEDIR/} # strip leading $BASEDIR prefix
  594. if [ ! $relative_file == "target/findbugsXml.xml" ]; then
  595. module_suffix=${relative_file%/target/findbugsXml.xml} # strip trailing path
  596. module_suffix=`basename ${module_suffix}`
  597. fi
  598. cp $file $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
  599. $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
  600. $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
  601. $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
  602. newFindbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
  603. $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml | $AWK '{print $1}'`
  604. echo "Found $newFindbugsWarnings Findbugs warnings ($file)"
  605. findbugsWarnings=$((findbugsWarnings+newFindbugsWarnings))
  606. $FINDBUGS_HOME/bin/convertXmlToText -html \
  607. $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml \
  608. $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.html
  609. if [[ $newFindbugsWarnings > 0 ]] ; then
  610. JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/patchprocess/newPatchFindbugsWarnings${module_suffix}.html
  611. $JIRA_COMMENT_FOOTER"
  612. fi
  613. done
  614. if [[ $findbugsWarnings -gt 0 ]] ; then
  615. JIRA_COMMENT="$JIRA_COMMENT
  616. {color:red}-1 findbugs{color}. The patch appears to introduce $findbugsWarnings new Findbugs (version ${findbugs_version}) warnings."
  617. return 1
  618. fi
  619. JIRA_COMMENT="$JIRA_COMMENT
  620. {color:green}+1 findbugs{color}. The patch does not introduce any new Findbugs (version ${findbugs_version}) warnings."
  621. return 0
  622. }
  623. ###############################################################################
  624. ### Verify eclipse:eclipse works
  625. checkEclipseGeneration () {
  626. echo ""
  627. echo ""
  628. echo "======================================================================"
  629. echo "======================================================================"
  630. echo " Running mvn eclipse:eclipse."
  631. echo "======================================================================"
  632. echo "======================================================================"
  633. echo ""
  634. echo ""
  635. echo "$MVN eclipse:eclipse -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchEclipseOutput.txt 2>&1"
  636. $MVN eclipse:eclipse -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchEclipseOutput.txt 2>&1
  637. if [[ $? != 0 ]] ; then
  638. JIRA_COMMENT="$JIRA_COMMENT
  639. {color:red}-1 eclipse:eclipse{color}. The patch failed to build with eclipse:eclipse."
  640. return 1
  641. fi
  642. JIRA_COMMENT="$JIRA_COMMENT
  643. {color:green}+1 eclipse:eclipse{color}. The patch built with eclipse:eclipse."
  644. return 0
  645. }
  646. ###############################################################################
  647. ### Run the tests
  648. runTests () {
  649. echo ""
  650. echo ""
  651. echo "======================================================================"
  652. echo "======================================================================"
  653. echo " Running tests."
  654. echo "======================================================================"
  655. echo "======================================================================"
  656. echo ""
  657. echo ""
  658. failed_tests=""
  659. modules=$(findModules)
  660. #
  661. # If we are building hadoop-hdfs-project, we must build the native component
  662. # of hadoop-common-project first. In order to accomplish this, we move the
  663. # hadoop-hdfs subprojects to the end of the list so that common will come
  664. # first.
  665. #
  666. # Of course, we may not be building hadoop-common at all-- in this case, we
  667. # explicitly insert a mvn compile -Pnative of common, to ensure that the
  668. # native libraries show up where we need them.
  669. #
  670. building_common=0
  671. for module in $modules; do
  672. if [[ $module == hadoop-hdfs-project* ]]; then
  673. hdfs_modules="$hdfs_modules $module"
  674. elif [[ $module == hadoop-common-project* ]]; then
  675. ordered_modules="$ordered_modules $module"
  676. building_common=1
  677. else
  678. ordered_modules="$ordered_modules $module"
  679. fi
  680. done
  681. if [ -n "$hdfs_modules" ]; then
  682. ordered_modules="$ordered_modules $hdfs_modules"
  683. if [[ $building_common -eq 0 ]]; then
  684. echo " Building hadoop-common with -Pnative in order to provide \
  685. libhadoop.so to the hadoop-hdfs unit tests."
  686. echo " $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess"
  687. if ! $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess; then
  688. JIRA_COMMENT="$JIRA_COMMENT
  689. {color:red}-1 core tests{color}. Failed to build the native portion \
  690. of hadoop-common prior to running the unit tests in $ordered_modules"
  691. return 1
  692. fi
  693. fi
  694. fi
  695. failed_test_builds=""
  696. test_timeouts=""
  697. for module in $ordered_modules; do
  698. cd $module
  699. module_suffix=`basename ${module}`
  700. test_logfile=$PATCH_DIR/testrun_${module_suffix}.txt
  701. echo " Running tests in $module"
  702. echo " $MVN clean install -fn $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${PROJECT_NAME}PatchProcess"
  703. $MVN clean install -fae $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${PROJECT_NAME}PatchProcess > $test_logfile 2>&1
  704. test_build_result=$?
  705. cat $test_logfile
  706. module_test_timeouts=`$AWK '/^Running / { if (last) { print last } last=$2 } /^Tests run: / { last="" }' $test_logfile`
  707. if [[ -n "$module_test_timeouts" ]] ; then
  708. test_timeouts="$test_timeouts
  709. $module_test_timeouts"
  710. fi
  711. 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"`
  712. if [[ -n "$module_failed_tests" ]] ; then
  713. failed_tests="${failed_tests}
  714. ${module_failed_tests}"
  715. fi
  716. if [[ $test_build_result != 0 && -z "$module_failed_tests" && -z "$module_test_timeouts" ]] ; then
  717. failed_test_builds="$module $failed_test_builds"
  718. fi
  719. cd -
  720. done
  721. result=0
  722. comment_prefix=" {color:red}-1 core tests{color}."
  723. if [[ -n "$failed_tests" ]] ; then
  724. JIRA_COMMENT="$JIRA_COMMENT
  725. $comment_prefix The patch failed these unit tests in $modules:
  726. $failed_tests"
  727. comment_prefix=" "
  728. result=1
  729. fi
  730. if [[ -n "$test_timeouts" ]] ; then
  731. JIRA_COMMENT="$JIRA_COMMENT
  732. $comment_prefix The following test timeouts occurred in $modules:
  733. $test_timeouts"
  734. comment_prefix=" "
  735. result=1
  736. fi
  737. if [[ -n "$failed_test_builds" ]] ; then
  738. JIRA_COMMENT="$JIRA_COMMENT
  739. $comment_prefix The test build failed in $failed_test_builds"
  740. result=1
  741. fi
  742. if [[ $result == 0 ]] ; then
  743. JIRA_COMMENT="$JIRA_COMMENT
  744. {color:green}+1 core tests{color}. The patch passed unit tests in $modules."
  745. fi
  746. return $result
  747. }
  748. ###############################################################################
  749. # Find the maven module containing the given file.
  750. findModule (){
  751. dir=`dirname $1`
  752. while [ 1 ]
  753. do
  754. if [ -f "$dir/pom.xml" ]
  755. then
  756. echo $dir
  757. return
  758. else
  759. dir=`dirname $dir`
  760. fi
  761. done
  762. }
  763. findModules () {
  764. # Come up with a list of changed files into $TMP
  765. TMP=/tmp/tmp.paths.$$
  766. $GREP '^+++ \|^--- ' $PATCH_DIR/patch | cut -c '5-' | $GREP -v /dev/null | sort | uniq > $TMP
  767. # if all of the lines start with a/ or b/, then this is a git patch that
  768. # was generated without --no-prefix
  769. if ! $GREP -qv '^a/\|^b/' $TMP ; then
  770. sed -i -e 's,^[ab]/,,' $TMP
  771. fi
  772. # Now find all the modules that were changed
  773. TMP_MODULES=/tmp/tmp.modules.$$
  774. for file in $(cut -f 1 $TMP | sort | uniq); do
  775. echo $(findModule $file) >> $TMP_MODULES
  776. done
  777. rm $TMP
  778. # Filter out modules without code
  779. CHANGED_MODULES=""
  780. for module in $(cat $TMP_MODULES | sort | uniq); do
  781. $GREP "<packaging>pom</packaging>" $module/pom.xml > /dev/null
  782. if [ "$?" != 0 ]; then
  783. CHANGED_MODULES="$CHANGED_MODULES $module"
  784. fi
  785. done
  786. rm $TMP_MODULES
  787. echo $CHANGED_MODULES
  788. }
  789. ###############################################################################
  790. ### Run the test-contrib target
  791. runContribTests () {
  792. echo ""
  793. echo ""
  794. echo "======================================================================"
  795. echo "======================================================================"
  796. echo " Running contrib tests."
  797. echo "======================================================================"
  798. echo "======================================================================"
  799. echo ""
  800. echo ""
  801. if [[ `$GREP -c 'test-contrib' build.xml` == 0 ]] ; then
  802. echo "No contrib tests in this project."
  803. return 0
  804. fi
  805. ### Kill any rogue build processes from the last attempt
  806. $PS auxwww | $GREP ${PROJECT_NAME}PatchProcess | $AWK '{print $2}' | /usr/bin/xargs -t -I {} /bin/kill -9 {} > /dev/null
  807. #echo "$ANT_HOME/bin/ant -Dversion="${VERSION}" $ECLIPSE_PROPERTY -DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=no test-contrib"
  808. #$ANT_HOME/bin/ant -Dversion="${VERSION}" $ECLIPSE_PROPERTY -DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=no test-contrib
  809. echo "NOP"
  810. if [[ $? != 0 ]] ; then
  811. JIRA_COMMENT="$JIRA_COMMENT
  812. {color:red}-1 contrib tests{color}. The patch failed contrib unit tests."
  813. return 1
  814. fi
  815. JIRA_COMMENT="$JIRA_COMMENT
  816. {color:green}+1 contrib tests{color}. The patch passed contrib unit tests."
  817. return 0
  818. }
  819. ###############################################################################
  820. ### Run the inject-system-faults target
  821. checkInjectSystemFaults () {
  822. echo ""
  823. echo ""
  824. echo "======================================================================"
  825. echo "======================================================================"
  826. echo " Checking the integrity of system test framework code."
  827. echo "======================================================================"
  828. echo "======================================================================"
  829. echo ""
  830. echo ""
  831. ### Kill any rogue build processes from the last attempt
  832. $PS auxwww | $GREP ${PROJECT_NAME}PatchProcess | $AWK '{print $2}' | /usr/bin/xargs -t -I {} /bin/kill -9 {} > /dev/null
  833. #echo "$ANT_HOME/bin/ant -Dversion="${VERSION}" -DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=no -Dcompile.c++=yes -Dforrest.home=$FORREST_HOME inject-system-faults"
  834. #$ANT_HOME/bin/ant -Dversion="${VERSION}" -DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=no -Dcompile.c++=yes -Dforrest.home=$FORREST_HOME inject-system-faults
  835. echo "NOP"
  836. return 0
  837. if [[ $? != 0 ]] ; then
  838. JIRA_COMMENT="$JIRA_COMMENT
  839. {color:red}-1 system test framework{color}. The patch failed system test framework compile."
  840. return 1
  841. fi
  842. JIRA_COMMENT="$JIRA_COMMENT
  843. {color:green}+1 system test framework{color}. The patch passed system test framework compile."
  844. return 0
  845. }
  846. ###############################################################################
  847. ### Submit a comment to the defect's Jira
  848. submitJiraComment () {
  849. local result=$1
  850. ### Do not output the value of JIRA_COMMENT_FOOTER when run by a developer
  851. if [[ $JENKINS == "false" ]] ; then
  852. JIRA_COMMENT_FOOTER=""
  853. fi
  854. if [[ $result == 0 ]] ; then
  855. comment="{color:green}+1 overall{color}. $JIRA_COMMENT
  856. $JIRA_COMMENT_FOOTER"
  857. else
  858. comment="{color:red}-1 overall{color}. $JIRA_COMMENT
  859. $JIRA_COMMENT_FOOTER"
  860. fi
  861. ### Output the test result to the console
  862. echo "
  863. $comment"
  864. if [[ $JENKINS == "true" ]] ; then
  865. echo ""
  866. echo ""
  867. echo "======================================================================"
  868. echo "======================================================================"
  869. echo " Adding comment to Jira."
  870. echo "======================================================================"
  871. echo "======================================================================"
  872. echo ""
  873. echo ""
  874. ### Update Jira with a comment
  875. export USER=hudson
  876. $JIRACLI -s https://issues.apache.org/jira -a addcomment -u hadoopqa -p $JIRA_PASSWD --comment "$comment" --issue $defect
  877. $JIRACLI -s https://issues.apache.org/jira -a logout -u hadoopqa -p $JIRA_PASSWD
  878. fi
  879. }
  880. ###############################################################################
  881. ### Cleanup files
  882. cleanupAndExit () {
  883. local result=$1
  884. if [[ $JENKINS == "true" ]] ; then
  885. if [ -e "$PATCH_DIR" ] ; then
  886. mv $PATCH_DIR $BASEDIR
  887. fi
  888. fi
  889. echo ""
  890. echo ""
  891. echo "======================================================================"
  892. echo "======================================================================"
  893. echo " Finished build."
  894. echo "======================================================================"
  895. echo "======================================================================"
  896. echo ""
  897. echo ""
  898. exit $result
  899. }
  900. ###############################################################################
  901. ###############################################################################
  902. ###############################################################################
  903. JIRA_COMMENT=""
  904. JIRA_COMMENT_FOOTER="Console output: $BUILD_URL/console
  905. This message is automatically generated."
  906. ### Check if arguments to the script have been specified properly or not
  907. parseArgs $@
  908. cd $BASEDIR
  909. checkout
  910. RESULT=$?
  911. if [[ $JENKINS == "true" ]] ; then
  912. if [[ $RESULT != 0 ]] ; then
  913. exit 100
  914. fi
  915. fi
  916. downloadPatch
  917. verifyPatch
  918. (( RESULT = RESULT + $? ))
  919. if [[ $RESULT != 0 ]] ; then
  920. submitJiraComment 1
  921. cleanupAndExit 1
  922. fi
  923. prebuildWithoutPatch
  924. (( RESULT = RESULT + $? ))
  925. if [[ $RESULT != 0 ]] ; then
  926. submitJiraComment 1
  927. cleanupAndExit 1
  928. fi
  929. checkAuthor
  930. (( RESULT = RESULT + $? ))
  931. if [[ $JENKINS == "true" ]] ; then
  932. cleanUpXml
  933. fi
  934. checkTests
  935. (( RESULT = RESULT + $? ))
  936. applyPatch
  937. APPLY_PATCH_RET=$?
  938. (( RESULT = RESULT + $APPLY_PATCH_RET ))
  939. if [[ $APPLY_PATCH_RET != 0 ]] ; then
  940. submitJiraComment 1
  941. cleanupAndExit 1
  942. fi
  943. checkJavacWarnings
  944. JAVAC_RET=$?
  945. #2 is returned if the code could not compile
  946. if [[ $JAVAC_RET == 2 ]] ; then
  947. submitJiraComment 1
  948. cleanupAndExit 1
  949. fi
  950. (( RESULT = RESULT + $JAVAC_RET ))
  951. checkJavadocWarnings
  952. (( RESULT = RESULT + $? ))
  953. ### Checkstyle not implemented yet
  954. #checkStyle
  955. #(( RESULT = RESULT + $? ))
  956. buildAndInstall
  957. checkEclipseGeneration
  958. (( RESULT = RESULT + $? ))
  959. checkFindbugsWarnings
  960. (( RESULT = RESULT + $? ))
  961. checkReleaseAuditWarnings
  962. (( RESULT = RESULT + $? ))
  963. ### Run tests for Jenkins or if explictly asked for by a developer
  964. if [[ $JENKINS == "true" || $RUN_TESTS == "true" ]] ; then
  965. runTests
  966. (( RESULT = RESULT + $? ))
  967. runContribTests
  968. (( RESULT = RESULT + $? ))
  969. fi
  970. checkInjectSystemFaults
  971. (( RESULT = RESULT + $? ))
  972. JIRA_COMMENT_FOOTER="Test results: $BUILD_URL/testReport/
  973. $JIRA_COMMENT_FOOTER"
  974. submitJiraComment $RESULT
  975. cleanupAndExit $RESULT