]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/ssa: remove workarounds for #43938
authorBryan C. Mills <bcmills@google.com>
Wed, 22 Sep 2021 15:54:22 +0000 (11:54 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 23 Sep 2021 20:15:19 +0000 (20:15 +0000)
The cmd/go bug this worked around should be fixed as of CL 351329.

Fixes #43938
Fixes #48550

Change-Id: Ida930e7ee33d44d89556b9b8bbc3c26bb53697b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/351529
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/compile/internal/ssa/debug_lines_test.go
src/cmd/compile/internal/ssa/debug_test.go

index c5a0fe449cf2c932ffd13137904a288e2c7bf272..da04e5b04e95b35b7813a1fa86b8331ba931a516 100644 (file)
@@ -29,8 +29,10 @@ var asmLine *regexp.Regexp = regexp.MustCompile(`^\s[vb][0-9]+\s+[0-9]+\s\(\+([0
 
 // this matches e.g.                            `   v123456789   000007   (+9876654310) MOVUPS X15, ""..autotmp_2-32(SP)`
 
-// Matches lines in genssa output that describe an inlined file (on a Unix filesystem).  Note it expects an unadventurous choice of basename.
-var inlineLine *regexp.Regexp = regexp.MustCompile(`^#\s/.*/[-a-zA-Z0-9_]+\.go:([0-9]+)`)
+// Matches lines in genssa output that describe an inlined file.
+// Note it expects an unadventurous choice of basename.
+var sepRE = regexp.QuoteMeta(string(filepath.Separator))
+var inlineLine *regexp.Regexp = regexp.MustCompile(`^#\s.*` + sepRE + `[-a-zA-Z0-9_]+\.go:([0-9]+)`)
 
 // this matches e.g.                                 #  /pa/inline-dumpxxxx.go:6
 
@@ -44,9 +46,6 @@ func testGoArch() string {
 }
 
 func TestDebugLines(t *testing.T) {
-       if runtime.GOOS == "windows" {
-               t.Skip("Windows lacks $HOME which complicates workaround for 'missing $GOPATH'") // $HOME needed to work around #43938
-       }
        // This test is potentially fragile, the goal is that debugging should step properly through "sayhi"
        // If the blocks are reordered in a way that changes the statement order but execution flows correctly,
        // then rearrange the expected numbers.  Register abi and not-register-abi also have different sequences,
@@ -65,9 +64,6 @@ func TestDebugLines(t *testing.T) {
 }
 
 func TestInlineLines(t *testing.T) {
-       if runtime.GOOS == "windows" {
-               t.Skip("Windows lacks $HOME which complicates workaround for 'missing $GOPATH'") // $HOME needed to work around #43938
-       }
        if runtime.GOARCH != "amd64" && *testGoArchFlag == "" {
                // As of september 2021, works for everything except mips64, but still potentially fragile
                t.Skip("only runs for amd64 unless -arch explicitly supplied")
@@ -98,8 +94,7 @@ func compileAndDump(t *testing.T, file, function, moreGCFlags string) []byte {
        cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "foo.o", "-gcflags=-d=ssa/genssa/dump="+function+" "+moreGCFlags, source)
        cmd.Dir = tmpdir
        cmd.Env = replaceEnv(cmd.Env, "GOSSADIR", tmpdir)
-       cmd.Env = replaceEnv(cmd.Env, "HOME", os.Getenv("HOME")) // workaround for #43938
-       testGoos := "linux"                                      // default to linux
+       testGoos := "linux" // default to linux
        if testGoArch() == "wasm" {
                testGoos = "js"
        }
index 33463125424f27b8185ca2c7cd392894cdedf4cf..b20041c1b575a02926aefcf591c5993fe16c349a 100644 (file)
@@ -952,6 +952,9 @@ func (s *ioState) readSimpleExpecting(expectedRE string) tstring {
 // replaceEnv returns a new environment derived from env
 // by removing any existing definition of ev and adding ev=evv.
 func replaceEnv(env []string, ev string, evv string) []string {
+       if env == nil {
+               env = os.Environ()
+       }
        evplus := ev + "="
        var found bool
        for i, v := range env {