Skip to content

Commit a75bc4d

Browse files
committed
dont return error when no coverage info exists yet
1 parent 171ab52 commit a75bc4d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ func (c *runCache) tryCacheWithID(b *work.Builder, a *work.Action, id string) bo
18691869
f, _, err := cache.GetFile(cache.Default(), coverProfileAndInputKey(testID, testInputsID))
18701870
if err != nil {
18711871
if cache.DebugTest {
1872-
fmt.Fprintf(os.Stderr, "testcache: %s: test coverage profile not found: %v\n", a.Package.ImportPath, err)
1872+
fmt.Fprintf(os.Stderr, "testcache: %s: cached test result valid but cached coverage profile missing: %v\n", a.Package.ImportPath, err)
18731873
}
18741874
return false
18751875
}
@@ -2062,8 +2062,8 @@ func (c *runCache) saveOutput(a *work.Action, coverProfileFile string) {
20622062
}
20632063
}()
20642064
} else if cache.DebugTest {
2065-
base.Errorf("failed to open temporary coverprofile: %s", err)
2066-
return
2065+
// Not indicative of a problem, as the test may not have generated a cover profile yet.
2066+
fmt.Fprintf(os.Stderr, "testcache: %s: opening temporary coverprofile: %s\n", a.Package.ImportPath, err)
20672067
}
20682068
}
20692069
if c.id1 != (cache.ActionID{}) {

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

+1-1
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)