Repository: oozie Updated Branches: refs/heads/master 57c2a2f55 -> c93f94835
OOZIE-3343 [build] [tests] Add the first five test errors per module to the report (kmarton via andras.piros) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/c93f9483 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/c93f9483 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/c93f9483 Branch: refs/heads/master Commit: c93f94835695015578299d1f8df3601dbeafbd90 Parents: 57c2a2f Author: Andras Piros <andras.pi...@cloudera.com> Authored: Tue Sep 25 14:24:14 2018 +0200 Committer: Andras Piros <andras.pi...@cloudera.com> Committed: Tue Sep 25 14:24:14 2018 +0200 ---------------------------------------------------------------------- bin/test-patch-20-tests | 81 +++++++++++++++++++++++++++++--------------- release-log.txt | 1 + 2 files changed, 54 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/c93f9483/bin/test-patch-20-tests ---------------------------------------------------------------------- diff --git a/bin/test-patch-20-tests b/bin/test-patch-20-tests index 11dc827..02493bd 100755 --- a/bin/test-patch-20-tests +++ b/bin/test-patch-20-tests @@ -25,6 +25,8 @@ SUMMARYFILEFULL="" STDOUT="/dev/null" MVNPASSTHRU="" FLAKY_LIMIT=10 +TIMEOUT_MSG="There was a timeout or other error in the fork" +TEST_FAILURE_PER_PROJECT=5 ############################################################################### cleanupAndExit() { @@ -50,6 +52,7 @@ parseArgs() { --tempdir=*) TEMPDIR=${i#*=} TESTS_OUT="${TEMPDIR}/${TASKNAME}.out" + TEST_RESULTS_DIR="${TEMPDIR}/${TASKNAME}/results" ;; --reportdir=*) REPORTDIR=${i#*=} @@ -87,7 +90,8 @@ parseArgs() { count_test_result_type() { local type=$1 - find . -name "TEST-*.xml" -exec sh -c 'xmllint --xpath "string(//testsuite/@'"${type}"')" $1; echo' _ {} \; \ + local path=$2 + find "${path}" -name "TEST-*.xml" -exec sh -c 'xmllint --xpath "string(//testsuite/@'"${type}"')" $1; echo' _ {} \; \ | awk 'BEGIN {count=0} {count=count+$1} END {print count}'; } @@ -126,6 +130,14 @@ run_tests() { echo "$exitCode" > "${TEMPDIR}/${TASKNAME}.exitCode" } +save_failures() { + if [ ! -d "$TEST_RESULTS_DIR" ]; then + mkdir -p "${TEST_RESULTS_DIR}" + fi + + rsync -qR "$(find . -name 'TEST*.xml' ! -path '*/test-patch/*' -print0 | xargs -0 grep -El '<error|<failure')" "${TEST_RESULTS_DIR}" +} + print_flakies() { if [ -f "${TEMPDIR}/${TASKNAME}.flakies.out" ]; then echo ". {color:orange}Tests failed at first run:{color}" @@ -147,40 +159,52 @@ print_flakies_full() { print_flakies } +printTestFailures() { + failurePattern=$1 + failureType=$2 + + for path in "${TEST_RESULTS_DIR}"/* ; do + [ -d "${path}" ] || continue # if not a directory, skip + module="$(basename "${path}")" + totalFailedTestsInModule=$(count_test_result_type "$failureType" "$path") + if [[ ${totalFailedTestsInModule} != 0 ]] ; then + echo "{color:red}-1{color} [ERROR] There are [${totalFailedTestsInModule}] test ${failureType} in [${module}]. Listing only the first [${TEST_FAILURE_PER_PROJECT}] ones" + failures=$(find "${path}" -name 'TEST*.xml' -print0 | xargs grep -hB1 "${failurePattern}" | grep -Evm"${TEST_FAILURE_PER_PROJECT}" "${failurePattern}|--" | cut -d \" -f4,2 | sed 's/"/:/g' ) + echo "${failures}" + fi + done +} + generate_report() { - failedTests=$(find . -name '*\.txt' | grep target/surefire-reports | xargs grep "<<< FAILURE" | grep -v "Tests run:" | sed 's/.*\.txt\://' | sed 's/ .*//') - testsWithError=$(find . -name '*\.txt' | grep target/surefire-reports | xargs grep "<<< ERROR" | grep -v "Tests run:" | sed 's/.*\.txt\://' | sed 's/ .*//') testsRun=$(grep "Tests run:" "${TESTS_OUT}" | grep -v " Time elapsed:" | awk '{print $4}' | sed 's/,//' | awk 'BEGIN {count=0} {count=count+$1} END {print count}') - testsFailed=$(count_test_result_type failures) - testsErrors=$(count_test_result_type errors) - hasFailures=$((testsFailed + testsErrors)) + testsFailed=$(count_test_result_type failures "${TEST_RESULTS_DIR}") + testsErrors=$(count_test_result_type errors "${TEST_RESULTS_DIR}") + timeout=$(grep -c "${TIMEOUT_MSG}" "${TESTS_OUT}") + hasFailures=$((testsFailed + testsErrors + timeout)) testsExitCode=$(cat "${TEMPDIR}/${TASKNAME}.exitCode") - errors=$(grep -c '\[ERROR\]' "${TESTS_OUT}") - if [[ ${errors} -gt 0 && ${testsErrors} -eq 0 ]] ; then + if [[ ${hasFailures} != 0 ]] ; then echo "{color:red}-1 ${TASKNAME}{color}" - echo "There were errors during execution. Check console output for details." - else - if [[ ${hasFailures} != 0 ]] ; then - echo "{color:red}-1 ${TASKNAME}{color}" - echo ". Tests run: $testsRun" - echo ". Tests failed: $testsFailed" - echo ". Tests errors: $testsErrors" - echo "" - echo ". The patch failed the following testcases:" + echo ". Tests run : $testsRun" + echo ". Tests failed : $testsFailed" + echo ". Tests in error : $testsErrors" + echo ". Tests timed out : $timeout" + echo "" + if [[ ${testsFailed} != 0 ]] ; then + printTestFailures "<failure" failures echo "" - echo "${failedTests//#/. /}" - echo "" - echo ". Tests failing with errors:" - echo "${testsWithError//#/. /}" + fi + if [[ ${testsErrors} != 0 ]] ; then + printTestFailures "<error" errors echo "" + fi + echo "Check console output for the full list of errors/failures" + else + if [[ "${testsExitCode}" != "0" ]] ; then + echo "{color:red}-1 ${TASKNAME}{color} - patch does not compile, cannot run test cases" else - if [[ "${testsExitCode}" != "0" ]] ; then - echo "{color:red}-1 ${TASKNAME}{color} - patch does not compile, cannot run testcases" - else - echo "{color:green}+1 ${TASKNAME}{color}" - echo ". Tests run: $testsRun" - fi + echo "{color:green}+1 ${TASKNAME}{color}" + echo ". Tests run: $testsRun" fi fi } @@ -193,9 +217,10 @@ case $OP in ;; post) run_tests + save_failures ;; report) - generate_report >> "${SUMMARYFILE}" + generate_report >> "${SUMMARYFILE}" print_flakies_short >> "${SUMMARYFILE}" print_flakies_full >> "${SUMMARYFILEFULL}" ;; http://git-wip-us.apache.org/repos/asf/oozie/blob/c93f9483/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 0a97e34..89d1e0d 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 5.1.0 release (trunk - unreleased) +OOZIE-3343 [build] [tests] Add the first five test errors per module to the report (kmarton via andras.piros) OOZIE-3307 [core] Limit heap usage of LauncherAM (andras.piros) OOZIE-3352 [tests] TestCallableQueueService#testPriorityExecutionOrder() is flaky (pbacsko) OOZIE-3351 [tests] Flaky test TestMemoryLocks#testWriteLockSameThreadNoWait() (pbacsko)