aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2015-11-13 09:30:27 +0000
committerLinaro Code Review <review@review.linaro.org>2015-11-13 09:30:27 +0000
commit17eac8f4db8515a478d3cd7753cd962a032be272 (patch)
tree171e332b7f2d107bc3fec8b1f5e2560edc8b1be7
parent24fc43498008f195dace06ac6f765943cc19980d (diff)
parent6ef80df0cd74a05351181c20dc9f021b2e07dd28 (diff)
Merge "Emit HTML reports similar to the XML ones, so that they can be displayed in Jenkins even without the Summary Display plugin."
-rwxr-xr-xscripts/compare_jobs.sh73
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}