HADOOP-8776. Provide an option in test-patch that can enable/disable compiling native code. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1399857 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2012-10-18 21:05:07 +00:00
parent 6cfa710bad
commit 865c67a569
2 changed files with 18 additions and 7 deletions

View File

@ -32,7 +32,7 @@ JENKINS=false
PATCH_DIR=/tmp PATCH_DIR=/tmp
SUPPORT_DIR=/tmp SUPPORT_DIR=/tmp
BASEDIR=$(pwd) BASEDIR=$(pwd)
BUILD_NATIVE=true
PS=${PS:-ps} PS=${PS:-ps}
AWK=${AWK:-awk} AWK=${AWK:-awk}
WGET=${WGET:-wget} WGET=${WGET:-wget}
@ -67,6 +67,7 @@ printUsage() {
echo "--forrest-home=<path> Forrest home directory (default FORREST_HOME environment variable)" echo "--forrest-home=<path> Forrest home directory (default FORREST_HOME environment variable)"
echo "--dirty-workspace Allow the local SVN workspace to have uncommitted changes" echo "--dirty-workspace Allow the local SVN workspace to have uncommitted changes"
echo "--run-tests Run all tests below the base directory" echo "--run-tests Run all tests below the base directory"
echo "--build-native=<bool> If true, then build native components (default 'true')"
echo echo
echo "Jenkins-only options:" echo "Jenkins-only options:"
echo "--jenkins Run by Jenkins (runs tests and posts results to JIRA)" echo "--jenkins Run by Jenkins (runs tests and posts results to JIRA)"
@ -139,11 +140,18 @@ parseArgs() {
--run-tests) --run-tests)
RUN_TESTS=true RUN_TESTS=true
;; ;;
--build-native=*)
BUILD_NATIVE=${i#*=}
;;
*) *)
PATCH_OR_DEFECT=$i PATCH_OR_DEFECT=$i
;; ;;
esac esac
done done
if [[ $BUILD_NATIVE == "true" ]] ; then
NATIVE_PROFILE=-Pnative
REQUIRE_TEST_LIB_HADOOP=-Drequire.test.libhadoop
fi
if [ -z "$PATCH_OR_DEFECT" ]; then if [ -z "$PATCH_OR_DEFECT" ]; then
printUsage printUsage
exit 1 exit 1
@ -437,8 +445,8 @@ checkJavacWarnings () {
echo "======================================================================" echo "======================================================================"
echo "" echo ""
echo "" echo ""
echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess -Pnative -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1" echo "$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1"
$MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess -Pnative -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1 $MVN clean test -DskipTests -D${PROJECT_NAME}PatchProcess $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
JIRA_COMMENT="$JIRA_COMMENT JIRA_COMMENT="$JIRA_COMMENT
@ -707,8 +715,8 @@ runTests () {
if [[ $building_common -eq 0 ]]; then if [[ $building_common -eq 0 ]]; then
echo " Building hadoop-common with -Pnative in order to provide \ echo " Building hadoop-common with -Pnative in order to provide \
libhadoop.so to the hadoop-hdfs unit tests." libhadoop.so to the hadoop-hdfs unit tests."
echo " $MVN compile -Pnative -D${PROJECT_NAME}PatchProcess" echo " $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess"
if ! $MVN compile -Pnative -D${PROJECT_NAME}PatchProcess; then if ! $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess; then
JIRA_COMMENT="$JIRA_COMMENT JIRA_COMMENT="$JIRA_COMMENT
{color:red}-1 core tests{color}. Failed to build the native portion \ {color:red}-1 core tests{color}. Failed to build the native portion \
of hadoop-common prior to running the unit tests in $ordered_modules" of hadoop-common prior to running the unit tests in $ordered_modules"
@ -719,8 +727,8 @@ of hadoop-common prior to running the unit tests in $ordered_modules"
for module in $ordered_modules; do for module in $ordered_modules; do
cd $module cd $module
echo " Running tests in $module" echo " Running tests in $module"
echo " $MVN clean install -fn -Pnative -D${PROJECT_NAME}PatchProcess" echo " $MVN clean install -fn $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${PROJECT_NAME}PatchProcess"
$MVN clean install -fn -Pnative -Drequire.test.libhadoop -D${PROJECT_NAME}PatchProcess $MVN clean install -fn $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${PROJECT_NAME}PatchProcess
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"` 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"`
# With -fn mvn always exits with a 0 exit code. Because of this we need to # With -fn mvn always exits with a 0 exit code. Because of this we need to
# find the errors instead of using the exit code. We assume that if the build # find the errors instead of using the exit code. We assume that if the build

View File

@ -126,6 +126,9 @@ Trunk (Unreleased)
HADOOP-8920. Add more javadoc to metrics2 related classes. (suresh) HADOOP-8920. Add more javadoc to metrics2 related classes. (suresh)
HADOOP-8776. Provide an option in test-patch that can enable/disable
compiling native code. (Chris Nauroth via suresh)
BUG FIXES BUG FIXES
HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName. HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.