|
8 | 8 | "context"
|
9 | 9 | "fmt"
|
10 | 10 | "internal/testenv"
|
11 |
| - "io/ioutil" |
12 | 11 | "net"
|
13 | 12 | "os"
|
14 | 13 | "os/exec"
|
@@ -86,21 +85,10 @@ func sendCtrlBreak(pid int) error {
|
86 | 85 | // TestCtrlHandler tests that Go can gracefully handle closing the console window.
|
87 | 86 | // See https://golang.org/issues/41884.
|
88 | 87 | func TestCtrlHandler(t *testing.T) {
|
89 |
| - if *flagQuick { |
90 |
| - t.Skip("-quick") |
91 |
| - } |
92 | 88 | testenv.MustHaveGoBuild(t)
|
93 |
| - testenv.MustHaveExecPath(t, "gcc") |
94 |
| - testprog.Lock() |
95 |
| - defer testprog.Unlock() |
96 |
| - dir, err := ioutil.TempDir("", "go-build") |
97 |
| - if err != nil { |
98 |
| - t.Fatalf("failed to create temp directory: %v", err) |
99 |
| - } |
100 |
| - defer os.RemoveAll(dir) |
101 | 89 |
|
102 | 90 | // build go program
|
103 |
| - exe := filepath.Join(dir, "test.exe") |
| 91 | + exe := filepath.Join(t.TempDir(), "test.exe") |
104 | 92 | cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", exe, "testdata/testwinsignal/main.go")
|
105 | 93 | out, err := testenv.CleanCmdEnv(cmd).CombinedOutput()
|
106 | 94 | if err != nil {
|
@@ -142,9 +130,8 @@ func TestCtrlHandler(t *testing.T) {
|
142 | 130 | if err != nil {
|
143 | 131 | t.Fatalf("ReadFrom failed: %v", err)
|
144 | 132 | }
|
145 |
| - expected := syscall.SIGTERM.String() |
146 |
| - if string(data[:n]) != expected { |
147 |
| - t.Fatalf("Expected '%s' got: %s", expected, data[:n]) |
| 133 | + if expected, got := syscall.SIGTERM.String(), string(data[:n]); expected != got { |
| 134 | + t.Fatalf("Expected '%s' got: %s", expected, got) |
148 | 135 | }
|
149 | 136 |
|
150 | 137 | if err := cmd.Wait(); err != nil {
|
|
0 commit comments