1
0
mirror of https://github.com/golang/go synced 2024-11-21 11:34:44 -07:00

dont return error when no coverage info exists yet

This commit is contained in:
Ryan Currah 2024-09-16 08:18:13 -04:00
parent 171ab52698
commit a75bc4d35c
No known key found for this signature in database
GPG Key ID: A8F5EF04CC2222B3
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -128,7 +128,7 @@ go test testcache -run=TestOSArgs -fullpath
go test testcache -run=TestOSArgs -fullpath
stdout '\(cached\)'
# Ensure that specifying a cover profile does not prevent test results from being cached.
# Ensure that coverage profiles are being cached.
go test testcache -run=TestCoverageCache -coverprofile=coverage.out
go test testcache -run=TestCoverageCache -coverprofile=coverage.out
stdout '\(cached\)'