cmd/testwrapper: detect cached tests with coverage output (#18559)

Using -coverprofile was breaking the (cached) detection logic because
that adds extra information to the end of the line.

Updates tailscale/go#150

Change-Id: Ie1bf4e1e04e21db00a6829695098fb61d80a2641

Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
This commit is contained in:
Tom Proctor
2026-01-29 16:09:19 +00:00
committed by GitHub
parent afc90ce804
commit ce5c08e4cb
2 changed files with 62 additions and 1 deletions
+4 -1
View File
@@ -130,7 +130,10 @@ func runTests(ctx context.Context, attempt int, pt *packageTests, goTestArgs, te
resultMap[pkg] = pkgTests
}
if goOutput.Test == "" {
if strings.HasSuffix(goOutput.Output, "\t(cached)\n") && goOutput.Package != "" {
// Detect output lines like:
// ok \ttailscale.com/cmd/testwrapper\t(cached)
// ok \ttailscale.com/cmd/testwrapper\t(cached)\tcoverage: 17.0% of statements
if goOutput.Package != "" && strings.Contains(goOutput.Output, fmt.Sprintf("%s\t(cached)", goOutput.Package)) {
pkgCached[goOutput.Package] = true
}
switch goOutput.Action {