diff options
Diffstat (limited to 'python/test_xrelfo.py')
| -rw-r--r-- | python/test_xrelfo.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/python/test_xrelfo.py b/python/test_xrelfo.py index 3ae24ea7b3..3379959dc1 100644 --- a/python/test_xrelfo.py +++ b/python/test_xrelfo.py @@ -22,20 +22,21 @@ import pytest from pprint import pprint root = os.path.dirname(os.path.dirname(__file__)) -sys.path.append(os.path.join(root, 'python')) +sys.path.append(os.path.join(root, "python")) import xrelfo from clippy import elf, uidhash + def test_uidhash(): - assert uidhash.uidhash("lib/test_xref.c", "logging call", 3, 0) \ - == 'H7KJB-67TBH' + assert uidhash.uidhash("lib/test_xref.c", "logging call", 3, 0) == "H7KJB-67TBH" + def test_xrelfo_other(): for data in [ - elf.ELFNull(), - elf.ELFUnresolved('somesym', 0), - ]: + elf.ELFNull(), + elf.ELFUnresolved("somesym", 0), + ]: dissect = xrelfo.XrefPtr(data) print(repr(dissect)) @@ -43,9 +44,10 @@ def test_xrelfo_other(): with pytest.raises(AttributeError): dissect.xref + def test_xrelfo_obj(): xrelfo_ = xrelfo.Xrelfo() - edf = xrelfo_.load_elf(os.path.join(root, 'lib/.libs/zclient.o'), 'zclient.lo') + edf = xrelfo_.load_elf(os.path.join(root, "lib/.libs/zclient.o"), "zclient.lo") xrefs = xrelfo_._xrefs with pytest.raises(elf.ELFAccessError): @@ -54,12 +56,13 @@ def test_xrelfo_obj(): pprint(xrefs[0]) pprint(xrefs[0]._data) + def test_xrelfo_bin(): xrelfo_ = xrelfo.Xrelfo() - edf = xrelfo_.load_elf(os.path.join(root, 'lib/.libs/libfrr.so'), 'libfrr.la') + edf = xrelfo_.load_elf(os.path.join(root, "lib/.libs/libfrr.so"), "libfrr.la") xrefs = xrelfo_._xrefs - assert edf[0:4] == b'\x7fELF' + assert edf[0:4] == b"\x7fELF" pprint(xrefs[0]) pprint(xrefs[0]._data) |
