HADOOP-7533. Allow test-patch to be run from any subproject directory.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1156673 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5b7c0b6a45
commit
5c8f4964cd
@ -53,16 +53,22 @@ if ! grep -qv '^a/\|^b/' $TMP ; then
|
||||
sed -i -e 's,^[ab]/,,' $TMP
|
||||
fi
|
||||
|
||||
# if all of the lines start with common/, hdfs/, or mapreduce/, this is
|
||||
PREFIX_DIRS=$(cut -d '/' -f 1 $TMP | sort | uniq)
|
||||
|
||||
# if we are at the project root then nothing more to do
|
||||
if [[ -d hadoop-common ]]; then
|
||||
echo Looks like this is being run at project root
|
||||
|
||||
# if all of the lines start with hadoop-common/, hdfs/, or mapreduce/, this is
|
||||
# relative to the hadoop root instead of the subproject root, so we need
|
||||
# to chop off another layer
|
||||
PREFIX_DIRS=$(cut -d '/' -f 1 $TMP | sort | uniq)
|
||||
if [[ "$PREFIX_DIRS" =~ ^(hdfs|common|mapreduce)$ ]]; then
|
||||
elif [[ "$PREFIX_DIRS" =~ ^(hdfs|hadoop-common|mapreduce)$ ]]; then
|
||||
|
||||
echo Looks like this is relative to project root. Increasing PLEVEL
|
||||
PLEVEL=$[$PLEVEL + 1]
|
||||
elif ! echo "$PREFIX_DIRS" | grep -vxq 'common\|hdfs\|mapreduce' ; then
|
||||
echo Looks like this is a cross-subproject patch. Not supported!
|
||||
|
||||
elif ! echo "$PREFIX_DIRS" | grep -vxq 'hadoop-common\|hdfs\|mapreduce' ; then
|
||||
echo Looks like this is a cross-subproject patch. Try applying from the project root
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -13,6 +13,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# The number of acceptable warning for *all* modules
|
||||
# Please update the per-module test-patch.properties if you update this file.
|
||||
|
||||
OK_RELEASEAUDIT_WARNINGS=0
|
||||
OK_FINDBUGS_WARNINGS=0
|
||||
OK_JAVADOC_WARNINGS=6
|
||||
|
@ -19,7 +19,6 @@ ulimit -n 1024
|
||||
### SVN_REVISION and BUILD_URL are set by Hudson if it is run by patch process
|
||||
### Read variables from properties file
|
||||
bindir=$(dirname $0)
|
||||
. $bindir/test-patch.properties
|
||||
|
||||
# Defaults
|
||||
if [ -z "$MAVEN_HOME" ]; then
|
||||
@ -232,6 +231,7 @@ setup () {
|
||||
cleanupAndExit 0
|
||||
fi
|
||||
fi
|
||||
. $BASEDIR/dev-support/test-patch.properties
|
||||
### exit if warnings are NOT defined in the properties file
|
||||
if [ -z "$OK_FINDBUGS_WARNINGS" ] || [[ -z "$OK_JAVADOC_WARNINGS" ]] || [[ -z $OK_RELEASEAUDIT_WARNINGS ]]; then
|
||||
echo "Please define the following properties in test-patch.properties file"
|
||||
@ -367,8 +367,12 @@ checkJavadocWarnings () {
|
||||
echo ""
|
||||
echo ""
|
||||
echo "$MVN clean compile javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1"
|
||||
(cd hadoop-project; mvn install)
|
||||
(cd hadoop-annotations; mvn install)
|
||||
if [ -d hadoop-project ]; then
|
||||
(cd hadoop-project; $MVN install)
|
||||
fi
|
||||
if [ -d hadoop-annotations ]; then
|
||||
(cd hadoop-annotations; $MVN install)
|
||||
fi
|
||||
$MVN clean compile 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 ""
|
||||
@ -525,18 +529,29 @@ checkFindbugsWarnings () {
|
||||
-1 findbugs. The patch appears to cause Findbugs (version ${findbugs_version}) to fail."
|
||||
return 1
|
||||
fi
|
||||
JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/trunk/target/newPatchFindbugsWarnings.html
|
||||
|
||||
findbugsWarnings=0
|
||||
for file in $(find $BASEDIR -name findbugsXml.xml)
|
||||
do
|
||||
relative_file=${file#$BASEDIR/} # strip leading $BASEDIR prefix
|
||||
if [ ! $relative_file == "target/findbugsXml.xml" ]; then
|
||||
module_suffix=${relative_file%/target/findbugsXml.xml} # strip trailing path
|
||||
fi
|
||||
|
||||
cp $file $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
|
||||
$FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
|
||||
$PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
|
||||
$PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
|
||||
newFindbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
|
||||
$PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml | $AWK '{print $1}'`
|
||||
echo "Found $newFindbugsWarnings Findbugs warnings ($file)"
|
||||
findbugsWarnings=$((findbugsWarnings+newFindbugsWarnings))
|
||||
$FINDBUGS_HOME/bin/convertXmlToText -html \
|
||||
$PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml \
|
||||
$PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.html
|
||||
JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/trunk/target/newPatchFindbugsWarnings${module_suffix}.html
|
||||
$JIRA_COMMENT_FOOTER"
|
||||
|
||||
cp $BASEDIR/hadoop-common/target/findbugsXml.xml $PATCH_DIR/patchFindbugsWarnings.xml
|
||||
$FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
|
||||
$PATCH_DIR/patchFindbugsWarnings.xml \
|
||||
$PATCH_DIR/patchFindbugsWarnings.xml
|
||||
findbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings.xml \
|
||||
$PATCH_DIR/newPatchFindbugsWarnings.xml | $AWK '{print $1}'`
|
||||
$FINDBUGS_HOME/bin/convertXmlToText -html \
|
||||
$PATCH_DIR/newPatchFindbugsWarnings.xml \
|
||||
$PATCH_DIR/newPatchFindbugsWarnings.html
|
||||
done
|
||||
|
||||
### if current warnings greater than OK_FINDBUGS_WARNINGS
|
||||
if [[ $findbugsWarnings > $OK_FINDBUGS_WARNINGS ]] ; then
|
||||
|
@ -472,6 +472,9 @@ Trunk (unreleased changes)
|
||||
HADOOP-7528. Maven build fails in Windows. (Alejandro Abdelnur via
|
||||
tomwhite)
|
||||
|
||||
HADOOP-7533. Allow test-patch to be run from any subproject directory.
|
||||
(tomwhite)
|
||||
|
||||
Release 0.22.0 - Unreleased
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
21
hadoop-common/dev-support/test-patch.properties
Normal file
21
hadoop-common/dev-support/test-patch.properties
Normal file
@ -0,0 +1,21 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# The number of acceptable warning for this module
|
||||
# Please update the root test-patch.properties if you update this file.
|
||||
|
||||
OK_RELEASEAUDIT_WARNINGS=0
|
||||
OK_FINDBUGS_WARNINGS=0
|
||||
OK_JAVADOC_WARNINGS=6
|
Loading…
Reference in New Issue
Block a user