diff options
| author | Michael Hendricks <michael@ndrix.org> | 2017-06-21 21:28:41 -0500 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-06-22 04:42:40 +0000 |
| commit | b3301865a025fda72b8d327fad4461bb7bf68600 (patch) | |
| tree | 688735731d5e491809637761404199a7a2fde857 /src | |
| parent | 1d3a0df4bb77af0158d25854c85ad87cc36fe8dc (diff) | |
| download | go-b3301865a025fda72b8d327fad4461bb7bf68600.tar.xz | |
os: run more of TestExecutable on OpenBSD
On OpenBSD, Executable relies on Args[0]. Removing the forgery on
that OS allows the rest of the test to run.
See #19453
Change-Id: Idf99f86894de5c702893791bc3684f8665f4019d
Reviewed-on: https://go-review.googlesource.com/46398
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/os/executable_test.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/os/executable_test.go b/src/os/executable_test.go index a6aeb0723f..7800844e42 100644 --- a/src/os/executable_test.go +++ b/src/os/executable_test.go @@ -29,12 +29,6 @@ func TestExecutable(t *testing.T) { t.Fatalf("filepath.Rel: %v", err) } - if runtime.GOOS == "openbsd" { - // The rest of the test doesn't work on OpenBSD, - // which relies on argv[0]. - t.Skipf("skipping remainder of test on %s", runtime.GOOS) - } - cmd := &osexec.Cmd{} // make child start with a relative program path cmd.Dir = dir @@ -42,6 +36,10 @@ func TestExecutable(t *testing.T) { // forge argv[0] for child, so that we can verify we could correctly // get real path of the executable without influenced by argv[0]. cmd.Args = []string{"-", "-test.run=XXXX"} + if runtime.GOOS == "openbsd" { + // OpenBSD relies on argv[0] + cmd.Args[0] = fn + } cmd.Env = append(os.Environ(), fmt.Sprintf("%s=1", executable_EnvVar)) out, err := cmd.CombinedOutput() if err != nil { |
