aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/internal
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2025-02-24 09:43:41 +0100
committerQuim Muntal <quimmuntal@gmail.com>2025-02-24 11:03:10 -0800
commitdceee2e983f5dab65c3905ecf40e70e15cf41b7d (patch)
tree90d8aec778115127028196a5de6b321008252b92 /src/crypto/internal
parent2ee775fd9b58247618cf8bc06935f33875bdc872 (diff)
downloadgo-dceee2e983f5dab65c3905ecf40e70e15cf41b7d.tar.xz
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 <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/crypto/internal')
-rw-r--r--src/crypto/internal/fips140test/check_test.go2
-rw-r--r--src/crypto/internal/sysrand/rand_linux_test.go2
-rw-r--r--src/crypto/internal/sysrand/rand_test.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/crypto/internal/fips140test/check_test.go b/src/crypto/internal/fips140test/check_test.go
index c014fff2a6..f516455fb4 100644
--- a/src/crypto/internal/fips140test/check_test.go
+++ b/src/crypto/internal/fips140test/check_test.go
@@ -35,7 +35,7 @@ func TestIntegrityCheck(t *testing.T) {
t.Skipf("skipping: %v", err)
}
- cmd := testenv.Command(t, os.Args[0], "-test.v", "-test.run=TestIntegrityCheck")
+ cmd := testenv.Command(t, testenv.Executable(t), "-test.v", "-test.run=TestIntegrityCheck")
cmd.Env = append(cmd.Environ(), "GODEBUG=fips140=on")
out, err := cmd.CombinedOutput()
if err != nil {
diff --git a/src/crypto/internal/sysrand/rand_linux_test.go b/src/crypto/internal/sysrand/rand_linux_test.go
index ab43904f91..ee28ebe135 100644
--- a/src/crypto/internal/sysrand/rand_linux_test.go
+++ b/src/crypto/internal/sysrand/rand_linux_test.go
@@ -49,7 +49,7 @@ func TestNoGetrandom(t *testing.T) {
return
}
- cmd := testenv.Command(t, os.Args[0], "-test.v")
+ cmd := testenv.Command(t, testenv.Executable(t), "-test.v")
cmd.Env = append(os.Environ(), "GO_GETRANDOM_DISABLED=1")
out, err := cmd.CombinedOutput()
if err != nil {
diff --git a/src/crypto/internal/sysrand/rand_test.go b/src/crypto/internal/sysrand/rand_test.go
index 2b9620c2fb..55b11a929b 100644
--- a/src/crypto/internal/sysrand/rand_test.go
+++ b/src/crypto/internal/sysrand/rand_test.go
@@ -105,7 +105,7 @@ func TestReadError(t *testing.T) {
return
}
- cmd := testenv.Command(t, os.Args[0], "-test.run=TestReadError")
+ cmd := testenv.Command(t, testenv.Executable(t), "-test.run=TestReadError")
cmd.Env = append(os.Environ(), "GO_TEST_READ_ERROR=1")
out, err := cmd.CombinedOutput()
if err == nil {