(t *testing.T)
| 510 | } |
| 511 | |
| 512 | func 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 | |
| 554 | func TestDocURL(t *testing.T) { |
| 555 | type testCase struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…