1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:11:25 -07:00

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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2018-12-07 15:16:54 -08:00
parent ea6259d5e9
commit 353795c839
3 changed files with 23 additions and 2 deletions

View File

@ -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<T> 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)

View File

@ -14,6 +14,7 @@ import (
)
func TestUndefinedRelocErrors(t *testing.T) {
t.Parallel()
testenv.MustHaveGoBuild(t)
dir, err := ioutil.TempDir("", "go-build")
if err != nil {

View File

@ -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")