summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2016-01-13 14:40:27 +0100
committerChristophe Lyon <christophe.lyon@linaro.org>2016-01-18 15:15:11 +0100
commit473c8168d0669f42006819c3440d12364fb1ff4e (patch)
tree5c8b233f20ce067d265f873932b80e4922f6cb4f
parenta237d2a559e2442ed744ea5c1427932060342b5e (diff)
compare_jobs.sh: Fix HTML.
So that the browsers render the colors correctly. Change-Id: Iab79c96c183d685f0b6c7fab8ab557704408e7a7
-rwxr-xr-xcompare_jobs.sh48
-rw-r--r--report.css6
2 files changed, 48 insertions, 6 deletions
diff --git a/compare_jobs.sh b/compare_jobs.sh
index 5e90a9c..dfeb139 100755
--- a/compare_jobs.sh
+++ b/compare_jobs.sh
@@ -35,13 +35,13 @@ EOF
function html_report_print_row
{
local target=${1?}
- local color=${2?}
+ local status=${2?}
local message=${3?}
local log_url=diff-${target}.txt
cat <<EOF
<tr>
<td>${target}</td>
- <td style="background-color:$color"><a href="$log_url"><b>${message}</b></a></td>
+ <td class="$status"><a href="$log_url"><b>${message}</b></a></td>
</tr>
EOF
}
@@ -58,6 +58,22 @@ function xml_report_print_header
EOF
}
+# Should be called for all HTML documents (e.g. report, log, ...)
+function html_doc_print_header
+{
+ cat <<EOF
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <title>Report</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <link rel="stylesheet" type="text/css" href="report.css" />
+</head>
+<body>
+EOF
+}
+
function html_report_print_header
{
cat <<EOF
@@ -77,6 +93,15 @@ function xml_report_print_footer
EOF
}
+# Should be called for all HTML documents (e.g. report, log, ...)
+function html_doc_print_footer
+{
+ cat <<EOF
+</body>
+</html>
+EOF
+}
+
function html_report_print_footer
{
cat <<EOF
@@ -167,9 +192,11 @@ 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
+html_doc_print_header > ${HTML_REPORT}.part
+html_report_print_header >> ${HTML_REPORT}.part
xml_log_print_header > ${XML_LOG}.part
-html_log_print_header > ${HTML_LOG}.part
+html_doc_print_header > ${HTML_LOG}.part
+html_log_print_header >> ${HTML_LOG}.part
# Gather all diffs, to concatenate them to the main report
difflog=${mydir}/alldiffs.txt
@@ -190,6 +217,7 @@ do
printf "\t#\t\t*** ${buildtarget} ***\n" >> ${mylog}
printf "\t# ============================================================== #\n\n" >> ${mylog}
+ class=no-change
color=lightgreen
message=PASSED
@@ -208,25 +236,30 @@ do
0) # No change
;;
1) # Improvement
- color=green
+ class=improvement
+ color=green
message=BETTER
;;
2) # Regression
+ class=regression
color=red
message=FAILED
failed=true
;;
3) # No common logs
+ class=no-common-logs
color=red
message=NO-COMMON-LOGS
failed=true
;;
4) # Extra logs
+ class=extra-logs
color=red
message=EXTRA-LOGS
failed=true
;;
5) # Build failed
+ class=build-failed
color=darkred
message=BUILDFAILED
failed=true
@@ -235,7 +268,7 @@ do
${failed} && status=1
xml_report_print_row "${buildtarget}" "$color" "$message" >> $XML_REPORT.part
- html_report_print_row "${buildtarget}" "$color" "$message" >> $HTML_REPORT.part
+ html_report_print_row "${buildtarget}" "$class" "$message" >> $HTML_REPORT.part
xml_log_print_field "${buildtarget}" ${mylog} >> $XML_LOG.part
html_log_print_field "${buildtarget}" ${mylog} >> $HTML_LOG.part
@@ -252,6 +285,9 @@ cat ${difflog} >> ${HTML_REPORT}.part
rm -f ${difflog}
echo "</pre>" >> ${HTML_REPORT}.part
+html_doc_print_footer >> ${HTML_REPORT}.part
+html_doc_print_footer >> ${HTML_LOG}.part
+
mv ${XML_REPORT}.part ${XML_REPORT}
mv ${HTML_REPORT}.part ${HTML_REPORT}
mv ${XML_LOG}.part ${XML_LOG}
diff --git a/report.css b/report.css
new file mode 100644
index 0000000..cd3ff4b
--- /dev/null
+++ b/report.css
@@ -0,0 +1,6 @@
+.improvement { background-color: green; }
+.no-change { background-color: lightgreen; }
+.regression { background-color: red; }
+.no-common-logs { background-color: red; }
+.extra-logs { background-color: red; }
+.build-failed { background-color: darkred; }