Skip to content

Commit 6de06a9

Browse files
committed
dont return error when no coverage info exists yet
1 parent 42144ed commit 6de06a9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cmd/go/internal/test/test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ func (c *runCache) tryCacheWithID(b *work.Builder, a *work.Action, id string) bo
18961896
f, _, err := cache.GetFile(cache.Default(), coverProfileAndInputKey(testID, testInputsID))
18971897
if err != nil {
18981898
if cache.DebugTest {
1899-
fmt.Fprintf(os.Stderr, "testcache: %s: test coverage profile not found: %v\n", a.Package.ImportPath, err)
1899+
fmt.Fprintf(os.Stderr, "testcache: %s: cached test result valid but cached coverage profile missing: %v\n", a.Package.ImportPath, err)
19001900
}
19011901
return false
19021902
}
@@ -2089,8 +2089,8 @@ func (c *runCache) saveOutput(a *work.Action, coverProfileFile string) {
20892089
}
20902090
}()
20912091
} else if cache.DebugTest {
2092-
base.Errorf("failed to open temporary coverprofile: %s", err)
2093-
return
2092+
// Not indicative of a problem, as the test may not have generated a cover profile yet.
2093+
fmt.Fprintf(os.Stderr, "testcache: %s: opening temporary coverprofile: %s\n", a.Package.ImportPath, err)
20942094
}
20952095
}
20962096
if c.id1 != (cache.ActionID{}) {

src/cmd/go/testdata/script/test_cache_inputs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ go test testcache -run=TestOSArgs -fullpath
128128
go test testcache -run=TestOSArgs -fullpath
129129
stdout '\(cached\)'
130130

131-
# Ensure that specifying a cover profile does not prevent test results from being cached.
131+
# Ensure that coverage profiles are being cached.
132132
go test testcache -run=TestCoverageCache -coverprofile=coverage.out
133133
go test testcache -run=TestCoverageCache -coverprofile=coverage.out
134134
stdout '\(cached\)'

0 commit comments

Comments
 (0)