Skip to content

Commit 2a4e71c

Browse files
author
Bryan C. Mills
committed
run.bat: do not unset GOROOT_FINAL before running tests
This removes the same logic from run.bat that was removed from cmd/dist in CL 236819. The duplicated logic was removed from run.bash and run.rc in CL 6531, but that part of run.bat was apparently missed (and not noticed because its effect was redundant). Also fix a path-separator bug in cmd/addr2line.TestAddr2Line that was exposed as a result. Fixes #39478 Updates #39385 Change-Id: I00054966cf92ef92a03681bf23de7f45f46fbb5e Reviewed-on: https://go-review.googlesource.com/c/go/+/237359 Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent b9332ed commit 2a4e71c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/cmd/addr2line/addr2line_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ func testAddr2Line(t *testing.T, exepath, addr string) {
7373
if err != nil {
7474
t.Fatalf("Stat failed: %v", err)
7575
}
76+
// Debug paths are stored slash-separated, so convert to system-native.
77+
srcPath = filepath.FromSlash(srcPath)
7678
fi2, err := os.Stat(srcPath)
7779
if gorootFinal := os.Getenv("GOROOT_FINAL"); gorootFinal != "" && strings.HasPrefix(srcPath, gorootFinal) {
7880
if os.IsNotExist(err) || (err == nil && !os.SameFile(fi1, fi2)) {
@@ -88,12 +90,12 @@ func testAddr2Line(t *testing.T, exepath, addr string) {
8890
if !os.SameFile(fi1, fi2) {
8991
t.Fatalf("addr2line_test.go and %s are not same file", srcPath)
9092
}
91-
if srcLineNo != "97" {
92-
t.Fatalf("line number = %v; want 97", srcLineNo)
93+
if srcLineNo != "99" {
94+
t.Fatalf("line number = %v; want 99", srcLineNo)
9395
}
9496
}
9597

96-
// This is line 96. The test depends on that.
98+
// This is line 98. The test depends on that.
9799
func TestAddr2Line(t *testing.T) {
98100
testenv.MustHaveGoBuild(t)
99101

src/run.bat

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ if errorlevel 1 goto fail
3535
echo.
3636
:norebuild
3737

38-
:: we must unset GOROOT_FINAL before tests, because runtime/debug requires
39-
:: correct access to source code, so if we have GOROOT_FINAL in effect,
40-
:: at least runtime/debug test will fail.
41-
set GOROOT_FINAL=
42-
4338
:: get CGO_ENABLED
4439
..\bin\go env > env.bat
4540
if errorlevel 1 goto fail

0 commit comments

Comments
 (0)