Docker-DCO-1.1-Signed-off-by: Daniel Mizyrycki <daniel@docker.com> (github: mzdaniel)
| 1 | 1 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,52 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+ |
|
| 2 |
+export PATH='/go/bin':$PATH |
|
| 3 |
+export DOCKER_PATH='/go/src/github.com/dotcloud/docker' |
|
| 4 |
+ |
|
| 5 |
+# Signal coverage report name, parsed by docker-ci |
|
| 6 |
+set -x |
|
| 7 |
+COVERAGE_PATH=$(date +"docker-%Y%m%d%H%M%S") |
|
| 8 |
+set +x |
|
| 9 |
+ |
|
| 10 |
+REPORTS="/data/$COVERAGE_PATH" |
|
| 11 |
+INDEX="$REPORTS/index.html" |
|
| 12 |
+ |
|
| 13 |
+# Test docker |
|
| 14 |
+cd $DOCKER_PATH |
|
| 15 |
+./hack/make.sh test; exit_status=$? |
|
| 16 |
+PROFILE_PATH="$(ls -d $DOCKER_PATH/bundles/* | sed -n '$ p')/test/coverprofiles" |
|
| 17 |
+ |
|
| 18 |
+if [ "$exit_status" -eq "0" ]; then |
|
| 19 |
+ # Download coverage dependencies |
|
| 20 |
+ go get github.com/axw/gocov/gocov |
|
| 21 |
+ go get -u github.com/matm/gocov-html |
|
| 22 |
+ |
|
| 23 |
+ # Create coverage report |
|
| 24 |
+ mkdir -p $REPORTS |
|
| 25 |
+ cd $PROFILE_PATH |
|
| 26 |
+ cat > $INDEX << "EOF" |
|
| 27 |
+<!DOCTYPE html><head><meta charset="utf-8"> |
|
| 28 |
+<script type="text/javascript" src="//tablesorter.com/jquery-latest.js"></script> |
|
| 29 |
+<script type="text/javascript" src="//tablesorter.com/__jquery.tablesorter.min.js"></script> |
|
| 30 |
+<script type="text/javascript">$(document).ready(function() {
|
|
| 31 |
+$("table").tablesorter({ sortForce: [[1,0]] }); });</script>
|
|
| 32 |
+<style>table,th,td{border:1px solid black;}</style>
|
|
| 33 |
+<title>Docker Coverage Report</title> |
|
| 34 |
+</head><body> |
|
| 35 |
+<h1><strong>Docker Coverage Report</strong></h1> |
|
| 36 |
+<table class="tablesorter"> |
|
| 37 |
+<thead><tr><th>package</th><th>pct</th></tr></thead><tbody> |
|
| 38 |
+EOF |
|
| 39 |
+ for profile in *; do |
|
| 40 |
+ gocov convert $profile | gocov-html >$REPORTS/$profile.html |
|
| 41 |
+ echo "<tr><td><a href=\"${profile}.html\">$profile</a></td><td>" >> $INDEX
|
|
| 42 |
+ go tool cover -func=$profile | sed -En '$ s/.+\t(.+)/\1/p' >> $INDEX |
|
| 43 |
+ echo "</td></tr>" >> $INDEX |
|
| 44 |
+ done |
|
| 45 |
+ echo "</tbody></table></body></html>" >> $INDEX |
|
| 46 |
+fi |
|
| 47 |
+ |
|
| 48 |
+# Signal test and coverage result, parsed by docker-ci |
|
| 49 |
+set -x |
|
| 50 |
+exit $exit_status |
|
| 51 |
+ |