diff options
| author | KyleMiles <krm504@nyu.edu> | 2021-10-21 19:53:32 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2021-10-21 19:53:32 -0400 |
| commit | 1861bcebbe78d945102135d94b88d0c367c9200f (patch) | |
| tree | 292ccecbc765a2052c0e3143b47a7d7e6380fbee | |
| parent | 35b56762efa96a490ef9a5066cbe1eb3e704a68b (diff) | |
Add test for liveness_at
| -rw-r--r-- | suite/testcommon.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/suite/testcommon.py b/suite/testcommon.py index dcb7570b..2d67bba1 100644 --- a/suite/testcommon.py +++ b/suite/testcommon.py @@ -466,7 +466,6 @@ class BinaryViewTestBuilder(Builder): return fixOutput(retinfo) - def test_dominators(self): """Dominators don't match oracle""" retinfo = [] @@ -478,6 +477,25 @@ class BinaryViewTestBuilder(Builder): retinfo.append("PostDominator: %x of %x" % (pdom.start, bb.start)) return fixOutput(retinfo) + def test_liveness(self): + """Liveness results don't match oracle""" + retinfo = [] + + for func in self.bv.functions: + for var in func.hlil.vars: + for bb in func.hlil: + for inst in bb: + retinfo.append(f"{func.name}-hlil@{inst.instr_index}: {func.hlil.is_var_live_at(var, inst.instr_index)}") + + for func in self.bv.functions: + for var in func.hlil.ssa_form.ssa_vars: + for bb in func.hlil.ssa_form: + for inst in bb: + retinfo.append(f"{func.name}-hlil-ssa@{inst.instr_index}: {func.hlil.ssa_form.is_ssa_var_live_at(var, inst.instr_index)}") + + return retinfo + + class TestBuilder(Builder): """ The TestBuilder is for tests that need to be checked against a stored oracle data that isn't from a binary. These test are @@ -1199,6 +1217,7 @@ class TestBuilder(Builder): self.delete_package("array_test.bndb") return fixOutput(sorted(retinfo)) + class VerifyBuilder(Builder): """ The VerifyBuilder is for tests that verify Binary Ninja against expected output. |
