-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/weight/nm: more robust parsing of nm output
- Loading branch information
Showing
2 changed files
with
75 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,29 @@ | ||
package nm | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
) | ||
|
||
var validLines = []string{ | ||
` 16781312 U _mmap`, | ||
` 16781312 U _munmap`, | ||
` 16781312 U _notify_is_valid_token`, | ||
` 16781312 U _open`, | ||
` 10d8fe0 8 R $f64.4024000000000000`, | ||
` 10d8fe8 8 R $f64.403a000000000000`, | ||
`115d4a0 256 D time.utcLoc`, | ||
`1091ca0 192 T type:.eq.[2]interface {}`, | ||
`1060160 160 T type:.eq.[2]runtime.Frame`, | ||
`1001fa0 256 T type:.eq.[6]internal/cpu.option`, | ||
} | ||
|
||
func TestParseLine(t *testing.T) { | ||
for _, line := range validLines { | ||
_, err := parseLine(line) | ||
t.Log(strings.Fields(line)) | ||
if err != nil { | ||
t.Errorf("%q parsing failed: %v", line, err) | ||
} | ||
} | ||
} |