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/runtime/malloc_test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/runtime/malloc_test.go') diff --git a/src/runtime/malloc_test.go b/src/runtime/malloc_test.go index 67bceef2e3..6cd525d5e9 100644 --- a/src/runtime/malloc_test.go +++ b/src/runtime/malloc_test.go @@ -270,12 +270,10 @@ type acLink struct { var arenaCollisionSink []*acLink func TestArenaCollision(t *testing.T) { - testenv.MustHaveExec(t) - // Test that mheap.sysAlloc handles collisions with other // memory mappings. if os.Getenv("TEST_ARENA_COLLISION") != "1" { - cmd := testenv.CleanCmdEnv(exec.Command(os.Args[0], "-test.run=^TestArenaCollision$", "-test.v")) + cmd := testenv.CleanCmdEnv(exec.Command(testenv.Executable(t), "-test.run=^TestArenaCollision$", "-test.v")) cmd.Env = append(cmd.Env, "TEST_ARENA_COLLISION=1") out, err := cmd.CombinedOutput() if race.Enabled { -- cgit v1.3