runtime: Remove HTML coverage option from go-test.sh

The html-coverage option to this script doesn't really alter behaviour
it just does the same thing as normal coverage, then converts the
report to HTML.  That conversion is a single command, plus a chmod to
make the final output mode 0644.  That overrides any umask the user
has set, which doesn't seem like a policy decision this script should
be making.

Nothing in the kata-containers or tests repository uses this, so it doesn't
really make sense to keep this logic inside this script.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2022-03-30 15:06:21 +11:00
parent 7f76914422
commit 04c8b52e04

View File

@ -47,9 +47,6 @@ tmp_coverage_file="${test_coverage_file}.tmp"
# Permissions to create coverage files with # Permissions to create coverage files with
coverage_file_mode=0644 coverage_file_mode=0644
# Name of HTML format coverage file
html_report_file="coverage.html"
warn() warn()
{ {
local msg="$*" local msg="$*"
@ -92,7 +89,6 @@ EOF
Commands: Commands:
help # Show usage. help # Show usage.
html-coverage # Run tests and create HTML coverage report.
EOF EOF
} }
@ -122,16 +118,6 @@ run_as_user()
fi fi
} }
# Run the tests and generate an HTML report of the results
test_html_coverage()
{
test_coverage
go tool cover -html="${test_coverage_file}" -o "${html_report_file}"
run_as_user "current" chmod "${coverage_file_mode}" "${html_report_file}"
}
# Test a single golang package # Test a single golang package
test_go_package() test_go_package()
{ {
@ -246,9 +232,7 @@ main()
# KATA_GO_TEST_FLAGS can be set to change the flags passed to "go test". # KATA_GO_TEST_FLAGS can be set to change the flags passed to "go test".
go_test_flags=${KATA_GO_TEST_FLAGS:-"-v $race -timeout $timeout_value -ldflags '$go_ldflags'"} go_test_flags=${KATA_GO_TEST_FLAGS:-"-v $race -timeout $timeout_value -ldflags '$go_ldflags'"}
if [ "$1" = "html-coverage" ]; then if [ "$run_coverage" = yes ]; then
test_html_coverage
elif [ "$run_coverage" = yes ]; then
test_coverage test_coverage
else else
test_local test_local