Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ 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
when: always
paths:
- yetus-out/
reports:
junit: yetus-out/results.xml
junit: yetus-out/junit-report.xml
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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()
}
Expand Down
27 changes: 15 additions & 12 deletions precommit/src/main/shell/test-patch.d/junit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -151,7 +155,7 @@ EOF
((counter=0))
fi

if [[ "${vote}" = "H" ]]; then
if [[ -z "${vote// }" || "${vote}" = "H" ]]; then
((i=i+1))
continue
fi
Expand Down Expand Up @@ -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}"
}