]> Cypherpunks repositories - gostls13.git/commitdiff
crypto: use testenv.Executable(t) instead of os.Args[0] in tests
authorFilippo Valsorda <filippo@golang.org>
Fri, 9 Jan 2026 18:01:50 +0000 (19:01 +0100)
committerGopher Robot <gobot@golang.org>
Mon, 12 Jan 2026 18:59:46 +0000 (10:59 -0800)
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>
src/crypto/internal/fips140test/acvp_test.go
src/crypto/internal/fips140test/check_test.go
src/crypto/tls/bogo_shim_test.go

index e94bab74fd5774df09541e050dce130709f42569..6a0b46af2bbe4003e4db5217752ba297ff2e0f74 100644 (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...)
index 8aef1f9b9b609e55ae7097ee36d7b38dc8ce80df..d70ffbb77f7017164f632301d7505b25ba7dc411 100644 (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)
        }
index 1b5fc49c4f319cbfa0a0a0c5e49fd11328158815..ccac47c271076bc91c8d84ad740f5838e49fea20 100644 (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