From 865c67a569611726021a2d6f22c553ea119b4eb2 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Thu, 18 Oct 2012 21:05:07 +0000 Subject: [PATCH] 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 --- dev-support/test-patch.sh | 22 +++++++++++++------ .../hadoop-common/CHANGES.txt | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh index e34e0a14c2..c051244b67 100755 --- a/dev-support/test-patch.sh +++ b/dev-support/test-patch.sh @@ -32,7 +32,7 @@ JENKINS=false PATCH_DIR=/tmp SUPPORT_DIR=/tmp BASEDIR=$(pwd) - +BUILD_NATIVE=true PS=${PS:-ps} AWK=${AWK:-awk} WGET=${WGET:-wget} @@ -67,6 +67,7 @@ printUsage() { echo "--forrest-home= Forrest home directory (default FORREST_HOME environment variable)" echo "--dirty-workspace Allow the local SVN workspace to have uncommitted changes" echo "--run-tests Run all tests below the base directory" + echo "--build-native= If true, then build native components (default 'true')" echo echo "Jenkins-only options:" echo "--jenkins Run by Jenkins (runs tests and posts results to JIRA)" @@ -139,11 +140,18 @@ parseArgs() { --run-tests) RUN_TESTS=true ;; + --build-native=*) + BUILD_NATIVE=${i#*=} + ;; *) PATCH_OR_DEFECT=$i ;; esac done + if [[ $BUILD_NATIVE == "true" ]] ; then + NATIVE_PROFILE=-Pnative + REQUIRE_TEST_LIB_HADOOP=-Drequire.test.libhadoop + fi if [ -z "$PATCH_OR_DEFECT" ]; then printUsage exit 1 @@ -437,8 +445,8 @@ checkJavacWarnings () { echo "======================================================================" echo "" echo "" - echo "$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 -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 $NATIVE_PROFILE -Ptest-patch > $PATCH_DIR/patchJavacWarnings.txt 2>&1 if [[ $? != 0 ]] ; then JIRA_COMMENT="$JIRA_COMMENT @@ -707,8 +715,8 @@ runTests () { if [[ $building_common -eq 0 ]]; then echo " Building hadoop-common with -Pnative in order to provide \ libhadoop.so to the hadoop-hdfs unit tests." - echo " $MVN compile -Pnative -D${PROJECT_NAME}PatchProcess" - if ! $MVN compile -Pnative -D${PROJECT_NAME}PatchProcess; then + echo " $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess" + if ! $MVN compile $NATIVE_PROFILE -D${PROJECT_NAME}PatchProcess; then JIRA_COMMENT="$JIRA_COMMENT {color:red}-1 core tests{color}. Failed to build the native portion \ 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 cd $module echo " Running tests in $module" - echo " $MVN clean install -fn -Pnative -D${PROJECT_NAME}PatchProcess" - $MVN clean install -fn -Pnative -Drequire.test.libhadoop -D${PROJECT_NAME}PatchProcess + echo " $MVN clean install -fn $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -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 "