This is an automated email from the ASF dual-hosted git repository. aw pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/yetus.git
The following commit(s) were added to refs/heads/master by this push: new 557b023 YETUS-871. cleanup the junit output format (#70) 557b023 is described below commit 557b0230d9286cfbbb676e9aefa879e72fed64df Author: Allen Wittenauer <a...@apache.org> AuthorDate: Wed Aug 14 22:48:54 2019 -0700 YETUS-871. cleanup the junit output format (#70) --- .circleci/config.yml | 2 +- .gitlab-ci.yml | 4 ++-- Jenkinsfile | 4 ++-- precommit/src/main/shell/test-patch.d/junit.sh | 27 ++++++++++++++------------ 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 76ffc36..29f85f3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ jobs: --brief-report-file=/tmp/yetus-out/brief.txt --bugcomments=briefreport,htmlout,junit --tests-filter=checkstyle,javadoc,rubocop,test4tests - --junit-results-xml=/tmp/yetus-out/results.xml + --junit-report-xml=/tmp/yetus-out/junit-report.xml - store_test_results: path: /tmp/yetus-out diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2b65b8..2a0eaa4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ buretoolbox-job: --brief-report-file=/tmp/yetus-out/brief.txt --bugcomments=briefreport,htmlout,gitlab,junit --tests-filter=checkstyle,javadoc,rubocop,test4tests - --junit-results-xml=/tmp/yetus-out/results.xml + --junit-report-xml=/tmp/yetus-out/junit-report.xml artifacts: expire_in: 1 week @@ -37,4 +37,4 @@ buretoolbox-job: paths: - yetus-out/ reports: - junit: yetus-out/results.xml + junit: yetus-out/junit-report.xml diff --git a/Jenkinsfile b/Jenkinsfile index 58fed66..00727aa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -128,7 +128,7 @@ pipeline { YETUS_ARGS+=("--brief-report-file=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/brief.txt") YETUS_ARGS+=("--console-report-file=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/console.txt") YETUS_ARGS+=("--html-report-file=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/report.html") - YETUS_ARGS+=("--junit-results-xml=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/results.xml") + YETUS_ARGS+=("--junit-report-xml=${WORKSPACE}/${YETUS_RELATIVE_PATCHDIR}/junit-report.xml") # enable writing back to Github YETUS_ARGS+=(--github-password="${GITHUB_PASSWORD}") @@ -204,7 +204,7 @@ pipeline { script { // Publish JUnit results try { - junit "${env.YETUS_RELATIVE_PATCHDIR}/results.xml" + junit "${env.YETUS_RELATIVE_PATCHDIR}/junit-report.xml" } catch(e) { echo 'junit processing: ' + e.toString() } diff --git a/precommit/src/main/shell/test-patch.d/junit.sh b/precommit/src/main/shell/test-patch.d/junit.sh index 3d44883..a5215db 100755 --- a/precommit/src/main/shell/test-patch.d/junit.sh +++ b/precommit/src/main/shell/test-patch.d/junit.sh @@ -29,7 +29,7 @@ function junit_usage { yetus_add_option "--junit-test-output=<path>" "Directory to search for the test output TEST-*.xml files, relative to the module directory (default:'${JUNIT_TEST_OUTPUT_DIR}')" yetus_add_option "--junit-test-prefix=<prefix to trim>" "Prefix of test names to be be removed. Used to shorten test names by removing common package name. (default:'${JUNIT_TEST_PREFIX}')" - yetus_add_option "--junit-results-xml=<path>" "Filename to generate a Junit report" + yetus_add_option "--junit-report-xml=<file>" "Filename to use when generating a JUnit-style report (default: ${JUNIT_REPORT_XML}" } function junit_parse_args @@ -46,9 +46,9 @@ function junit_parse_args delete_parameter "${i}" JUNIT_TEST_PREFIX=${i#*=} ;; - --junit-results-xml=*) + --junit-report-xml=*) delete_parameter "${i}" - JUNIT_RESULTS_XML=${i#*=} + JUNIT_REPORT_XML=${i#*=} ;; esac done @@ -63,6 +63,10 @@ function junit_process_tests declare module_test_timeouts declare module_failed_tests + if [[ -z "${JUNIT_TEST_OUTPUT_DIR}" ]]; then + return 0 + fi + # shellcheck disable=SC2016 module_test_timeouts=$("${AWK}" '/^Running / { array[$NF] = 1 } /^Tests run: .* in / { delete array[$NF] } END { for (x in array) { print x } }' "${buildlogfile}") if [[ -n "${module_test_timeouts}" ]] ; then @@ -121,15 +125,15 @@ function junit_finalreport declare footsub declare footcomment - if [[ -z "${JUNIT_RESULTS_XML}" ]]; then + if [[ -z "${JUNIT_REPORT_XML}" ]]; then return fi - big_console_header "Writing JUnit results to ${JUNIT_RESULTS_XML}" + big_console_header "Writing JUnit-style results to ${JUNIT_REPORT_XML}" url=$(get_artifact_url) -cat << EOF > "${JUNIT_RESULTS_XML}" +cat << EOF > "${JUNIT_REPORT_XML}" <testsuites> <testsuite tests="1" failures="'${result}'" time="1" name="Apache Yetus"> EOF @@ -151,7 +155,7 @@ EOF ((counter=0)) fi - if [[ "${vote}" = "H" ]]; then + if [[ -z "${vote// }" || "${vote}" = "H" ]]; then ((i=i+1)) continue fi @@ -202,12 +206,11 @@ EOF echo "</failure>" fi echo "</testcase>" - } >> "${JUNIT_RESULTS_XML}" + } >> "${JUNIT_REPORT_XML}" ((i=i+1)) done - echo "</testsuite>" >> "${JUNIT_RESULTS_XML}" - echo "</testsuites>" >> "${JUNIT_RESULTS_XML}" -} - + echo "</testsuite>" >> "${JUNIT_REPORT_XML}" + echo "</testsuites>" >> "${JUNIT_REPORT_XML}" +} \ No newline at end of file