aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2026-03-31 13:07:38 -0400
committerCherry Mui <cherryyz@google.com>2026-04-01 11:16:19 -0700
commit676dfe4d72c3c05485a6615995eb452e676630e0 (patch)
tree83f0e7881445c69460b4d0c17a4697ca79501732 /src/runtime
parent8d1c4631fa15023156740e3623b294bb5ed8dabf (diff)
downloadgo-676dfe4d72c3c05485a6615995eb452e676630e0.tar.xz
runtime/secret: replace stub reference in test assembly
In runtime/secret's TestCore, it copies some files from the runtime/secret package to a test main package, including assembly files. The assembly function references a stub function in Go, which is also copied. Make it reference the copied one, not the original one, to avoid cross-package assembly references. We may want to rewrite the test to avoid copy, e.g. including the test functions in the test binary itself and having the test run itself in a subprocess. Leave that for later. Change-Id: I5187edcc41d1d0469fc6b1b5f2acc60df37e5c1e Reviewed-on: https://go-review.googlesource.com/c/go/+/761520 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/secret/crash_test.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/runtime/secret/crash_test.go b/src/runtime/secret/crash_test.go
index 6cd51bc15a..3d5e3dacc0 100644
--- a/src/runtime/secret/crash_test.go
+++ b/src/runtime/secret/crash_test.go
@@ -84,11 +84,15 @@ func TestCore(t *testing.T) {
}
// Copy our testing assembly files. Use the ones from the package
// to assure that they are always in sync
- err = copyToDir("./asm_amd64.s", tmpDir, nil)
+ err = copyToDir("./asm_amd64.s", tmpDir, func(s string) string {
+ return strings.ReplaceAll(s, "runtime∕secret·", "main·")
+ })
if err != nil {
t.Fatalf("error copying file %v", err)
}
- err = copyToDir("./asm_arm64.s", tmpDir, nil)
+ err = copyToDir("./asm_arm64.s", tmpDir, func(s string) string {
+ return strings.ReplaceAll(s, "runtime∕secret·", "main·")
+ })
if err != nil {
t.Fatalf("error copying file %v", err)
}