Skip to content

Commit

Permalink
stack: Fix test expectations for go1.19 and update GA to go1.19
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
maruel committed Aug 29, 2022
1 parent 6bf1786 commit f7a3134
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Do not forget to bump every 6 months!
gover: ["1.18"]
gover: ["1.19"]
env:
PYTHONDONTWRITEBYTECODE: x
steps:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
# Windows.
os: [ubuntu-latest, macos-latest, windows-latest]
# Do not forget to bump every 6 months!
gover: ["1.18"]
gover: ["1.19"]
env:
PYTHONDONTWRITEBYTECODE: x
steps:
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# Do not forget to bump every 6 months!
gover: ["1.18"]
gover: ["1.19"]
permissions:
security-events: write
steps:
Expand Down
29 changes: 21 additions & 8 deletions stack/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1546,11 +1546,18 @@ func TestGomoduleComplex(t *testing.T) {
}
rootLocal := rootRemote
if runtime.GOOS == "darwin" {
// On MacOS, the path is a symlink and it will be somehow evaluated when we
// get the traces back. This must NOT be run on Windows otherwise the path
// will be converted to 8.3 format.
if rootRemote, err = filepath.EvalSymlinks(rootLocal); err != nil {
t.Fatal(err)
if ver := internaltest.GetGoMinorVersion(); ver > 0 && ver < 19 {
// On MacOS, $TMPDIR path is a symlink /var -> /private/var.
//
// On versions before go1.19, it was somehow evaluated by exec.Cmd.Run().
// This stopped being true on go1.19. I suspect it is a side-effect of
// https://go.dev/doc/go1.19#os-exec-path
//
// This must NOT be run on Windows otherwise the path will be converted
// to 8.3 format.
if rootRemote, err = filepath.EvalSymlinks(rootLocal); err != nil {
t.Fatal(err)
}
}
}

Expand Down Expand Up @@ -2386,9 +2393,15 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
if l := len(b.Stack.Calls); l != 4 {
t.Fatalf("expected %d calls, got %d", 4, l)
}
// The first item shall be an assembly file independent of the OS.
if s := b.Stack.Calls[0].RelSrcPath; !strings.HasSuffix(s, ".s") {
t.Fatalf("expected assembly file, got %q", s)
// The first item shall be an assembly file independent of the OS on Go
// < 1.19.
s := b.Stack.Calls[0].RelSrcPath
if ver := internaltest.GetGoMinorVersion(); ver > 0 && ver < 19 {
if !strings.HasSuffix(s, ".s") {
t.Fatalf("expected assembly file, got %q", s)
}
} else if !strings.HasPrefix(s, "syscall") && !strings.HasSuffix(s, ".go") {
t.Fatalf("expected syscall go file, got %q", s)
}
}
// Process the golang.org/x/sys call specifically.
Expand Down

0 comments on commit f7a3134

Please sign in to comment.