[ARVADOS-DEV] created: fe19ce4b94f7ae3277e9016bc7886179f46ec472

git at public.curoverse.com git at public.curoverse.com
Thu Aug 27 15:47:54 EDT 2015


        at  fe19ce4b94f7ae3277e9016bc7886179f46ec472 (commit)


commit fe19ce4b94f7ae3277e9016bc7886179f46ec472
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Aug 27 15:47:45 2015 -0400

    6263: Generate Go coverage reports in $WORKSPACE/tmp/coverage-*

diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh
index cdff551..281b721 100755
--- a/jenkins/run-tests.sh
+++ b/jenkins/run-tests.sh
@@ -458,22 +458,28 @@ do_test() {
 }
 
 do_test_once() {
+    unset result
     if [[ -z "${skip[$1]}" ]] && ( [[ -z "$only" ]] || [[ "$only" == "$1" ]] )
     then
         title "Running $1 tests"
         timer_reset
         if [[ "$2" == "go" ]]
         then
+            covername="coverage-$(echo "$1" | sed -e 's/\//_/g')"
+            coverflags=("-covermode=count" "-coverprofile=$WORKSPACE/tmp/.$covername.tmp")
             if [[ -n "${testargs[$1]}" ]]
             then
                 # "go test -check.vv giturl" doesn't work, but this
                 # does:
-                cd "$WORKSPACE/$1" && go test ${testargs[$1]}
+                cd "$WORKSPACE/$1" && go test ${coverflags[@]} ${testargs[$1]}
             else
                 # The above form gets verbose even when testargs is
                 # empty, so use this form in such cases:
-                go test "git.curoverse.com/arvados.git/$1"
+                go test ${coverflags[@]} "git.curoverse.com/arvados.git/$1"
             fi
+            result="$?"
+            go tool cover -html="$WORKSPACE/tmp/.$covername.tmp" -o "$WORKSPACE/tmp/$covername.html"
+            rm "$WORKSPACE/tmp/.$covername.tmp"
         elif [[ "$2" == "pip" ]]
         then
             # $3 can name a path directory for us to use, including trailing
@@ -486,7 +492,7 @@ do_test_once() {
         else
             "test_$1"
         fi
-        result="$?"
+        result=${result:-$?}
         checkexit $result "$1 tests"
         title "End of $1 tests (`timer`)"
         return $result

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list