Skip to content

Commit

Permalink
make pointer regular expressions more flexible
Browse files Browse the repository at this point in the history
We just got a failure on Mac on CI with pointers past eight digits:

    (0x10432dec0,0x10433c690)

Use `[[:xdigit:]]+` consistently.
  • Loading branch information
mvdan committed Apr 25, 2024
1 parent 20a9246 commit 9f82b2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion testdata/script/reverse.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func printStackTrace(w io.Writer) error {
// The format also changes depending on the ABI.
// Strip them out here, to have portable static stdout files.
rxCallArgs := regexp.MustCompile(`\(({|0x)[^)]+\)|\(\)`)
rxPointer := regexp.MustCompile(`\+0x[0-9a-f]+`)
rxPointer := regexp.MustCompile(`\+0x[[:xdigit:]]+`)

// Keep this comment here, because comments affect line numbers.

Expand Down
4 changes: 2 additions & 2 deletions testdata/script/tiny.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exec garble -tiny build
env GODEBUG='allocfreetrace=1,gcpacertrace=1,gctrace=1,inittrace=1,scavenge=1,scavtrace=1,scheddetail=1,schedtrace=10'
! exec ./main$exe
env GODEBUG='' # Ensure further commands don't have weirdness due to GODEBUG.
stderr '^\(0x[\d\w]{4,8},0x[\d\w]{4,8}\)' # interfaces/pointers print correctly
stderr '^\(0x[[:xdigit:]]+,0x[[:xdigit:]]+\)' # interfaces/pointers print correctly
# With -tiny, all line numbers are reset to 1.
# Unfortunately, line comment directives don't allow erasing line numbers entirely.
stderr '^caller: \?\? 1$' # position info is removed
Expand All @@ -19,7 +19,7 @@ stderr 'funcStructExported false funcStructUnexported true'
# Default mode
exec garble build
! exec ./main$exe
stderr '^caller: [0-9a-zA-Z_]+\.go [1-9]'
stderr '^caller: [[:word:]]+\.go [1-9]'
stderr '^recovered: ya like jazz?'
stderr 'panic: oh noes'
stderr 'funcExported false funcUnexported false'
Expand Down

0 comments on commit 9f82b2b

Please sign in to comment.