]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/ld: run tests in parallel
authorIan Lance Taylor <iant@golang.org>
Fri, 7 Dec 2018 23:16:54 +0000 (15:16 -0800)
committerIan Lance Taylor <iant@golang.org>
Sat, 8 Dec 2018 00:27:08 +0000 (00:27 +0000)
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>
src/cmd/link/internal/ld/dwarf_test.go
src/cmd/link/internal/ld/ld_test.go
src/cmd/link/internal/ld/nooptcgolink_test.go

index 42b598efefa14d2bb40dc324bcfb65e14040216d..4768a11c259c7ad5c07d8ab67912d16be603cf0d 100644 (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)
index 4884a07d05a931b1a903644da5d09d3b9accf7b7..081642931652bafe9a34750acfd8677cd2108445 100644 (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 {
index e019a39bf7348c796d8a4c03b14e96918e9231d3..4d2ff1acf223f51fab9326124833d91591bbcc40 100644 (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")