代码拉取完成,页面将自动刷新
#!/bin/bash
DIR="github.com/cloudberrydb/gpbackup"
RESULTS="/tmp/results.out"
go test -coverpkg $DIR/backup $DIR/integration -coverprofile=/tmp/coverage.out 2> /dev/null | awk '{print $2 " test " $4 "\t" $5}' | awk -F"/" '{print $4}' > $RESULTS
for PACKAGE in "backup" "restore" "utils"; do
# Generate code coverage statistics for all packages, write the coverage statistics to a file, and print the coverage percentage to the shell
go test -coverpkg "$DIR/$PACKAGE" "$DIR/$PACKAGE" -coverprofile="/tmp/unit_$PACKAGE.out" | awk '{print $2 " unit test " $4 "\t" $5}' | awk -F"/" '{print $4}' >> $RESULTS
# Filter out the first "mode: set" line from each coverage file and concatenate them all
cat "/tmp/unit_$PACKAGE.out" | awk '{if($1!="mode:") {print $1 " " $2 " " $3}}' >> /tmp/coverage.out
done
# Print the total coverage percentage and generate a coverage HTML page
go tool cover -func=/tmp/coverage.out | awk '{if($1=="total:") {print $1 "\t\t\t\t" $3}}' >> $RESULTS
cat $RESULTS
rm $RESULTS
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。