lbathina commented on a change in pull request #3768: Codecov
URL: https://github.com/apache/trafficcontrol/pull/3768#discussion_r314379439
 
 

 ##########
 File path: traffic_monitor/tests/gocover.bash
 ##########
 @@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#----------------------------------------
+set -e
+go get "github.com/wadey/gocovmerge"
+echo "" > result.txt
+packages=( "$@" )
+coverage_out=()
+i=1
+for pkg in ${packages[@]} ; do
+    for d in $(go list $pkg | grep -v vendor); do
+        file="$i.out"
+        go test -v -coverprofile=$file $d >> result.txt
+        cat result.txt
+        if [ -f $file ]; then
+            coverage_out+=( $file )
+        fi
+        ((i++))
+    done
+done 
+gocovmerge ${coverage_out[*]} > coverage.out
+go tool cover -func=coverage.out
+cat result.txt | go-junit-report --package-name=golang.test.tm --set-exit-code 
> /junit/golang.test.tm.xml 
+chmod 777 -R /junit && cat /junit/golang.test.tm.xml
 
 Review comment:
   I just moved the command that was already in there. may be this question was 
missed in previous review/approval when that statement made to master

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to