Add css file for LCOV html

Added lcov.css to update background colors and enable line hovering for
LCOV staic html. Fixed bazel rules for lcov configs.

Signed-off-by: Maria Del Carmen Ignacio <mariaignacio@google.com>
Change-Id: I283d50108084773a612f4b4520ac6776d79d5b90
diff --git a/BUILD.bazel b/BUILD.bazel
index f2937c1..887a663 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -3,9 +3,20 @@
     "container_image",
     "container_push",
 )
+load("@rules_pkg//:pkg.bzl", "pkg_tar")
 load("@debs//file:packages.bzl", "packages")
 load("//:debs.bzl", "get_dep_list")
 
+pkg_tar(
+    name = "lcov_configs",
+    package_dir = "/lcov",
+    srcs = [
+        "lcov/lcov.css",
+        "lcov/emerald.png",
+        "lcov/ruby.png",
+    ],
+)
+
 # build container using kunit.sh and latest kunitconfig from gerrit
 container_image(
     name = "kunit",
@@ -17,6 +28,7 @@
         "kunit.sh",
         "@kunitconfig_repo//:kunitconfig",
     ],
+    tars = ["lcov_configs"],
     mode = "777",
     repository = "kunit-presubmit/kunit",
 )
diff --git a/Dockerfile b/Dockerfile
index 8ed6d70..b8f5803 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,4 +12,5 @@
   && apt-get clean
 COPY kunit.sh /kunit.sh
 COPY kunitconfig /kunitconfig
+COPY lcov /lcov
 ENTRYPOINT ["/kunit.sh"]
diff --git a/WORKSPACE b/WORKSPACE
index 7d7dd23..9bfb716 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -15,6 +15,15 @@
     urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.8.0.tar.gz"],
 )
 
