Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0fb4b920
Commit
0fb4b920
authored
Aug 31, 2018
by
Katharine Berry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments.
parent
9d499cd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
golang.sh
hack/lib/golang.sh
+2
-2
coverage.go
pkg/util/coverage/coverage.go
+2
-4
No files found.
hack/lib/golang.sh
View file @
0fb4b920
...
...
@@ -453,7 +453,7 @@ kube::golang::outfile_for_binary() {
# Argument: the name of a Kubernetes package.
# Returns 0 if the binary can be built with coverage, 1 otherwise.
# NB: this ignores whether coverage is globally enabled or not.
kube::golang::is_
covered_binary
()
{
kube::golang::is_
instrumented_package
()
{
return
$(
kube::util::array_contains
"
$1
"
"
${
KUBE_COVERAGE_INSTRUMENTED_PACKAGES
[@]
}
"
)
}
...
...
@@ -514,7 +514,7 @@ kube::golang::build_some_binaries() {
if
[[
-n
"
${
build_with_coverage
:-}
"
]]
;
then
local
-a
uncovered
=()
for
package
in
"
$@
"
;
do
if
kube::golang::is_
covered_binary
"
${
package
}
"
;
then
if
kube::golang::is_
instrumented_package
"
${
package
}
"
;
then
V
=
2 kube::log::info
"Building
${
package
}
with coverage..."
kube::golang::create_coverage_dummy_test
"
${
package
}
"
...
...
pkg/util/coverage/coverage.go
View file @
0fb4b920
...
...
@@ -49,8 +49,8 @@ func InitCoverage(name string) {
coverageFile
=
"/tmp/k8s-"
+
name
+
".cov"
}
// Set up the unit test framework with the
arguments we want
.
flag
.
CommandLine
.
Parse
([]
string
{
"-test.coverprofile
="
+
tempCoveragePath
()})
// Set up the unit test framework with the
required arguments to activate test coverage
.
flag
.
CommandLine
.
Parse
([]
string
{
"-test.coverprofile
"
,
tempCoveragePath
()})
// Begin periodic logging
go
wait
.
Forever
(
FlushCoverage
,
flushInterval
)
...
...
@@ -76,8 +76,6 @@ func FlushCoverage() {
// This gets us atomic updates from the perspective of another process trying to access
// the file.
if
err
:=
os
.
Rename
(
tempCoveragePath
(),
coverageFile
);
err
!=
nil
{
// This should never fail, because we're in the same directory. There's also little that
// we can do if it does.
glog
.
Errorf
(
"Couldn't move coverage file from %s to %s"
,
coverageFile
,
tempCoveragePath
())
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment