aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2018-07-19 09:31:55 -0400
committerRuss Cox <rsc@golang.org>2018-07-19 18:15:12 +0000
commitd3ca4c881089191c4718f4ca827f109ff0e14fe0 (patch)
treeb1501859e6b6550c580cc38ab553144a42df9692
parent2d4c1ff73992fa817213c7866be8030d9c78b5ba (diff)
downloadgo-d3ca4c881089191c4718f4ca827f109ff0e14fe0.tar.gz
go-d3ca4c881089191c4718f4ca827f109ff0e14fe0.zip
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: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--src/cmd/go/script_test.go15
-rw-r--r--src/cmd/go/testdata/script/mod_bad_filenames.txt8
-rw-r--r--src/cmd/go/testdata/script/mod_file_proxy.txt1
3 files changed, 16 insertions, 8 deletions
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index db34252cc1..a525e27ada 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -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 {
diff --git a/src/cmd/go/testdata/script/mod_bad_filenames.txt b/src/cmd/go/testdata/script/mod_bad_filenames.txt
index b59e737c52..6e0c8bd302 100644
--- a/src/cmd/go/testdata/script/mod_bad_filenames.txt
+++ b/src/cmd/go/testdata/script/mod_bad_filenames.txt
@@ -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
diff --git a/src/cmd/go/testdata/script/mod_file_proxy.txt b/src/cmd/go/testdata/script/mod_file_proxy.txt
index c82b9cf031..144d06a2e0 100644
--- a/src/cmd/go/testdata/script/mod_file_proxy.txt
+++ b/src/cmd/go/testdata/script/mod_file_proxy.txt
@@ -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