mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 08:37:31 -04:00
unix: use os.Executable rather than os.Args[0] in tests
Change-Id: I67a063d747c6e34dcd0292fdb3a9a0d965a6e133 Reviewed-on: https://go-review.googlesource.com/c/sys/+/607875 Commit-Queue: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
committed by
Gopher Robot
parent
a8c5219b5e
commit
29e55b2fd3
+5
-1
@@ -35,10 +35,14 @@ func TestDarwinLoader(t *testing.T) {
|
||||
//
|
||||
// In an ideal world each syscall would have its own test, so this test
|
||||
// would be unnecessary. Unfortunately, we do not live in that world.
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, test := range darwinTests {
|
||||
// Call the test binary recursively, giving it a magic argument
|
||||
// (see init below) and the name of the test to run.
|
||||
cmd := exec.Command(os.Args[0], "testDarwinLoader", test.name)
|
||||
cmd := exec.Command(exe, "testDarwinLoader", test.name)
|
||||
|
||||
// Run subprocess, collect results. Note that we expect the subprocess
|
||||
// to fail somehow, so the error is irrelevant.
|
||||
|
||||
Reference in New Issue
Block a user