From dceee2e983f5dab65c3905ecf40e70e15cf41b7d Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 24 Feb 2025 09:43:41 +0100 Subject: all: use testenv.Executable instead of os.Executable and os.Args[0] In test files, using testenv.Executable is more reliable than os.Executable or os.Args[0]. Change-Id: I88e577efeabc20d02ada27bf706ae4523129128e Reviewed-on: https://go-review.googlesource.com/c/go/+/651955 Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor --- src/sync/mutex_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/sync') diff --git a/src/sync/mutex_test.go b/src/sync/mutex_test.go index cca0986a30..c9e5ec22c2 100644 --- a/src/sync/mutex_test.go +++ b/src/sync/mutex_test.go @@ -187,9 +187,8 @@ func init() { } func TestMutexMisuse(t *testing.T) { - testenv.MustHaveExec(t) for _, test := range misuseTests { - out, err := exec.Command(os.Args[0], "TESTMISUSE", test.name).CombinedOutput() + out, err := exec.Command(testenv.Executable(t), "TESTMISUSE", test.name).CombinedOutput() if err == nil || !strings.Contains(string(out), "unlocked") { t.Errorf("%s: did not find failure with message about unlocked lock: %s\n%s\n", test.name, err, out) } -- cgit v1.3