test-patch.sh 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  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. ### SVN_REVISION and BUILD_URL are 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. SVN=${SVN:-svn}
  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 "--svn-cmd=<cmd> The 'svn' command to use (default 'svn')"
  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 SVN 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. --svn-cmd=*)
  104. SVN=${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=`$SVN stat --ignore-externals | sed -e '/^X[ ]*/D'`
  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. $SVN revert -R .
  203. rm -rf `$SVN status --no-ignore`
  204. $SVN update
  205. fi
  206. return $?
  207. }
  208. ###############################################################################
  209. downloadPatch () {
  210. ### Download latest patch file (ignoring .htm and .html) when run from patch process
  211. if [[ $JENKINS == "true" ]] ; then
  212. $WGET -q -O $PATCH_DIR/jira http://issues.apache.org/jira/browse/$defect
  213. if [[ `$GREP -c 'Patch Available' $PATCH_DIR/jira` == 0 ]] ; then
  214. echo "$defect is not \"Patch Available\". Exiting."
  215. cleanupAndExit 0
  216. fi
  217. 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]*/[^"]*'`
  218. patchURL="http://issues.apache.org${relativePatchURL}"
  219. patchNum=`echo $patchURL | $GREP -o '[0-9]*/' | $GREP -o '[0-9]*'`
  220. echo "$defect patch is being downloaded at `date` from"
  221. echo "$patchURL"
  222. $WGET -q -O $PATCH_DIR/patch $patchURL
  223. VERSION=${SVN_REVISION}_${defect}_PATCH-${patchNum}
  224. JIRA_COMMENT="Here are the results of testing the latest attachment
  225. $patchURL
  226. against trunk revision ${SVN_REVISION}."
  227. ### Copy in any supporting files needed by this process
  228. cp -r $SUPPORT_DIR/lib/* ./lib
  229. #PENDING: cp -f $SUPPORT_DIR/etc/checkstyle* ./src/test
  230. ### Copy the patch file to $PATCH_DIR
  231. else
  232. VERSION=PATCH-${defect}
  233. cp $PATCH_FILE $PATCH_DIR/patch
  234. if [[ $? == 0 ]] ; then
  235. echo "Patch file $PATCH_FILE copied to $PATCH_DIR"
  236. else
  237. echo "Could not copy $PATCH_FILE to $PATCH_DIR"
  238. cleanupAndExit 0
  239. fi
  240. fi
  241. }
  242. ###############################################################################
  243. verifyPatch () {
  244. # Before building, check to make sure that the patch is valid
  245. $bindir/smart-apply-patch.sh $PATCH_DIR/patch dryrun
  246. if [[ $? != 0 ]] ; then
  247. echo "PATCH APPLICATION FAILED"
  248. JIRA_COMMENT="$JIRA_COMMENT
  249. {color:red}-1 patch{color}. The patch command could not apply the patch."
  250. return 1
  251. else
  252. return 0
  253. fi
  254. }
  255. ###############################################################################
  256. prebuildWithoutPatch () {
  257. echo ""
  258. echo ""
  259. echo "======================================================================"
  260. echo "======================================================================"
  261. echo " Pre-build trunk to verify trunk stability and javac warnings"
  262. echo "======================================================================"
  263. echo "======================================================================"
  264. echo ""
  265. echo ""
  266. if [[ ! -d hadoop-common-project ]]; then
  267. cd $bindir/..
  268. echo "Compiling $(pwd)"
  269. echo "$MVN clean test -DskipTests > $PATCH_DIR/trunkCompile.txt 2>&1"
  270. $MVN clean test -DskipTests > $PATCH_DIR/trunkCompile.txt 2>&1
  271. if [[ $? != 0 ]] ; then
  272. echo "Top-level trunk compilation is broken?"
  273. JIRA_COMMENT="$JIRA_COMMENT
  274. {color:red}-1 patch{color}. Top-level trunk compilation may be broken."
  275. return 1
  276. fi
  277. cd -
  278. fi
  279. echo "Compiling $(pwd)"
  280. echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess -Ptest-patch > $PATCH_DIR/trunkJavacWarnings.txt 2>&1"
  281. $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess -Ptest-patch > $PATCH_DIR/trunkJavacWarnings.txt 2>&1
  282. if [[ $? != 0 ]] ; then
  283. echo "Trunk compilation is broken?"
  284. JIRA_COMMENT="$JIRA_COMMENT
  285. {color:red}-1 patch{color}. Trunk compilation may be broken."
  286. return 1
  287. fi
  288. echo "$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavadocWarnings.txt 2>&1"
  289. $MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavadocWarnings.txt 2>&1
  290. if [[ $? != 0 ]] ; then
  291. echo "Trunk javadoc compilation is broken?"
  292. JIRA_COMMENT="$JIRA_COMMENT
  293. {color:red}-1 patch{color}. Trunk compilation may be broken."
  294. return 1
  295. fi
  296. return 0
  297. }
  298. ###############################################################################
  299. ### Check for @author tags in the patch
  300. checkAuthor () {
  301. echo ""
  302. echo ""
  303. echo "======================================================================"
  304. echo "======================================================================"
  305. echo " Checking there are no @author tags in the patch."
  306. echo "======================================================================"
  307. echo "======================================================================"
  308. echo ""
  309. echo ""
  310. authorTags=`$GREP -c -i '@author' $PATCH_DIR/patch`
  311. echo "There appear to be $authorTags @author tags in the patch."
  312. if [[ $authorTags != 0 ]] ; then
  313. JIRA_COMMENT="$JIRA_COMMENT
  314. {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."
  315. return 1
  316. fi
  317. JIRA_COMMENT="$JIRA_COMMENT
  318. {color:green}+1 @author{color}. The patch does not contain any @author tags."
  319. return 0
  320. }
  321. ###############################################################################
  322. ### Check for tests in the patch
  323. checkTests () {
  324. echo ""
  325. echo ""
  326. echo "======================================================================"
  327. echo "======================================================================"
  328. echo " Checking there are new or changed tests in the patch."
  329. echo "======================================================================"
  330. echo "======================================================================"
  331. echo ""
  332. echo ""
  333. testReferences=`$GREP -c -i -e '^+++.*/test' $PATCH_DIR/patch`
  334. echo "There appear to be $testReferences test files referenced in the patch."
  335. if [[ $testReferences == 0 ]] ; then
  336. if [[ $JENKINS == "true" ]] ; then
  337. patchIsDoc=`$GREP -c -i 'title="documentation' $PATCH_DIR/jira`
  338. if [[ $patchIsDoc != 0 ]] ; then
  339. echo "The patch appears to be a documentation patch that doesn't require tests."
  340. JIRA_COMMENT="$JIRA_COMMENT
  341. {color:green}+0 tests included{color}. The patch appears to be a documentation patch that doesn't require tests."
  342. return 0
  343. fi
  344. fi
  345. JIRA_COMMENT="$JIRA_COMMENT
  346. {color:red}-1 tests included{color}. The patch doesn't appear to include any new or modified tests.
  347. Please justify why no new tests are needed for this patch.
  348. Also please list what manual steps were performed to verify this patch."
  349. return 1
  350. fi
  351. JIRA_COMMENT="$JIRA_COMMENT
  352. {color:green}+1 tests included{color}. The patch appears to include $testReferences new or modified test files."
  353. return 0
  354. }
  355. cleanUpXml () {
  356. cd $BASEDIR/conf
  357. for file in `ls *.xml.template`
  358. do
  359. rm -f `basename $file .template`
  360. done
  361. cd $BASEDIR
  362. }
  363. ###############################################################################
  364. ### Attempt to apply the patch
  365. applyPatch () {
  366. echo ""
  367. echo ""
  368. echo "======================================================================"
  369. echo "======================================================================"
  370. echo " Applying patch."
  371. echo "======================================================================"
  372. echo "======================================================================"
  373. echo ""
  374. echo ""
  375. export PATCH
  376. $bindir/smart-apply-patch.sh $PATCH_DIR/patch
  377. if [[ $? != 0 ]] ; then
  378. echo "PATCH APPLICATION FAILED"
  379. JIRA_COMMENT="$JIRA_COMMENT
  380. {color:red}-1 patch{color}. The patch command could not apply the patch."
  381. return 1
  382. fi
  383. return 0
  384. }
  385. ###############################################################################
  386. calculateJavadocWarnings() {
  387. WARNING_FILE="$1"
  388. RET=$(egrep "^[0-9]+ warnings$" "$WARNING_FILE" | awk '{sum+=$1} END {print sum}')
  389. }
  390. ### Check there are no javadoc warnings
  391. checkJavadocWarnings () {
  392. echo ""
  393. echo ""
  394. echo "======================================================================"
  395. echo "======================================================================"
  396. echo " Determining number of patched javadoc warnings."
  397. echo "======================================================================"
  398. echo "======================================================================"
  399. echo ""
  400. echo ""
  401. echo "$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1"
  402. if [ -d hadoop-project ]; then
  403. (cd hadoop-project; $MVN install > /dev/null 2>&1)
  404. fi
  405. if [ -d hadoop-common-project/hadoop-annotations ]; then
  406. (cd hadoop-common-project/hadoop-annotations; $MVN install > /dev/null 2>&1)
  407. fi
  408. $MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1
  409. calculateJavadocWarnings "$PATCH_DIR/trunkJavadocWarnings.txt"
  410. numTrunkJavadocWarnings=$RET
  411. calculateJavadocWarnings "$PATCH_DIR/patchJavadocWarnings.txt"
  412. numPatchJavadocWarnings=$RET
  413. grep -i warning "$PATCH_DIR/trunkJavadocWarnings.txt" > "$PATCH_DIR/trunkJavadocWarningsFiltered.txt"
  414. grep -i warning "$PATCH_DIR/patchJavadocWarnings.txt" > "$PATCH_DIR/patchJavadocWarningsFiltered.txt"
  415. diff -u "$PATCH_DIR/trunkJavadocWarningsFiltered.txt" \
  416. "$PATCH_DIR/patchJavadocWarningsFiltered.txt" > \
  417. "$PATCH_DIR/diffJavadocWarnings.txt"
  418. rm -f "$PATCH_DIR/trunkJavadocWarningsFiltered.txt" "$PATCH_DIR/patchJavadocWarningsFiltered.txt"
  419. echo "There appear to be $numTrunkJavadocWarnings javadoc warnings before the patch and $numPatchJavadocWarnings javadoc warnings after applying the patch."
  420. if [[ $numTrunkJavadocWarnings != "" && $numPatchJavadocWarnings != "" ]] ; then
  421. if [[ $numPatchJavadocWarnings -gt $numTrunkJavadocWarnings ]] ; then
  422. JIRA_COMMENT="$JIRA_COMMENT
  423. {color:red}-1 javadoc{color}. The javadoc tool appears to have generated `expr $(($numPatchJavadocWarnings-$numTrunkJavadocWarnings))` warning messages.
  424. See $BUILD_URL/artifact/trunk/patchprocess/diffJavadocWarnings.txt for details."
  425. return 1
  426. fi
  427. fi
  428. JIRA_COMMENT="$JIRA_COMMENT
  429. {color:green}+1 javadoc{color}. There were no new javadoc warning messages."
  430. return 0
  431. }
  432. ###############################################################################
  433. ### Check there are no changes in the number of Javac warnings
  434. checkJavacWarnings () {
  435. echo ""
  436. echo ""
  437. echo "======================================================================"
  438. echo "======================================================================"
  439. echo " Determining number of patched javac warnings."
  440. echo "======================================================================"
  441. echo "======================================================================"
  442. echo ""
  443. echo ""
  444. echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1"
  445. $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1
  446. if [[ $? != 0 ]] ; then
  447. JIRA_COMMENT="$JIRA_COMMENT
  448. {color:red}-1 javac{color:red}. The patch appears to cause the build to fail."
  449. return 2
  450. fi
  451. ### Compare trunk and patch javac warning numbers
  452. if [[ -f $PATCH_DIR/patchJavacWarnings.txt ]] ; then
  453. $GREP '\[WARNING\]' $PATCH_DIR/trunkJavacWarnings.txt > $PATCH_DIR/filteredTrunkJavacWarnings.txt
  454. $GREP '\[WARNING\]' $PATCH_DIR/patchJavacWarnings.txt > $PATCH_DIR/filteredPatchJavacWarnings.txt
  455. trunkJavacWarnings=`cat $PATCH_DIR/filteredTrunkJavacWarnings.txt | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'`
  456. patchJavacWarnings=`cat $PATCH_DIR/filteredPatchJavacWarnings.txt | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'`
  457. echo "There appear to be $trunkJavacWarnings javac compiler warnings before the patch and $patchJavacWarnings javac compiler warnings after applying the patch."
  458. if [[ $patchJavacWarnings != "" && $trunkJavacWarnings != "" ]] ; then
  459. if [[ $patchJavacWarnings -gt $trunkJavacWarnings ]] ; then
  460. JIRA_COMMENT="$JIRA_COMMENT
  461. {color:red}-1 javac{color}. The applied patch generated $patchJavacWarnings javac compiler warnings (more than the trunk's current $trunkJavacWarnings warnings)."
  462. $DIFF $PATCH_DIR/filteredTrunkJavacWarnings.txt $PATCH_DIR/filteredPatchJavacWarnings.txt > $PATCH_DIR/diffJavacWarnings.txt
  463. JIRA_COMMENT_FOOTER="Javac warnings: $BUILD_URL/artifact/trunk/patchprocess/diffJavacWarnings.txt
  464. $JIRA_COMMENT_FOOTER"
  465. return 1
  466. fi
  467. fi
  468. fi
  469. JIRA_COMMENT="$JIRA_COMMENT
  470. {color:green}+1 javac{color}. The applied patch does not increase the total number of javac compiler warnings."
  471. return 0
  472. }
  473. ###############################################################################
  474. ### Check there are no changes in the number of release audit (RAT) warnings
  475. checkReleaseAuditWarnings () {
  476. echo ""
  477. echo ""
  478. echo "======================================================================"
  479. echo "======================================================================"
  480. echo " Determining number of patched release audit warnings."
  481. echo "======================================================================"
  482. echo "======================================================================"
  483. echo ""
  484. echo ""
  485. echo "$MVN apache-rat:check -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchReleaseAuditOutput.txt 2>&1"
  486. $MVN apache-rat:check -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchReleaseAuditOutput.txt 2>&1
  487. find $BASEDIR -name rat.txt | xargs cat > $PATCH_DIR/patchReleaseAuditWarnings.txt
  488. ### Compare trunk and patch release audit warning numbers
  489. if [[ -f $PATCH_DIR/patchReleaseAuditWarnings.txt ]] ; then
  490. patchReleaseAuditWarnings=`$GREP -c '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt`
  491. echo ""
  492. echo ""
  493. echo "There appear to be $patchReleaseAuditWarnings release audit warnings after applying the patch."
  494. if [[ $patchReleaseAuditWarnings != "" ]] ; then
  495. if [[ $patchReleaseAuditWarnings -gt 0 ]] ; then
  496. JIRA_COMMENT="$JIRA_COMMENT
  497. {color:red}-1 release audit{color}. The applied patch generated $patchReleaseAuditWarnings release audit warnings."
  498. $GREP '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt > $PATCH_DIR/patchReleaseAuditProblems.txt
  499. echo "Lines that start with ????? in the release audit report indicate files that do not have an Apache license header." >> $PATCH_DIR/patchReleaseAuditProblems.txt
  500. JIRA_COMMENT_FOOTER="Release audit warnings: $BUILD_URL/artifact/trunk/patchprocess/patchReleaseAuditProblems.txt
  501. $JIRA_COMMENT_FOOTER"
  502. return 1
  503. fi
  504. fi
  505. fi
  506. JIRA_COMMENT="$JIRA_COMMENT
  507. {color:green}+1 release audit{color}. The applied patch does not increase the total number of release audit warnings."
  508. return 0
  509. }
  510. ###############################################################################
  511. ### Check there are no changes in the number of Checkstyle warnings
  512. checkStyle () {
  513. echo ""
  514. echo ""
  515. echo "======================================================================"
  516. echo "======================================================================"
  517. echo " Determining number of patched checkstyle warnings."
  518. echo "======================================================================"
  519. echo "======================================================================"
  520. echo ""
  521. echo ""
  522. echo "THIS IS NOT IMPLEMENTED YET"
  523. echo ""
  524. echo ""
  525. echo "$MVN test checkstyle:checkstyle -DskipTests -D${PROJECT_NAME}PatchProcess"
  526. $MVN test checkstyle:checkstyle -DskipTests -D${PROJECT_NAME}PatchProcess
  527. JIRA_COMMENT_FOOTER="Checkstyle results: $BUILD_URL/artifact/trunk/build/test/checkstyle-errors.html
  528. $JIRA_COMMENT_FOOTER"
  529. ### TODO: calculate actual patchStyleErrors
  530. # patchStyleErrors=0
  531. # if [[ $patchStyleErrors != 0 ]] ; then
  532. # JIRA_COMMENT="$JIRA_COMMENT
  533. #
  534. # {color:red}-1 checkstyle{color}. The patch generated $patchStyleErrors code style errors."
  535. # return 1
  536. # fi
  537. # JIRA_COMMENT="$JIRA_COMMENT
  538. #
  539. # {color:green}+1 checkstyle{color}. The patch generated 0 code style errors."
  540. return 0
  541. }
  542. ###############################################################################
  543. ### Install the new jars so tests and findbugs can find all of the updated jars
  544. buildAndInstall () {
  545. echo ""
  546. echo ""
  547. echo "======================================================================"
  548. echo "======================================================================"
  549. echo " Installing all of the jars"
  550. echo "======================================================================"
  551. echo "======================================================================"
  552. echo ""
  553. echo ""
  554. echo "$MVN install -Dmaven.javadoc.skip=true -DskipTests -D${PROJECT_NAME}PatchProcess"
  555. $MVN install -Dmaven.javadoc.skip=true -DskipTests -D${PROJECT_NAME}PatchProcess
  556. return $?
  557. }
  558. ###############################################################################
  559. ### Check there are no changes in the number of Findbugs warnings
  560. checkFindbugsWarnings () {
  561. findbugs_version=`${FINDBUGS_HOME}/bin/findbugs -version`
  562. echo ""
  563. echo ""
  564. echo "======================================================================"
  565. echo "======================================================================"
  566. echo " Determining number of patched Findbugs warnings."
  567. echo "======================================================================"
  568. echo "======================================================================"
  569. echo ""
  570. echo ""
  571. modules=$(findModules)
  572. rc=0
  573. for module in $modules;
  574. do
  575. cd $module
  576. echo " Running findbugs in $module"
  577. module_suffix=`basename ${module}`
  578. echo "$MVN clean test findbugs:findbugs -DskipTests -D${PROJECT_NAME}PatchProcess < /dev/null > $PATCH_DIR/patchFindBugsOutput${module_suffix}.txt 2>&1"
  579. $MVN clean test findbugs:findbugs -DskipTests -D${PROJECT_NAME}PatchProcess < /dev/null > $PATCH_DIR/patchFindBugsOutput${module_suffix}.txt 2>&1
  580. (( rc = rc + $? ))
  581. cd -
  582. done
  583. if [ $rc != 0 ] ; then
  584. JIRA_COMMENT="$JIRA_COMMENT
  585. {color:red}-1 findbugs{color}. The patch appears to cause Findbugs (version ${findbugs_version}) to fail."
  586. return 1
  587. fi
  588. findbugsWarnings=0
  589. for file in $(find $BASEDIR -name findbugsXml.xml)
  590. do
  591. relative_file=${file#$BASEDIR/} # strip leading $BASEDIR prefix
  592. if [ ! $relative_file == "target/findbugsXml.xml" ]; then
  593. module_suffix=${relative_file%/target/findbugsXml.xml} # strip trailing path
  594. module_suffix=`basename ${module_suffix}`
  595. fi
  596. cp $file $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
  597. $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
  598. $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
  599. $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
  600. newFindbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
  601. $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml | $AWK '{print $1}'`
  602. echo "Found $newFindbugsWarnings Findbugs warnings ($file)"
  603. findbugsWarnings=$((findbugsWarnings+newFindbugsWarnings))
  604. $FINDBUGS_HOME/bin/convertXmlToText -html \
  605. $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml \
  606. $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.html
  607. if [[ $newFindbugsWarnings > 0 ]] ; then
  608. JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/trunk/patchprocess/newPatchFindbugsWarnings${module_suffix}.html
  609. $JIRA_COMMENT_FOOTER"
  610. fi
  611. done
  612. if [[ $findbugsWarnings -gt 0 ]] ; then
  613. JIRA_COMMENT="$JIRA_COMMENT
  614. {color:red}-1 findbugs{color}. The patch appears to introduce $findbugsWarnings new Findbugs (version ${findbugs_version}) warnings."
  615. return 1
  616. fi
  617. JIRA_COMMENT="$JIRA_COMMENT
  618. {color:green}+1 findbugs{color}. The patch does not introduce any new Findbugs (version ${findbugs_version}) warnings."
  619. return 0
  620. }
  621. ###############################################################################
  622. ### Verify eclipse:eclipse works
  623. checkEclipseGeneration () {
  624. echo ""
  625. echo ""
  626. echo "======================================================================"
  627. echo "======================================================================"
  628. echo " Running mvn eclipse:eclipse."
  629. echo "======================================================================"
  630. echo "======================================================================"
  631. echo ""
  632. echo ""
  633. echo "$MVN eclipse:eclipse -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchEclipseOutput.txt 2>&1"
  634. $MVN eclipse:eclipse -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchEclipseOutput.txt 2>&1
  635. if [[ $? != 0 ]] ; then
  636. JIRA_COMMENT="$JIRA_COMMENT
  637. {color:red}-1 eclipse:eclipse{color}. The patch failed to build with eclipse:eclipse."
  638. return 1
  639. fi
  640. JIRA_COMMENT="$JIRA_COMMENT
  641. {color:green}+1 eclipse:eclipse{color}. The patch built with eclipse:eclipse."
  642. return 0
  643. }
  644. ###############################################################################
  645. ### Run the tests
  646. runTests () {
  647. echo ""
  648. echo ""
  649. echo "======================================================================"
  650. echo "======================================================================"
  651. echo " Running tests."
  652. echo "======================================================================"
  653. echo "======================================================================"
  654. echo ""
  655. echo ""
  656. failed_tests=""
  657. modules=$(findModules)
  658. #
  659. # If we are building hadoop-hdfs-project, we must build the native component
  660. # of hadoop-common-project first. In order to accomplish this, we move the
  661. # hadoop-hdfs subprojects to the end of the list so that common will come
  662. # first.
  663. #
  664. # Of course, we may not be building hadoop-common at all-- in this case, we
  665. # explicitly insert a mvn compile -Pnative of common, to ensure that the
  666. # native libraries show up where we need them.
  667. #
  668. building_common=0
  669. for module in $modules; do
  670. if [[ $module == hadoop-hdfs-project* ]]; then
  671. hdfs_modules="$hdfs_modules $module"
  672. elif [[ $module == hadoop-common-project* ]]; then
  673. ordered_modules="$ordered_modules $module"
  674. building_common=1
  675. else
  676. ordered_modules="$ordered_modules $module"
  677. fi
  678. done
  679. if [ -n "$hdfs_modules" ]; then
  680. ordered_modules="$ordered_modules $hdfs_modules"
  681. if [[ $building_common -eq 0 ]]; then
  682. echo " Building hadoop-common with -Pnative in order to provide \
  683. libhadoop.so to the hadoop-hdfs unit tests."
  684. echo " $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess"
  685. if ! $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess; then
  686. JIRA_COMMENT="$JIRA_COMMENT
  687. {color:red}-1 core tests{color}. Failed to build the native portion \
  688. of hadoop-common prior to running the unit tests in $ordered_modules"
  689. return 1
  690. fi
  691. fi
  692. fi
  693. failed_test_builds=""
  694. test_timeouts=""
  695. for module in $ordered_modules; do
  696. cd $module
  697. module_suffix=`basename ${module}`
  698. test_logfile=$PATCH_DIR/testrun_${module_suffix}.txt
  699. echo " Running tests in $module"
  700. echo " $MVN clean install -fn $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${PROJECT_NAME}PatchProcess"
  701. $MVN clean install -fae $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${PROJECT_NAME}PatchProcess > $test_logfile 2>&1
  702. test_build_result=$?
  703. cat $test_logfile
  704. module_test_timeouts=`$AWK '/^Running / { if (last) { print last } last=$2 } /^Tests run: / { last="" }' $test_logfile`
  705. if [[ -n "$module_test_timeouts" ]] ; then
  706. test_timeouts="$test_timeouts
  707. $module_test_timeouts"
  708. fi
  709. 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"`
  710. if [[ -n "$module_failed_tests" ]] ; then
  711. failed_tests="${failed_tests}
  712. ${module_failed_tests}"
  713. fi
  714. if [[ $test_build_result != 0 && -z "$module_failed_tests" && -z "$module_test_timeouts" ]] ; then
  715. failed_test_builds="$module $failed_test_builds"
  716. fi
  717. cd -
  718. done
  719. result=0
  720. comment_prefix=" {color:red}-1 core tests{color}."
  721. if [[ -n "$failed_tests" ]] ; then
  722. JIRA_COMMENT="$JIRA_COMMENT
  723. $comment_prefix The patch failed these unit tests in $modules:
  724. $failed_tests"
  725. comment_prefix=" "
  726. result=1
  727. fi
  728. if [[ -n "$test_timeouts" ]] ; then
  729. JIRA_COMMENT="$JIRA_COMMENT
  730. $comment_prefix The following test timeouts occurred in $modules:
  731. $test_timeouts"
  732. comment_prefix=" "
  733. result=1
  734. fi
  735. if [[ -n "$failed_test_builds" ]] ; then
  736. JIRA_COMMENT="$JIRA_COMMENT
  737. $comment_prefix The test build failed in $failed_test_builds"
  738. result=1
  739. fi
  740. if [[ $result == 0 ]] ; then
  741. JIRA_COMMENT="$JIRA_COMMENT
  742. {color:green}+1 core tests{color}. The patch passed unit tests in $modules."
  743. fi
  744. return $result
  745. }
  746. ###############################################################################
  747. # Find the maven module containing the given file.
  748. findModule (){
  749. dir=`dirname $1`
  750. while [ 1 ]
  751. do
  752. if [ -f "$dir/pom.xml" ]
  753. then
  754. echo $dir
  755. return
  756. else
  757. dir=`dirname $dir`
  758. fi
  759. done
  760. }
  761. findModules () {
  762. # Come up with a list of changed files into $TMP
  763. TMP=/tmp/tmp.paths.$$
  764. $GREP '^+++ \|^--- ' $PATCH_DIR/patch | cut -c '5-' | $GREP -v /dev/null | sort | uniq > $TMP
  765. # if all of the lines start with a/ or b/, then this is a git patch that
  766. # was generated without --no-prefix
  767. if ! $GREP -qv '^a/\|^b/' $TMP ; then
  768. sed -i -e 's,^[ab]/,,' $TMP
  769. fi
  770. # Now find all the modules that were changed
  771. TMP_MODULES=/tmp/tmp.modules.$$
  772. for file in $(cut -f 1 $TMP | sort | uniq); do
  773. echo $(findModule $file) >> $TMP_MODULES
  774. done
  775. rm $TMP
  776. # Filter out modules without code
  777. CHANGED_MODULES=""
  778. for module in $(cat $TMP_MODULES | sort | uniq); do
  779. $GREP "<packaging>pom</packaging>" $module/pom.xml > /dev/null
  780. if [ "$?" != 0 ]; then
  781. CHANGED_MODULES="$CHANGED_MODULES $module"
  782. fi
  783. done
  784. rm $TMP_MODULES
  785. echo $CHANGED_MODULES
  786. }
  787. ###############################################################################
  788. ### Run the test-contrib target
  789. runContribTests () {
  790. echo ""
  791. echo ""
  792. echo "======================================================================"
  793. echo "======================================================================"
  794. echo " Running contrib tests."
  795. echo "======================================================================"
  796. echo "======================================================================"
  797. echo ""
  798. echo ""
  799. if [[ `$GREP -c 'test-contrib' build.xml` == 0 ]] ; then
  800. echo "No contrib tests in this project."
  801. return 0
  802. fi
  803. ### Kill any rogue build processes from the last attempt
  804. $PS auxwww | $GREP ${PROJECT_NAME}PatchProcess | $AWK '{print $2}' | /usr/bin/xargs -t -I {} /bin/kill -9 {} > /dev/null
  805. #echo "$ANT_HOME/bin/ant -Dversion="${VERSION}" $ECLIPSE_PROPERTY -DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=no test-contrib"
  806. #$ANT_HOME/bin/ant -Dversion="${VERSION}" $ECLIPSE_PROPERTY -DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=no test-contrib
  807. echo "NOP"
  808. if [[ $? != 0 ]] ; then
  809. JIRA_COMMENT="$JIRA_COMMENT
  810. {color:red}-1 contrib tests{color}. The patch failed contrib unit tests."
  811. return 1
  812. fi
  813. JIRA_COMMENT="$JIRA_COMMENT
  814. {color:green}+1 contrib tests{color}. The patch passed contrib unit tests."
  815. return 0
  816. }
  817. ###############################################################################
  818. ### Run the inject-system-faults target
  819. checkInjectSystemFaults () {
  820. echo ""
  821. echo ""
  822. echo "======================================================================"
  823. echo "======================================================================"
  824. echo " Checking the integrity of system test framework code."
  825. echo "======================================================================"
  826. echo "======================================================================"
  827. echo ""
  828. echo ""
  829. ### Kill any rogue build processes from the last attempt
  830. $PS auxwww | $GREP ${PROJECT_NAME}PatchProcess | $AWK '{print $2}' | /usr/bin/xargs -t -I {} /bin/kill -9 {} > /dev/null
  831. #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"
  832. #$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
  833. echo "NOP"
  834. return 0
  835. if [[ $? != 0 ]] ; then
  836. JIRA_COMMENT="$JIRA_COMMENT
  837. {color:red}-1 system test framework{color}. The patch failed system test framework compile."
  838. return 1
  839. fi
  840. JIRA_COMMENT="$JIRA_COMMENT
  841. {color:green}+1 system test framework{color}. The patch passed system test framework compile."
  842. return 0
  843. }
  844. ###############################################################################
  845. ### Submit a comment to the defect's Jira
  846. submitJiraComment () {
  847. local result=$1
  848. ### Do not output the value of JIRA_COMMENT_FOOTER when run by a developer
  849. if [[ $JENKINS == "false" ]] ; then
  850. JIRA_COMMENT_FOOTER=""
  851. fi
  852. if [[ $result == 0 ]] ; then
  853. comment="{color:green}+1 overall{color}. $JIRA_COMMENT
  854. $JIRA_COMMENT_FOOTER"
  855. else
  856. comment="{color:red}-1 overall{color}. $JIRA_COMMENT
  857. $JIRA_COMMENT_FOOTER"
  858. fi
  859. ### Output the test result to the console
  860. echo "
  861. $comment"
  862. if [[ $JENKINS == "true" ]] ; then
  863. echo ""
  864. echo ""
  865. echo "======================================================================"
  866. echo "======================================================================"
  867. echo " Adding comment to Jira."
  868. echo "======================================================================"
  869. echo "======================================================================"
  870. echo ""
  871. echo ""
  872. ### Update Jira with a comment
  873. export USER=hudson
  874. $JIRACLI -s https://issues.apache.org/jira -a addcomment -u hadoopqa -p $JIRA_PASSWD --comment "$comment" --issue $defect
  875. $JIRACLI -s https://issues.apache.org/jira -a logout -u hadoopqa -p $JIRA_PASSWD
  876. fi
  877. }
  878. ###############################################################################
  879. ### Cleanup files
  880. cleanupAndExit () {
  881. local result=$1
  882. if [[ $JENKINS == "true" ]] ; then
  883. if [ -e "$PATCH_DIR" ] ; then
  884. mv $PATCH_DIR $BASEDIR
  885. fi
  886. fi
  887. echo ""
  888. echo ""
  889. echo "======================================================================"
  890. echo "======================================================================"
  891. echo " Finished build."
  892. echo "======================================================================"
  893. echo "======================================================================"
  894. echo ""
  895. echo ""
  896. exit $result
  897. }
  898. ###############################################################################
  899. ###############################################################################
  900. ###############################################################################
  901. JIRA_COMMENT=""
  902. JIRA_COMMENT_FOOTER="Console output: $BUILD_URL/console
  903. This message is automatically generated."
  904. ### Check if arguments to the script have been specified properly or not
  905. parseArgs $@
  906. cd $BASEDIR
  907. checkout
  908. RESULT=$?
  909. if [[ $JENKINS == "true" ]] ; then
  910. if [[ $RESULT != 0 ]] ; then
  911. exit 100
  912. fi
  913. fi
  914. downloadPatch
  915. verifyPatch
  916. (( RESULT = RESULT + $? ))
  917. if [[ $RESULT != 0 ]] ; then
  918. submitJiraComment 1
  919. cleanupAndExit 1
  920. fi
  921. prebuildWithoutPatch
  922. (( RESULT = RESULT + $? ))
  923. if [[ $RESULT != 0 ]] ; then
  924. submitJiraComment 1
  925. cleanupAndExit 1
  926. fi
  927. checkAuthor
  928. (( RESULT = RESULT + $? ))
  929. if [[ $JENKINS == "true" ]] ; then
  930. cleanUpXml
  931. fi
  932. checkTests
  933. (( RESULT = RESULT + $? ))
  934. applyPatch
  935. APPLY_PATCH_RET=$?
  936. (( RESULT = RESULT + $APPLY_PATCH_RET ))
  937. if [[ $APPLY_PATCH_RET != 0 ]] ; then
  938. submitJiraComment 1
  939. cleanupAndExit 1
  940. fi
  941. checkJavacWarnings
  942. JAVAC_RET=$?
  943. #2 is returned if the code could not compile
  944. if [[ $JAVAC_RET == 2 ]] ; then
  945. submitJiraComment 1
  946. cleanupAndExit 1
  947. fi
  948. (( RESULT = RESULT + $JAVAC_RET ))
  949. checkJavadocWarnings
  950. (( RESULT = RESULT + $? ))
  951. ### Checkstyle not implemented yet
  952. #checkStyle
  953. #(( RESULT = RESULT + $? ))
  954. buildAndInstall
  955. checkEclipseGeneration
  956. (( RESULT = RESULT + $? ))
  957. checkFindbugsWarnings
  958. (( RESULT = RESULT + $? ))
  959. checkReleaseAuditWarnings
  960. (( RESULT = RESULT + $? ))
  961. ### Run tests for Jenkins or if explictly asked for by a developer
  962. if [[ $JENKINS == "true" || $RUN_TESTS == "true" ]] ; then
  963. runTests
  964. (( RESULT = RESULT + $? ))
  965. runContribTests
  966. (( RESULT = RESULT + $? ))
  967. fi
  968. checkInjectSystemFaults
  969. (( RESULT = RESULT + $? ))
  970. JIRA_COMMENT_FOOTER="Test results: $BUILD_URL/testReport/
  971. $JIRA_COMMENT_FOOTER"
  972. submitJiraComment $RESULT
  973. cleanupAndExit $RESULT