From 04c8b52e04209cfd0d3bbe653d4bfdfb59c841ef Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 30 Mar 2022 15:06:21 +1100 Subject: [PATCH] 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 --- src/runtime/go-test.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/runtime/go-test.sh b/src/runtime/go-test.sh index 949c4f2752..a57255b179 100755 --- a/src/runtime/go-test.sh +++ b/src/runtime/go-test.sh @@ -47,9 +47,6 @@ tmp_coverage_file="${test_coverage_file}.tmp" # Permissions to create coverage files with coverage_file_mode=0644 -# Name of HTML format coverage file -html_report_file="coverage.html" - warn() { local msg="$*" @@ -92,7 +89,6 @@ EOF Commands: help # Show usage. - html-coverage # Run tests and create HTML coverage report. EOF } @@ -122,16 +118,6 @@ run_as_user() 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_go_package() { @@ -246,9 +232,7 @@ main() # 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'"} - if [ "$1" = "html-coverage" ]; then - test_html_coverage - elif [ "$run_coverage" = yes ]; then + if [ "$run_coverage" = yes ]; then test_coverage else test_local