HADOOP-9583. test-patch gives +1 despite build failure when running tests. Contributed by Jason Lowe.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1513200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2013-08-12 17:03:36 +00:00
parent 1fafb1e1e0
commit dedbd19bea
2 changed files with 41 additions and 8 deletions

View File

@ -731,32 +731,62 @@ of hadoop-common prior to running the unit tests in $ordered_modules"
fi fi
fi fi
fi fi
failed_test_builds=""
test_timeouts=""
for module in $ordered_modules; do for module in $ordered_modules; do
cd $module cd $module
module_suffix=`basename ${module}`
test_logfile=$PATCH_DIR/testrun_${module_suffix}.txt
echo " Running tests in $module" echo " Running tests in $module"
echo " $MVN clean install -fn $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -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 $MVN clean install -fae $NATIVE_PROFILE $REQUIRE_TEST_LIB_HADOOP -D${PROJECT_NAME}PatchProcess > $test_logfile 2>&1
test_build_result=$?
cat $test_logfile
module_test_timeouts=`$AWK '/^Running / { if (last) { print last } last=$2 } /^Tests run: / { last="" }' $test_logfile`
if [[ -n "$module_test_timeouts" ]] ; then
test_timeouts="$test_timeouts
$module_test_timeouts"
fi
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
# find the errors instead of using the exit code. We assume that if the build
# failed a -1 is already given for that case
if [[ -n "$module_failed_tests" ]] ; then if [[ -n "$module_failed_tests" ]] ; then
failed_tests="${failed_tests} failed_tests="${failed_tests}
${module_failed_tests}" ${module_failed_tests}"
fi fi
if [[ $test_build_result != 0 && -z "$module_failed_tests" && -z "$module_test_timeouts" ]] ; then
failed_test_builds="$module $failed_test_builds"
fi
cd - cd -
done done
result=0
comment_prefix=" {color:red}-1 core tests{color}."
if [[ -n "$failed_tests" ]] ; then if [[ -n "$failed_tests" ]] ; then
JIRA_COMMENT="$JIRA_COMMENT JIRA_COMMENT="$JIRA_COMMENT
{color:red}-1 core tests{color}. The patch failed these unit tests in $modules: $comment_prefix The patch failed these unit tests in $modules:
$failed_tests" $failed_tests"
return 1 comment_prefix=" "
result=1
fi fi
if [[ -n "$test_timeouts" ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
$comment_prefix The following test timeouts occurred in $modules:
$test_timeouts"
comment_prefix=" "
result=1
fi
if [[ -n "$failed_test_builds" ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
$comment_prefix The test build failed in $failed_test_builds"
result=1
fi
if [[ $result == 0 ]] ; then
JIRA_COMMENT="$JIRA_COMMENT JIRA_COMMENT="$JIRA_COMMENT
{color:green}+1 core tests{color}. The patch passed unit tests in $modules." {color:green}+1 core tests{color}. The patch passed unit tests in $modules."
return 0 fi
return $result
} }
############################################################################### ###############################################################################

View File

@ -268,6 +268,9 @@ Trunk (Unreleased)
HADOOP-9433 TestLocalFileSystem#testHasFileDescriptor leaks file handle HADOOP-9433 TestLocalFileSystem#testHasFileDescriptor leaks file handle
(Chris Nauroth via sanjay) (Chris Nauroth via sanjay)
HADOOP-9583. test-patch gives +1 despite build failure when running tests.
(jlowe via kihwal)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-7761. Improve the performance of raw comparisons. (todd) HADOOP-7761. Improve the performance of raw comparisons. (todd)