mirror of
https://github.com/golang/go
synced 2024-11-18 12:44:49 -07:00
go.tools/cmd/godoc: wait for godoc to exit before removing tmp directory
otherwise tmp directories do not get deleted on windows LGTM=adg R=golang-codereviews, adg CC=golang-codereviews https://golang.org/cl/166750043
This commit is contained in:
parent
30f7e63100
commit
4bb917e48d
@ -140,6 +140,11 @@ func waitForServer(t *testing.T, address string) {
|
||||
t.Fatalf("Server %q failed to respond in 5 seconds", address)
|
||||
}
|
||||
|
||||
func killAndWait(cmd *exec.Cmd) {
|
||||
cmd.Process.Kill()
|
||||
cmd.Wait()
|
||||
}
|
||||
|
||||
// Basic integration test for godoc HTTP interface.
|
||||
func TestWeb(t *testing.T) {
|
||||
bin, cleanup := buildGodoc(t)
|
||||
@ -152,7 +157,7 @@ func TestWeb(t *testing.T) {
|
||||
if err := cmd.Start(); err != nil {
|
||||
t.Fatalf("failed to start godoc: %s", err)
|
||||
}
|
||||
defer cmd.Process.Kill()
|
||||
defer killAndWait(cmd)
|
||||
waitForServer(t, addr)
|
||||
tests := []struct {
|
||||
path string
|
||||
@ -282,7 +287,7 @@ func main() { print(lib.V) }
|
||||
if err := cmd.Start(); err != nil {
|
||||
t.Fatalf("failed to start godoc: %s", err)
|
||||
}
|
||||
defer cmd.Process.Kill()
|
||||
defer killAndWait(cmd)
|
||||
waitForServer(t, addr)
|
||||
|
||||
// Wait for type analysis to complete.
|
||||
|
Loading…
Reference in New Issue
Block a user