aboutsummaryrefslogtreecommitdiff
path: root/src/internal/cpu
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2022-05-07 09:24:05 -0400
committerThan McIntosh <thanm@google.com>2022-05-09 12:32:48 +0000
commitc4311a47a0cb97f85e045a6d8f7c284cb6866da9 (patch)
tree4637e92c795ce17b2901cc3124fbd90539a1b861 /src/internal/cpu
parent7ca1e2aa56f23b1766e8f5f65c431d18abd58985 (diff)
downloadgo-c4311a47a0cb97f85e045a6d8f7c284cb6866da9.tar.xz
internal/cpu: revise test to make it work properly with -cover
Fix up a test to insure that it does the right thing when "go test -cover" is in effect. Fixes #52761. Change-Id: I0c141181e2dcaefd592fb04813f812f2800511da Reviewed-on: https://go-review.googlesource.com/c/go/+/404715 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/internal/cpu')
-rw-r--r--src/internal/cpu/cpu_test.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/internal/cpu/cpu_test.go b/src/internal/cpu/cpu_test.go
index 8c21256b34..e72d2d639c 100644
--- a/src/internal/cpu/cpu_test.go
+++ b/src/internal/cpu/cpu_test.go
@@ -10,7 +10,6 @@ import (
"internal/testenv"
"os"
"os/exec"
- "strings"
"testing"
)
@@ -35,13 +34,9 @@ func runDebugOptionsTest(t *testing.T, test string, options string) {
cmd.Env = append(cmd.Env, env)
output, err := cmd.CombinedOutput()
- lines := strings.Fields(string(output))
- lastline := lines[len(lines)-1]
-
- got := strings.TrimSpace(lastline)
- want := "PASS"
- if err != nil || got != want {
- t.Fatalf("%s with %s: want %s, got %v", test, env, want, got)
+ if err != nil {
+ t.Fatalf("%s with %s: run failed: %v output:\n%s\n",
+ test, env, err, string(output))
}
}