aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2026-01-09 19:01:50 +0100
committerGopher Robot <gobot@golang.org>2026-01-12 10:59:46 -0800
commitdf6c351aa4bbc8805406bfef979e62f59fc76da9 (patch)
treeebcd6e401567e940d9d716eaa11f6f2c851e887b /src
parentcc1d7afb247677fd9a1f75d11587af00d65e231d (diff)
downloadgo-df6c351aa4bbc8805406bfef979e62f59fc76da9.tar.xz
crypto: use testenv.Executable(t) instead of os.Args[0] in tests
Change-Id: Ib0ec1f05e51a4295a9369d6e8c6b61976a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/735260 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Daniel McCarney <daniel@binaryparadox.net> Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/crypto/internal/fips140test/acvp_test.go4
-rw-r--r--src/crypto/internal/fips140test/check_test.go2
-rw-r--r--src/crypto/tls/bogo_shim_test.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/crypto/internal/fips140test/acvp_test.go b/src/crypto/internal/fips140test/acvp_test.go
index e94bab74fd..6a0b46af2b 100644
--- a/src/crypto/internal/fips140test/acvp_test.go
+++ b/src/crypto/internal/fips140test/acvp_test.go
@@ -2146,7 +2146,7 @@ func TestACVP(t *testing.T) {
}
configPath := filepath.Join(cwd, testConfigFile)
t.Logf("running check_expected.go\ncwd: %q\ndata_dir: %q\nconfig: %q\ntool: %q\nmodule-wrapper: %q\n",
- cwd, dataDir, configPath, toolPath, os.Args[0])
+ cwd, dataDir, configPath, toolPath, testenv.Executable(t))
// Run the check_expected test driver using the acvptool we built, and this test binary as the
// module wrapper. The file paths in the config file are specified relative to the dataDir root
@@ -2157,7 +2157,7 @@ func TestACVP(t *testing.T) {
"-tool",
toolPath,
// Note: module prefix must match Wrapper value in testConfigFile.
- "-module-wrappers", "go:" + os.Args[0],
+ "-module-wrappers", "go:" + testenv.Executable(t),
"-tests", configPath,
}
cmd = testenv.Command(t, testenv.GoToolPath(t), args...)
diff --git a/src/crypto/internal/fips140test/check_test.go b/src/crypto/internal/fips140test/check_test.go
index 8aef1f9b9b..d70ffbb77f 100644
--- a/src/crypto/internal/fips140test/check_test.go
+++ b/src/crypto/internal/fips140test/check_test.go
@@ -46,7 +46,7 @@ func TestIntegrityCheckFailure(t *testing.T) {
moduleStatus(t)
cryptotest.MustSupportFIPS140(t)
- bin, err := os.ReadFile(os.Args[0])
+ bin, err := os.ReadFile(testenv.Executable(t))
if err != nil {
t.Fatal(err)
}
diff --git a/src/crypto/tls/bogo_shim_test.go b/src/crypto/tls/bogo_shim_test.go
index 1b5fc49c4f..ccac47c271 100644
--- a/src/crypto/tls/bogo_shim_test.go
+++ b/src/crypto/tls/bogo_shim_test.go
@@ -577,7 +577,7 @@ func TestBogoSuite(t *testing.T) {
"test",
".",
fmt.Sprintf("-shim-config=%s", filepath.Join(cwd, "bogo_config.json")),
- fmt.Sprintf("-shim-path=%s", os.Args[0]),
+ fmt.Sprintf("-shim-path=%s", testenv.Executable(t)),
"-shim-extra-flags=-bogo-mode",
"-allow-unimplemented",
"-loose-errors", // TODO(roland): this should be removed eventually