diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2015-11-03 22:53:11 +0100 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2015-11-04 14:12:06 +0100 |
commit | a2c29d57df89981c14678fa9699a21d69f62e8db (patch) | |
tree | 41c50561551dd726be3692db210e172fedd0f4c5 | |
parent | 335432990eaf17b4f8a829d7bc53c1ca8786dd1b (diff) |
Emit HTML reports similar to the XML ones,abe-html
so that they can be displayed in Jenkins
even with the XML reports plugin.
Change-Id: Ida03a7200601fc599b1a65759fece04ff09ae6b5
-rwxr-xr-x | scripts/compare_jobs.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/scripts/compare_jobs.sh b/scripts/compare_jobs.sh index c82eda32..e542782f 100755 --- a/scripts/compare_jobs.sh +++ b/scripts/compare_jobs.sh @@ -35,6 +35,23 @@ function xml_report_print_row EOF } +function html_report_print_row +{ + local target=${1?} + local failed=${2?} + local log_url=diff-${target}.txt + local color='#00FF00' + $failed && color='#FF0000' + local message=PASSED + $failed && message=FAILED + cat <<EOF + <tr> + <td>${target}</td> + <td style="background-color:$color"><a href="$log_url"><b>${message}</b></a></td> + </tr> +EOF +} + function xml_report_print_header { cat <<EOF @@ -47,6 +64,18 @@ function xml_report_print_header EOF } +function html_report_print_header +{ + cat <<EOF +<h1>Results comparison ${ref_logs} vs ${new_logs}</h1> +<table border="1"> + <tr> + <td><b>Target</b></td> + <td><b>Status</b></td> + </tr> +EOF +} + function xml_report_print_footer { cat <<EOF @@ -54,6 +83,13 @@ function xml_report_print_footer EOF } +function html_report_print_footer +{ + cat <<EOF +</table> +EOF +} + function xml_log_print_field { local target=${1?} @@ -68,6 +104,18 @@ cat <<EOF EOF } +function html_log_print_field +{ + local target=${1?} + local log=${2?} + cat <<EOF + <p>${target}</p> +EOF +cat $log +cat <<EOF +EOF +} + function xml_log_print_header { cat <<EOF @@ -75,6 +123,13 @@ function xml_log_print_header EOF } +function html_log_print_header +{ + cat <<EOF +<h1>Logs</h1> +EOF +} + function xml_log_print_footer { cat <<EOF @@ -82,6 +137,12 @@ function xml_log_print_footer EOF } +function html_log_print_footer +{ + cat <<EOF +EOF +} + # For the time being, we expect different jobs to store their results # in similar directories. @@ -105,12 +166,18 @@ fi rm -f ${tmptargets} XML_REPORT=${mydir}/report0.xml +HTML_REPORT=${mydir}/report0.html rm -f ${XML_REPORT} ${XML_REPORT}.part +rm -f ${HTML_REPORT} ${HTML_REPORT}.part XML_LOG=${mydir}/report1.xml +HTML_LOG=${mydir}/report1.html rm -f ${XML_LOG} ${XML_LOG}.part +rm -f ${HTML_LOG} ${HTML_LOG}.part xml_report_print_header > ${XML_REPORT}.part +html_report_print_header > ${HTML_REPORT}.part xml_log_print_header > ${XML_LOG}.part +html_log_print_header > ${HTML_LOG}.part for buildtarget in ${buildtargets} do @@ -129,12 +196,18 @@ do ${failed} && status=1 xml_report_print_row "${buildtarget}" "${failed}" >> $XML_REPORT.part + html_report_print_row "${buildtarget}" "${failed}" >> $HTML_REPORT.part xml_log_print_field "${buildtarget}" ${mylog} >> $XML_LOG.part + html_log_print_field "${buildtarget}" ${mylog} >> $HTML_LOG.part done xml_report_print_footer >> ${XML_REPORT}.part +html_report_print_footer >> ${HTML_REPORT}.part xml_log_print_footer >> ${XML_LOG}.part +html_log_print_footer >> ${HTML_LOG}.part mv ${XML_REPORT}.part ${XML_REPORT} +mv ${HTML_REPORT}.part ${HTML_REPORT} mv ${XML_LOG}.part ${XML_LOG} +mv ${HTML_LOG}.part ${HTML_LOG} exit ${status} |