]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test: skip some tests on noopt builder
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 24 Sep 2018 16:48:54 +0000 (16:48 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 24 Sep 2018 20:56:48 +0000 (20:56 +0000)
Adds a new build tag "gcflags_noopt" that can be used in test/*.go
tests.

Fixes #27833

Change-Id: I4ea0ccd9e9e58c4639de18645fec81eb24a3a929
Reviewed-on: https://go-review.googlesource.com/136898
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
test/checkbce.go
test/fixedbugs/issue7921.go
test/nosplit.go
test/run.go

index 770c4c2a94e71db254feb0248ede73c14413ae02..ef4e584ca0923a8e0aa8f7c3e8fc791e5493ded1 100644 (file)
@@ -1,4 +1,4 @@
-// +build amd64
+// +build amd64,!gcflags_noopt
 // errorcheck -0 -d=ssa/check_bce/debug=3
 
 // Copyright 2016 The Go Authors. All rights reserved.
index e30e556353b2e7716ebbb565650ba74626c038d7..ac2b494ebc684e0b92904ae980feb8897ff59d92 100644 (file)
@@ -1,3 +1,4 @@
+// +build !gcflags_noopt
 // errorcheck -0 -m
 
 // Copyright 2018 The Go Authors. All rights reserved.
index b821d23859d538745d06084bb346083593fce742..1855c010ae3a18b8e2085ba71766a6ca3ed0dd52 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!gcflags_noopt
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
index 24a4d4f425fe171c304e8933e041e9de60cafcbb..d0dccb4f23d1907cb05fbd994dffb52bf9825141 100644 (file)
@@ -354,8 +354,9 @@ func goDirPackages(longdir string, singlefilepkgs bool) ([][]string, error) {
 }
 
 type context struct {
-       GOOS   string
-       GOARCH string
+       GOOS     string
+       GOARCH   string
+       noOptEnv bool
 }
 
 // shouldTest looks for build tags in a source file and returns
@@ -375,10 +376,13 @@ func shouldTest(src string, goos, goarch string) (ok bool, whyNot string) {
                if len(line) == 0 || line[0] != '+' {
                        continue
                }
+               gcFlags := os.Getenv("GO_GCFLAGS")
                ctxt := &context{
-                       GOOS:   goos,
-                       GOARCH: goarch,
+                       GOOS:     goos,
+                       GOARCH:   goarch,
+                       noOptEnv: strings.Contains(gcFlags, "-N") || strings.Contains(gcFlags, "-l"),
                }
+
                words := strings.Fields(line)
                if words[0] == "+build" {
                        ok := false
@@ -425,6 +429,10 @@ func (ctxt *context) match(name string) bool {
                return true
        }
 
+       if ctxt.noOptEnv && name == "gcflags_noopt" {
+               return true
+       }
+
        if name == "test_run" {
                return true
        }