+# import bazel rules for pkg_tar and friends.
+http_archive(
+    name = "rules_pkg",
+    url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.1/rules_pkg-0.2.1.tar.gz",
+    sha256 = "04c1eab736f508e94c297455915b6371432cbc4106765b5252b444d1656db051",
+)
+load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
+rules_pkg_dependencies()
+
 # pull latest kunitconfig
 new_git_repository(
     name = "kunitconfig_repo",
diff --git a/kunit.sh b/kunit.sh
index 170f11f..4ef46d8 100755
--- a/kunit.sh
+++ b/kunit.sh
@@ -35,9 +35,15 @@
 
 # Generate an HTML coverage report using LCOV
 lcov -t "kunit_presubmit_tests" -o coverage.info -c -d . > "$ARTIFACTS/lcov.log" 2>&1
-genhtml -o "$ARTIFACTS/coverage_html" coverage.info > "$ARTIFACTS/genhtml.log" 2>&1
+genhtml -o "$ARTIFACTS/coverage_html" coverage.info --css-file /lcov/lcov.css > "$ARTIFACTS/genhtml.log" 2>&1
 GENHTML_EXIT_CODE=$?
 
+if [[ $GENHTML_EXIT_CODE -eq 0 ]]; then
+  # Overwrite the pixel images in coverage_html
+  cp /lcov/emerald.png "$ARTIFACTS/coverage_html"
+  cp /lcov/ruby.png "$ARTIFACTS/coverage_html"
+fi
+
 if [[ $KUNIT_TEST_EXIT_CODE -ne 0 ]]; then
   echo "KUnit Tool Presubmit Failed:"
   echo "============================="
diff --git a/lcov/emerald.png b/lcov/emerald.png
new file mode 100644
index 0000000..770cddc
--- /dev/null
+++ b/lcov/emerald.png
Binary files differ
diff --git a/lcov/lcov.css b/lcov/lcov.css
new file mode 100644
index 0000000..6bce5e5
--- /dev/null
+++ b/lcov/lcov.css
@@ -0,0 +1,531 @@
+/* All views: initial background and text color */
+body
+{
+  color: #000000;
+  background-color: #FFFFFF;
+}
+
+/* All views: standard link format*/
+a:link
+{
+  color: #284FA8;
+  text-decoration: underline;
+}
+
+/* All views: standard link - visited format */
+a:visited
+{
+  color: rgb(79, 126, 83);
+  text-decoration: underline;
+}
+
+/* All views: standard link - activated format */
+a:active
+{
+  color:rgb(255, 153, 153);
+  text-decoration: underline;
+}
+
+/*All views: collapse table*/
+table
+{
+  border-collapse:collapse;
+}
+
+/*All views: make table rows hoverable*/
+center tr:hover
+{
+  filter: brightness(.95);
+}
+
+
+/* All views: main title format */
+td.title
+{
+  text-align: center;
+  padding-bottom: 10px;
+  font-family: sans-serif;
+  font-size: 20pt;
+  font-style: italic;
+  font-weight: bold;
+}
+
+/* All views: header item format */
+td.headerItem
+{
+  text-align: right;
+  padding-right: 6px;
+  font-family: sans-serif;
+  font-weight: bold;
+  vertical-align: top;
+  white-space: nowrap;
+}
+
+/* All views: header item value format */
+td.headerValue
+{
+  text-align: left;
+  color: #284FA8;
+  font-family: sans-serif;
+  font-weight: bold;
+  white-space: nowrap;
+}
+
+/* All views: header item coverage table heading */
+td.headerCovTableHead
+{
+  text-align: center;
+  padding-right: 6px;
+  padding-left: 6px;
+  padding-bottom: 0px;
+  font-family: sans-serif;
+  font-size: 80%;
+  white-space: nowrap;
+}
+
+/* All views: header item coverage table entry */
+td.headerCovTableEntry
+{
+  text-align: right;
+  color: #284FA8;
+  font-family: sans-serif;
+  font-weight: bold;
+  white-space: nowrap;
+  padding-left: 12px;
+  padding-right: 4px;
+  background-color: #DAE7FE;
+}
+
+/* All views: header item coverage table entry for high coverage rate */
+td.headerCovTableEntryHi
+{
+  text-align: right;
+  color: #000000;
+  font-family: sans-serif;
+  font-weight: bold;
+  white-space: nowrap;
+  padding-left: 12px;
+  padding-right: 4px;
+  background-color: rgb(174, 239, 175);
+}
+
+/* All views: header item coverage table entry for medium coverage rate */
+td.headerCovTableEntryMed
+{
+  text-align: right;
+  color: #000000;
+  font-family: sans-serif;
+  font-weight: bold;
+  white-space: nowrap;
+  padding-left: 12px;
+  padding-right: 4px;
+  background-color: #FFEA20;
+}
+
+/* All views: header item coverage table entry for low coverage rate */
+td.headerCovTableEntryLo
+{
+  text-align: right;
+  color: #000000;
+  font-family: sans-serif;
+  font-weight: bold;
+  white-space: nowrap;
+  padding-left: 12px;
+  padding-right: 4px;
+  background-color: rgb(255, 153, 153);
+}
+/* All views: header legend value for legend entry */
+td.headerValueLeg
+{
+  text-align: left;
+  color: #000000;
+  font-family: sans-serif;
+  font-size: 80%;
+  white-space: nowrap;
+  padding-top: 4px;
+}
+
+/* All views: color of horizontal ruler */
+td.ruler
+{
+  background-color: #6688D4;
+}
+
+/* All views: version string format */
+td.versionInfo
+{
+  text-align: center;
+  padding-top: 2px;
+  font-family: sans-serif;
+  font-style: italic;
+}
+
+/* Directory view/File view (all)/Test case descriptions:
+   table headline format */
+td.tableHead
+{
+  text-align: center;
+  color: #FFFFFF;
+  background-color: #6688D4;
+  font-family: sans-serif;
+  font-size: 120%;
+  font-weight: bold;
+  white-space: nowrap;
+  padding-left: 4px;
+  padding-right: 4px;
+}
+
+span.tableHeadSort
+{
+  padding-right: 4px;
+}
+
+/* Directory view/File view (all): filename entry format */
+td.coverFile
+{
+  text-align: left;
+  padding-left: 10px;
+  padding-right: 20px;
+  color: #284FA8;
+  background-color: #DAE7FE;
+  font-family: monospace;
+}
+
+/* Directory view/File view (all): bar-graph entry format*/
+td.coverBar
+{
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: #DAE7FE;
+}
+
+/* Directory view/File view (all): bar-graph outline color */
+td.coverBarOutline
+{
+  background-color: #000000;
+}
+
+/* Directory view/File view (all): percentage entry for files with
+   high coverage rate */
+td.coverPerHi
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: rgb(174, 239, 175);
+  font-weight: bold;
+  font-family: sans-serif;
+}
+
+/* Directory view/File view (all): line count entry for files with
+   high coverage rate */
+td.coverNumHi
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: rgb(174, 239, 175);
+  white-space: nowrap;
+  font-family: sans-serif;
+}
+
+/* Directory view/File view (all): percentage entry for files with
+   medium coverage rate */
+td.coverPerMed
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: #FFEA20;
+  font-weight: bold;
+  font-family: sans-serif;
+}
+
+/* Directory view/File view (all): line count entry for files with
+   medium coverage rate */
+td.coverNumMed
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: #FFEA20;
+  white-space: nowrap;
+  font-family: sans-serif;
+}
+
+/* Directory view/File view (all): percentage entry for files with
+   low coverage rate */
+td.coverPerLo
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: rgb(255, 153, 153);
+  font-weight: bold;
+  font-family: sans-serif;
+}
+
+/* Directory view/File view (all): line count entry for files with
+   low coverage rate */
+td.coverNumLo
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: rgb(255, 153, 153);
+  white-space: nowrap;
+  font-family: sans-serif;
+}
+
+/* File view (all): "show/hide details" link format */
+a.detail:link
+{
+  color: #B8D0FF;
+  font-size:80%;
+}
+
+/* File view (all): "show/hide details" link - visited format */
+a.detail:visited
+{
+  color: #B8D0FF;
+  font-size:80%;
+}
+
+/* File view (all): "show/hide details" link - activated format */
+a.detail:active
+{
+  color: #FFFFFF;
+  font-size:80%;
+}
+
+/* File view (detail): test name entry */
+td.testName
+{
+  text-align: right;
+  padding-right: 10px;
+  background-color: #DAE7FE;
+  font-family: sans-serif;
+}
+
+/* File view (detail): test percentage entry */
+td.testPer
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: #DAE7FE;
+  font-family: sans-serif;
+}
+
+/* File view (detail): test lines count entry */
+td.testNum
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: #DAE7FE;
+  font-family: sans-serif;
+}
+
+/* Test case descriptions: test name format*/
+dt
+{
+  font-family: sans-serif;
+  font-weight: bold;
+}
+
+/* Test case descriptions: description table body */
+td.testDescription
+{
+  padding-top: 10px;
+  padding-left: 30px;
+  padding-bottom: 10px;
+  padding-right: 30px;
+  background-color: #DAE7FE;
+}
+
+/* Source code view: function entry */
+td.coverFn
+{
+  text-align: left;
+  padding-left: 10px;
+  padding-right: 20px;
+  color: #284FA8;
+  background-color: #DAE7FE;
+  font-family: monospace;
+}
+
+/* Source code view: function entry zero count*/
+td.coverFnLo
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: rgb(255, 153, 153);
+  font-weight: bold;
+  font-family: sans-serif;
+}
+
+/* Source code view: function entry nonzero count*/
+td.coverFnHi
+{
+  text-align: right;
+  padding-left: 10px;
+  padding-right: 10px;
+  background-color: #DAE7FE;
+  font-weight: bold;
+  font-family: sans-serif;
+}
+
+/* Source code view: source code format */
+pre.source
+{
+  font-family: monospace;
+  white-space: pre;
+  margin-top: 2px;
+}
+
+/* Source code view: line number format */
+span.lineNum
+{
+  background-color: #FBFFDB;
+}
+
+/* Source code view: format for lines which were executed */
+td.lineCov,
+span.lineCov
+{
+  background-color: #CAD7FE;
+}
+
+/* Source code view: format for Cov legend */
+span.coverLegendCov
+{
+  padding-left: 10px;
+  padding-right: 10px;
+  padding-bottom: 2px;
+  background-color: #CAD7FE;
+}
+
+/* Source code view: format for lines which were not executed */
+td.lineNoCov,
+span.lineNoCov
+{
+  background-color: rgb(255, 153, 153);
+}
+
+/* Source code view: format for NoCov legend */
+span.coverLegendNoCov
+{
+  padding-left: 10px;
+  padding-right: 10px;
+  padding-bottom: 2px;
+  background-color: rgb(255, 153, 153);
+}
+
+/* Source code view (function table): standard link - visited format */
+td.lineNoCov > a:visited,
+td.lineCov > a:visited
+{
+  color: black;
+  text-decoration: underline;
+}
+
+/* Source code view: format for lines which were executed only in a
+   previous version */
+span.lineDiffCov
+{
+  background-color: #B5F7AF;
+}
+
+/* Source code view: format for branches which were executed
+ * and taken */
+span.branchCov
+{
+  background-color: #CAD7FE;
+}
+
+/* Source code view: format for branches which were executed
+ * but not taken */
+span.branchNoCov
+{
+  background-color: #FF6230;
+}
+
+/* Source code view: format for branches which were not executed */
+span.branchNoExec
+{
+  background-color: #FF6230;
+}
+
+/* Source code view: format for the source code heading line */
+pre.sourceHeading
+{
+  white-space: pre;
+  font-family: monospace;
+  font-weight: bold;
+  margin: 0px;
+}
+
+/* All views: header legend value for low rate */
+td.headerValueLegL
+{
+  font-family: sans-serif;
+  text-align: center;
+  white-space: nowrap;
+  padding-left: 4px;
+  padding-right: 2px;
+  background-color: rgb(255, 153, 153);
+  font-size: 80%;
+}
+
+/* All views: header legend value for med rate */
+td.headerValueLegM
+{
+  font-family: sans-serif;
+  text-align: center;
+  white-space: nowrap;
+  padding-left: 2px;
+  padding-right: 2px;
+  background-color: #FFEA20;
+  font-size: 80%;
+}
+
+/* All views: header legend value for hi rate */
+td.headerValueLegH
+{
+  font-family: sans-serif;
+  text-align: center;
+  white-space: nowrap;
+  padding-left: 2px;
+  padding-right: 4px;
+  background-color: rgb(174, 239, 175);
+  font-size: 80%;
+}
+
+/* All views except source code view: legend format for low coverage */
+span.coverLegendCovLo
+{
+  padding-left: 10px;
+  padding-right: 10px;
+  padding-top: 2px;
+  background-color: rgb(255, 153, 153);
+}
+
+/* All views except source code view: legend format for med coverage */
+span.coverLegendCovMed
+{
+  padding-left: 10px;
+  padding-right: 10px;
+  padding-top: 2px;
+  background-color: #FFEA20;
+}
+
+/* All views except source code view: legend format for hi coverage */
+span.coverLegendCovHi
+{
+  padding-left: 10px;
+  padding-right: 10px;
+  padding-top: 2px;
+  background-color: rgb(174, 239, 175);
+}
diff --git a/lcov/ruby.png b/lcov/ruby.png
new file mode 100644
index 0000000..96d2257
--- /dev/null
+++ b/lcov/ruby.png
Binary files differ