Skip to content

Commit f7a3134

Browse files
committed
stack: Fix test expectations for go1.19 and update GA to go1.19
Bump github actions to run on go1.19. When starting a program on macOS on go1.18 and earlier, it seems that exec.Cmd.Run() used to evaluate symlinks. It is not true anymore on go1.19. Update test expectations accordingly. go1.19 also changed stack traces to not include assembly like it did previously. Test only change.
1 parent 6bf1786 commit f7a3134

2 files changed

Lines changed: 24 additions & 11 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
matrix:
3131
os: [ubuntu-latest, macos-latest, windows-latest]
3232
# Do not forget to bump every 6 months!
33-
gover: ["1.18"]
33+
gover: ["1.19"]
3434
env:
3535
PYTHONDONTWRITEBYTECODE: x
3636
steps:
@@ -101,7 +101,7 @@ jobs:
101101
# Windows.
102102
os: [ubuntu-latest, macos-latest, windows-latest]
103103
# Do not forget to bump every 6 months!
104-
gover: ["1.18"]
104+
gover: ["1.19"]
105105
env:
106106
PYTHONDONTWRITEBYTECODE: x
107107
steps:
@@ -280,7 +280,7 @@ jobs:
280280
matrix:
281281
os: [ubuntu-latest]
282282
# Do not forget to bump every 6 months!
283-
gover: ["1.18"]
283+
gover: ["1.19"]
284284
permissions:
285285
security-events: write
286286
steps:

stack/context_test.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,11 +1546,18 @@ func TestGomoduleComplex(t *testing.T) {
15461546
}
15471547
rootLocal := rootRemote
15481548
if runtime.GOOS == "darwin" {
1549-
// On MacOS, the path is a symlink and it will be somehow evaluated when we
1550-
// get the traces back. This must NOT be run on Windows otherwise the path
1551-
// will be converted to 8.3 format.
1552-
if rootRemote, err = filepath.EvalSymlinks(rootLocal); err != nil {
1553-
t.Fatal(err)
1549+
if ver := internaltest.GetGoMinorVersion(); ver > 0 && ver < 19 {
1550+
// On MacOS, $TMPDIR path is a symlink /var -> /private/var.
1551+
//
1552+
// On versions before go1.19, it was somehow evaluated by exec.Cmd.Run().
1553+
// This stopped being true on go1.19. I suspect it is a side-effect of
1554+
// https://go.dev/doc/go1.19#os-exec-path
1555+
//
1556+
// This must NOT be run on Windows otherwise the path will be converted
1557+
// to 8.3 format.
1558+
if rootRemote, err = filepath.EvalSymlinks(rootLocal); err != nil {
1559+
t.Fatal(err)
1560+
}
15541561
}
15551562
}
15561563

@@ -2386,9 +2393,15 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
23862393
if l := len(b.Stack.Calls); l != 4 {
23872394
t.Fatalf("expected %d calls, got %d", 4, l)
23882395
}
2389-
// The first item shall be an assembly file independent of the OS.
2390-
if s := b.Stack.Calls[0].RelSrcPath; !strings.HasSuffix(s, ".s") {
2391-
t.Fatalf("expected assembly file, got %q", s)
2396+
// The first item shall be an assembly file independent of the OS on Go
2397+
// < 1.19.
2398+
s := b.Stack.Calls[0].RelSrcPath
2399+
if ver := internaltest.GetGoMinorVersion(); ver > 0 && ver < 19 {
2400+
if !strings.HasSuffix(s, ".s") {
2401+
t.Fatalf("expected assembly file, got %q", s)
2402+
}
2403+
} else if !strings.HasPrefix(s, "syscall") && !strings.HasSuffix(s, ".go") {
2404+
t.Fatalf("expected syscall go file, got %q", s)
23922405
}
23932406
}
23942407
// Process the golang.org/x/sys call specifically.

0 commit comments

Comments
 (0)