MCPcopy Create free account
hub / github.com/google/pprof / TestPrintAssemblyErrorMessage

Function TestPrintAssemblyErrorMessage

internal/report/report_test.go:512–552  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

510}
511
512func TestPrintAssemblyErrorMessage(t *testing.T) {
513 profile := readProfile(filepath.Join("testdata", "sample.cpu"), t)
514
515 for _, tc := range []struct {
516 desc string
517 symbol string
518 want string
519 }{
520 {
521 desc: "no matched symbol in binary",
522 symbol: "symbol-not-exist",
523 want: "no matches found for regexp symbol-not-exist",
524 },
525 {
526 desc: "no matched address in binary",
527 symbol: "0xffffaaaa",
528 want: "no matches found for address 0xffffaaaa",
529 },
530 {
531 desc: "matched address in binary but not in the profile",
532 symbol: "0x400000",
533 want: "address 0x400000 found in binary, but the corresponding symbols do not have samples in the profile",
534 },
535 } {
536 rpt := New(
537 profile.Copy(),
538 &Options{
539 OutputFormat: List,
540 Symbol: regexp.MustCompile(tc.symbol),
541 SampleValue: func(v []int64) int64 {
542 return v[1]
543 },
544 SampleUnit: profile.SampleType[1].Unit,
545 },
546 )
547
548 if err := PrintAssembly(os.Stdout, rpt, &binutils.Binutils{}, -1); err == nil || err.Error() != tc.want {
549 t.Errorf(`Got "%v", want %q`, err, tc.want)
550 }
551 }
552}
553
554func TestDocURL(t *testing.T) {
555 type testCase struct {

Callers

nothing calls this directly

Calls 4

readProfileFunction · 0.85
PrintAssemblyFunction · 0.85
CopyMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…