Skip to content

Commit

Permalink
[tests] Add missing coverage for stack_hasher.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Oct 26, 2023
1 parent dece34c commit 9cf25f7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions grizzly/common/test_stack_hasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ def test_stackframe_02():
assert StackFrame.from_line("a|b|c|d|e|f|g") is None
assert StackFrame.from_line("==123==") is None
assert StackFrame.from_line("==1== by 0x0: a ()") is None
assert StackFrame.from_line("rr(foo") is None
assert StackFrame.from_line("==1== at 0x0: ??? (:)") is None


def test_sanitizer_stackframe_01():
Expand Down Expand Up @@ -514,6 +516,16 @@ def test_gdb_stackframe_04():
assert frame.mode == Mode.GDB


def test_gdb_stackframe_05():
"""test creating a StackFrame from a GDB line missing line number"""
frame = StackFrame.from_line("#3 0x400545 in main () at test.c")
assert frame.stack_line == "3"
assert frame.function == "main"
assert frame.location == "test.c"
assert frame.offset is None
assert frame.mode == Mode.GDB


def test_minidump_stackframe_01():
"""test creating a StackFrame from a Minidump line with symbols"""
frame = StackFrame.from_line(
Expand Down Expand Up @@ -641,6 +653,15 @@ def test_valgrind_stackframe_05():
assert frame.mode == Mode.VALGRIND


def test_valgrind_stackframe_06():
frame = StackFrame.from_line("==4754== at 0x4C2AB80: ??? (in /bin/a)")
assert frame.stack_line is None
assert frame.function == "???"
assert frame.location == "a"
assert frame.offset is None
assert frame.mode == Mode.VALGRIND


def test_rr_stackframe_01():
frame = StackFrame.from_line("rr(main+0x244)[0x450b74]")
assert frame.stack_line is None
Expand Down

0 comments on commit 9cf25f7

Please sign in to comment.