Skip to content

Commit b330186

Browse files
mndrixbradfitz
authored andcommitted
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 golang#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>
1 parent 1d3a0df commit b330186

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/os/executable_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,17 @@ func TestExecutable(t *testing.T) {
2929
t.Fatalf("filepath.Rel: %v", err)
3030
}
3131

32-
if runtime.GOOS == "openbsd" {
33-
// The rest of the test doesn't work on OpenBSD,
34-
// which relies on argv[0].
35-
t.Skipf("skipping remainder of test on %s", runtime.GOOS)
36-
}
37-
3832
cmd := &osexec.Cmd{}
3933
// make child start with a relative program path
4034
cmd.Dir = dir
4135
cmd.Path = fn
4236
// forge argv[0] for child, so that we can verify we could correctly
4337
// get real path of the executable without influenced by argv[0].
4438
cmd.Args = []string{"-", "-test.run=XXXX"}
39+
if runtime.GOOS == "openbsd" {
40+
// OpenBSD relies on argv[0]
41+
cmd.Args[0] = fn
42+
}
4543
cmd.Env = append(os.Environ(), fmt.Sprintf("%s=1", executable_EnvVar))
4644
out, err := cmd.CombinedOutput()
4745
if err != nil {

0 commit comments

Comments
 (0)