Commit 2ceeb7b0 authored by Remi Gillig's avatar Remi Gillig Committed by Brad Fitzpatrick

path/filepath: fix TestWinSplitListTestsAreValid on some systems

The environment variables used in those tests override the default
OS ones. However, one of them (SystemRoot) seems to be required on
some Windows systems for invoking cmd.exe properly.

This fixes #4930 and #6568.

Change-Id: I23dfb67c1de86020711a3b59513f6adcbba12561
Reviewed-on: https://go-review.googlesource.com/36873Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 60d7d247
......@@ -67,6 +67,9 @@ func testWinSplitListTestIsValid(t *testing.T, ti int, tt SplitListTest,
}
}
// on some systems, SystemRoot is required for cmd to work
systemRoot := os.Getenv("SystemRoot")
for i, d := range tt.result {
if d == "" {
continue
......@@ -75,7 +78,7 @@ func testWinSplitListTestIsValid(t *testing.T, ti int, tt SplitListTest,
cmd := &exec.Cmd{
Path: comspec,
Args: []string{`/c`, cmdfile},
Env: []string{`Path=` + tt.list},
Env: []string{`Path=` + tt.list, `SystemRoot=` + systemRoot},
Dir: tmp,
}
out, err := cmd.CombinedOutput()
......
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