From: Ian Lance Taylor Date: Fri, 7 Dec 2018 23:16:54 +0000 (-0800) Subject: cmd/link/internal/ld: run tests in parallel X-Git-Tag: go1.12beta1~129 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=353795c83975d457f34c599bed20328a9b8f1cc8;p=gostls13.git cmd/link/internal/ld: run tests in parallel Also skip TestNooptCgoBuild in short mode. Also fix a couple of obscure constants to use values named in cmd/internal/dwarf. This brings the time of the cmd/link/internal/ld tests down to about 1 second on my laptop. Updates #26470 Change-Id: I71c896f30fd314a81d9090f1b6d02edc4174a808 Reviewed-on: https://go-review.googlesource.com/c/153259 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/link/internal/ld/dwarf_test.go b/src/cmd/link/internal/ld/dwarf_test.go index 42b598efef..4768a11c25 100644 --- a/src/cmd/link/internal/ld/dwarf_test.go +++ b/src/cmd/link/internal/ld/dwarf_test.go @@ -5,6 +5,7 @@ package ld import ( + intdwarf "cmd/internal/dwarf" objfilepkg "cmd/internal/objfile" // renamed to avoid conflict with objfile function "debug/dwarf" "errors" @@ -29,6 +30,7 @@ const ( ) func TestRuntimeTypesPresent(t *testing.T) { + t.Parallel() testenv.MustHaveGoBuild(t) if runtime.GOOS == "plan9" { @@ -145,6 +147,7 @@ func gobuildTestdata(t *testing.T, tdir string, gopathdir string, packtobuild st } func TestEmbeddedStructMarker(t *testing.T) { + t.Parallel() testenv.MustHaveGoBuild(t) if runtime.GOOS == "plan9" { @@ -224,7 +227,7 @@ func main() { func findMembers(rdr *dwarf.Reader) (map[string]bool, error) { memberEmbedded := map[string]bool{} // TODO(hyangah): define in debug/dwarf package - const goEmbeddedStruct = dwarf.Attr(0x2903) + const goEmbeddedStruct = dwarf.Attr(intdwarf.DW_AT_go_embedded_field) for entry, err := rdr.Next(); entry != nil; entry, err = rdr.Next() { if err != nil { return nil, err @@ -245,6 +248,7 @@ func TestSizes(t *testing.T) { if runtime.GOOS == "plan9" { t.Skip("skipping on plan9; no DWARF symbol table in executables") } + t.Parallel() // DWARF sizes should never be -1. // See issue #21097 @@ -292,6 +296,7 @@ func TestFieldOverlap(t *testing.T) { if runtime.GOOS == "plan9" { t.Skip("skipping on plan9; no DWARF symbol table in executables") } + t.Parallel() // This test grew out of issue 21094, where specific sudog DWARF types // had elem fields set to values instead of pointers. @@ -348,6 +353,7 @@ func main() { } func varDeclCoordsAndSubrogramDeclFile(t *testing.T, testpoint string, expectFile int, expectLine int, directive string) { + t.Parallel() prog := fmt.Sprintf("package main\n\nfunc main() {\n%s\nvar i int\ni = i\n}\n", directive) @@ -584,6 +590,8 @@ func TestInlinedRoutineRecords(t *testing.T) { t.Skip("skipping on solaris and darwin, pending resolution of issue #23168") } + t.Parallel() + const prog = ` package main @@ -720,6 +728,7 @@ func main() { } func abstractOriginSanity(t *testing.T, gopathdir string, flags string) { + t.Parallel() dir, err := ioutil.TempDir("", "TestAbstractOriginSanity") if err != nil { @@ -881,6 +890,8 @@ func TestRuntimeTypeAttrExternal(t *testing.T) { } func testRuntimeTypeAttr(t *testing.T, flags string) { + t.Parallel() + const prog = ` package main @@ -939,7 +950,7 @@ func main() { if len(dies) != 1 { t.Fatalf("wanted 1 DIE named *main.X, found %v", len(dies)) } - rtAttr := dies[0].Val(0x2904) + rtAttr := dies[0].Val(intdwarf.DW_AT_go_runtime_type) if rtAttr == nil { t.Fatalf("*main.X DIE had no runtime type attr. DIE: %v", dies[0]) } @@ -959,6 +970,8 @@ func TestIssue27614(t *testing.T) { t.Skip("skipping on plan9; no DWARF symbol table in executables") } + t.Parallel() + dir, err := ioutil.TempDir("", "go-build") if err != nil { t.Fatal(err) @@ -1075,6 +1088,8 @@ func TestStaticTmp(t *testing.T) { t.Skip("skipping on plan9; no DWARF symbol table in executables") } + t.Parallel() + dir, err := ioutil.TempDir("", "go-build") if err != nil { t.Fatal(err) diff --git a/src/cmd/link/internal/ld/ld_test.go b/src/cmd/link/internal/ld/ld_test.go index 4884a07d05..0816429316 100644 --- a/src/cmd/link/internal/ld/ld_test.go +++ b/src/cmd/link/internal/ld/ld_test.go @@ -14,6 +14,7 @@ import ( ) func TestUndefinedRelocErrors(t *testing.T) { + t.Parallel() testenv.MustHaveGoBuild(t) dir, err := ioutil.TempDir("", "go-build") if err != nil { diff --git a/src/cmd/link/internal/ld/nooptcgolink_test.go b/src/cmd/link/internal/ld/nooptcgolink_test.go index e019a39bf7..4d2ff1acf2 100644 --- a/src/cmd/link/internal/ld/nooptcgolink_test.go +++ b/src/cmd/link/internal/ld/nooptcgolink_test.go @@ -15,6 +15,11 @@ import ( ) func TestNooptCgoBuild(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } + t.Parallel() + testenv.MustHaveGoBuild(t) testenv.MustHaveCGO(t) dir, err := ioutil.TempDir("", "go-build")