diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2021-08-19 13:09:46 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2021-08-19 17:15:00 +0200 |
| commit | f6c43faab72cc4d24c97287064030de97ab74f4a (patch) | |
| tree | f258f1686881d9e24c38957e9c6ae275ef284b37 /pkg/report/linux_test.go | |
| parent | e2da378b5ceacf2ee1e23913bb1bc4de502f364a (diff) | |
pkg/report: return more information from opcode decompiler
Let decompiler also parse the exact command name. Perform right trim on
the full output line, as it may contain tabs and spaces at the end.
Introduce an "-update" flag to facilitate mass updating of opcode
decompilation tests after changes to this functionality.
Diffstat (limited to 'pkg/report/linux_test.go')
| -rw-r--r-- | pkg/report/linux_test.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/report/linux_test.go b/pkg/report/linux_test.go index ec5eb3c71..bba6326e0 100644 --- a/pkg/report/linux_test.go +++ b/pkg/report/linux_test.go @@ -14,6 +14,7 @@ import ( "testing" "github.com/google/syzkaller/pkg/mgrconfig" + "github.com/google/syzkaller/pkg/osutil" "github.com/google/syzkaller/pkg/symbolizer" "github.com/google/syzkaller/sys/targets" ) @@ -421,12 +422,16 @@ func testDisassembly(t *testing.T, reporter *linux, testFilePrefix string) { t.Fatalf("failed to read input file: %v", err) } + result := reporter.decompileReportOpcodes(input) + if *flagUpdate { + osutil.WriteFile(testFilePrefix+".out", result) + } + output, err := ioutil.ReadFile(testFilePrefix + ".out") if err != nil { t.Fatalf("failed to read output file: %v", err) } - result := reporter.decompileReportOpcodes(input) if !bytes.Equal(output, result) { t.Fatalf("Expected:\n%s\nGot:\n%s\n", output, result) } |
