tobiko/tools/ci/make_report
Federico Ressi 88cdecbc4f Produce separate named report files
Refactor role with tags for execute pre-run, run and
post-run phases.

Change-Id: I7daff63be56d2746a63e00d21aaa78078e60f60f
2019-12-03 21:06:38 +00:00

49 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Produce test HTML report file into ${REPORT_DIR}
set -xeu
# Imput paths
TOBIKO_TOX_DIR=${TOBIKO_TOX_DIR:-$(pwd)}
# Output dirs
TOBIKO_TEST_REPORT_DIR=${TOBIKO_TEST_REPORT_DIR:-${TOBIKO_TOX_DIR}}
# Output files
TOBIKO_TEST_REPORT_NAME=${TOBIKO_TEST_REPORT_NAME:-tobiko_results}
TOBIKO_TEST_REPORT_SUBUNIT=${TOBIKO_TEST_REPORT_SUBUNIT:-${TOBIKO_TEST_REPORT_DIR}/${TOBIKO_TEST_REPORT_NAME}.subunit}
TOBIKO_TEST_REPORT_HTML=${TOBIKO_TEST_REPORT_HTML:-${TOBIKO_TEST_REPORT_DIR}/${TOBIKO_TEST_REPORT_NAME}.html}
TOBIKO_TEST_REPORT_XML=${TOBIKO_TEST_REPORT_XML:-${TOBIKO_TEST_REPORT_DIR}/${TOBIKO_TEST_REPORT_NAME}.xml}
function make_report() {
make_report_subunit
make_report_html
make_report_xml
}
function make_report_subunit() {
mkdir -p $(dirname "${TOBIKO_TEST_REPORT_SUBUNIT}")
(
cd "${TOBIKO_TOX_DIR}"
stestr last --subunit --force-subunit-trace --all-attachments
) > "${TOBIKO_TEST_REPORT_SUBUNIT}"
}
function make_report_html() {
mkdir -p $(dirname "${TOBIKO_TEST_REPORT_HTML}")
subunit2html "${TOBIKO_TEST_REPORT_SUBUNIT}" "${TOBIKO_TEST_REPORT_HTML}" > /dev/null
}
function make_report_xml() {
mkdir -p $(dirname "${TOBIKO_TEST_REPORT_XML}")
subunit2junitxml "${TOBIKO_TEST_REPORT_SUBUNIT}" -o "${TOBIKO_TEST_REPORT_XML}" || true
}
make_report