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>
This commit is contained in:
Filippo Valsorda
2026-01-09 19:01:50 +01:00
committed by Gopher Robot
parent cc1d7afb24
commit df6c351aa4
3 changed files with 4 additions and 4 deletions

View File

@@ -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...)

View File

@@ -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)
}

View File

@@ -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