Commit d3ca4c88 authored by Russ Cox's avatar Russ Cox

cmd/go: preserve %SYSTEMROOT% in TestScript on Windows

Windows networking doesn't work without this environment variable (#25210).

Re-enable TestScript on Windows, and fix two minor failures.

Fixes #26457.

Change-Id: Id9bea49dfb58403195c29c3d831a532ef0f9a233
Reviewed-on: https://go-review.googlesource.com/124858
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 2d4c1ff7
......@@ -42,10 +42,6 @@ func TestScript(t *testing.T) {
file := file
name := strings.TrimSuffix(filepath.Base(file), ".txt")
t.Run(name, func(t *testing.T) {
if strings.HasPrefix(name, "mod_") && runtime.GOOS == "windows" {
// Windows is very unhappy about the module proxy.
t.Skip("golang.org/issue/26457")
}
t.Parallel()
ts := &testScript{t: t, name: name, file: file}
ts.setup()
......@@ -76,6 +72,10 @@ type testScript struct {
start time.Time // time phase started
}
var extraEnvKeys = []string{
"SYSTEMROOT", // must be preserved on Windows to find DLLs; golang.org/issue/25210
}
// setup sets up the test execution temporary directory and environment.
func (ts *testScript) setup() {
StartProxy()
......@@ -96,11 +96,18 @@ func (ts *testScript) setup() {
tempEnvName() + "=" + filepath.Join(ts.workdir, "tmp"),
"devnull=" + os.DevNull,
}
if runtime.GOOS == "windows" {
ts.env = append(ts.env, "exe=.exe")
} else {
ts.env = append(ts.env, "exe=")
}
for _, key := range extraEnvKeys {
if val := os.Getenv(key); val != "" {
ts.env = append(ts.env, key+"="+val)
}
}
ts.envMap = make(map[string]string)
for _, kv := range ts.env {
if i := strings.Index(kv, "="); i >= 0 {
......
......@@ -2,10 +2,10 @@ env GO111MODULE=on
! go get rsc.io/badfile1 rsc.io/badfile2 rsc.io/badfile3 rsc.io/badfile4 rsc.io/badfile5
! stderr 'unzip.*badfile1'
stderr 'unzip.*badfile2/@v/v1.0.0.zip:.*malformed file path "☺.go": invalid char ''☺'''
stderr 'unzip.*badfile3/@v/v1.0.0.zip: malformed file path "x\?y.go": invalid char ''\?'''
stderr 'unzip.*badfile4/@v/v1.0.0.zip: case-insensitive file name collision: "x/Y.go" and "x/y.go"'
stderr 'unzip.*badfile5/@v/v1.0.0.zip: case-insensitive file name collision: "x/y" and "x/Y"'
stderr 'unzip.*badfile2[\\/]@v[\\/]v1.0.0.zip:.*malformed file path "☺.go": invalid char ''☺'''
stderr 'unzip.*badfile3[\\/]@v[\\/]v1.0.0.zip: malformed file path "x\?y.go": invalid char ''\?'''
stderr 'unzip.*badfile4[\\/]@v[\\/]v1.0.0.zip: case-insensitive file name collision: "x/Y.go" and "x/y.go"'
stderr 'unzip.*badfile5[\\/]@v[\\/]v1.0.0.zip: case-insensitive file name collision: "x/y" and "x/Y"'
-- go.mod --
module x
......@@ -10,6 +10,7 @@ go list -getmode=local
grep v1.5.1 $GOPATH/src/mod/cache/download/rsc.io/quote/@v/list
# Use download cache as file:/// proxy.
[windows] stop # TODO: file://$WORK puts backslashes in the URL
env GOPATH=$WORK/gopath2
env GOPROXY=file:///nonexist
! go list -getmode=local
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment