HADOOP-10325. Improve Jenkins Javadoc warnings from test-patch.sh (cmccabe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1565010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Colin McCabe 2014-02-06 00:13:34 +00:00
parent d598b6ef9f
commit 996e25c3d1
2 changed files with 37 additions and 14 deletions

View File

@ -300,6 +300,17 @@ prebuildWithoutPatch () {
{color:red}-1 patch{color}. Trunk compilation may be broken."
return 1
fi
echo "$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavadocWarnings.txt 2>&1"
$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/trunkJavadocWarnings.txt 2>&1
if [[ $? != 0 ]] ; then
echo "Trunk javadoc compilation is broken?"
JIRA_COMMENT="$JIRA_COMMENT
{color:red}-1 patch{color}. Trunk compilation may be broken."
return 1
fi
return 0
}
@ -401,6 +412,11 @@ applyPatch () {
}
###############################################################################
calculateJavadocWarnings() {
WARNING_FILE="$1"
RET=$(egrep "^[0-9]+ warnings$" "$WARNING_FILE" | awk '{sum+=$1} END {print sum}')
}
### Check there are no javadoc warnings
checkJavadocWarnings () {
echo ""
@ -420,24 +436,29 @@ checkJavadocWarnings () {
(cd hadoop-common-project/hadoop-annotations; $MVN install > /dev/null 2>&1)
fi
$MVN clean test javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1
javadocWarnings=`$GREP '\[WARNING\]' $PATCH_DIR/patchJavadocWarnings.txt | $AWK '/Javadoc Warnings/,EOF' | $GREP warning | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'`
echo ""
echo ""
echo "There appear to be $javadocWarnings javadoc warnings generated by the patched build."
calculateJavadocWarnings "$PATCH_DIR/trunkJavadocWarnings.txt"
numTrunkJavadocWarnings=$RET
calculateJavadocWarnings "$PATCH_DIR/patchJavadocWarnings.txt"
numPatchJavadocWarnings=$RET
grep -i warning "$PATCH_DIR/trunkJavadocWarnings.txt" > "$PATCH_DIR/trunkJavadocWarningsFiltered.txt"
grep -i warning "$PATCH_DIR/patchJavadocWarnings.txt" > "$PATCH_DIR/patchJavadocWarningsFiltered.txt"
diff -u "$PATCH_DIR/trunkJavadocWarningsFiltered.txt" \
"$PATCH_DIR/patchJavadocWarningsFiltered.txt" > \
"$PATCH_DIR/diffJavadocWarnings.txt"
rm -f "$PATCH_DIR/trunkJavadocWarningsFiltered.txt" "$PATCH_DIR/patchJavadocWarningsFiltered.txt"
echo "There appear to be $numTrunkJavadocWarnings javadoc warnings before the patch and $numPatchJavadocWarnings javadoc warnings after applying the patch."
if [[ $numTrunkJavadocWarnings != "" && $numPatchJavadocWarnings != "" ]] ; then
if [[ $numPatchJavadocWarnings -gt $numTrunkJavadocWarnings ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
#There are 12 warnings that are caused by things that are caused by using sun internal APIs.
#There are 2 warnings that are caused by the Apache DS Dn class used in MiniKdc.
OK_JAVADOC_WARNINGS=14;
### if current warnings greater than OK_JAVADOC_WARNINGS
if [[ $javadocWarnings -ne $OK_JAVADOC_WARNINGS ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
{color:red}-1 javadoc{color}. The javadoc tool appears to have generated `expr $(($javadocWarnings-$OK_JAVADOC_WARNINGS))` warning messages."
return 1
{color:red}-1 javadoc{color}. The javadoc tool appears to have generated `expr $(($numPatchJavadocWarnings-$numTrunkJavadocWarnings))` warning messages.
See $BUILD_URL/artifact/trunk/patchprocess/diffJavadocWarnings.txt for details."
return 1
fi
fi
JIRA_COMMENT="$JIRA_COMMENT
{color:green}+1 javadoc{color}. The javadoc tool did not generate any warning messages."
{color:green}+1 javadoc{color}. There were no new javadoc warning messages."
return 0
}

View File

@ -116,6 +116,8 @@ Trunk (Unreleased)
HADOOP-10244. TestKeyShell improperly tests the results of delete (Larry
McCay via omalley)
HADOOP-10325. Improve jenkins javadoc warnings from test-patch.sh (cmccabe)
BUG FIXES
HADOOP-9451. Fault single-layer config if node group topology is enabled.