From 67db6cfda9647c0f384337e9f8f6702c1abb3210 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sat, 29 Aug 2020 10:34:48 -0400 Subject: Update unit tests to allow for specifying settings. --- suite/generator.py | 2 +- suite/testcommon.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/suite/generator.py b/suite/generator.py index 6f2338d2..350c8e87 100755 --- a/suite/generator.py +++ b/suite/generator.py @@ -301,7 +301,7 @@ def generate(test_store, outdir, exclude_binaries): # Generate oracle data for rebasing tests name = oraclefile_rel[len(test_store):].replace(os.path.sep, "_").replace(".", "_")[1:] if name in ["helloworld", "duff", "partial_register_dataflow", "raw"]: - test_data = testcommon.BinaryViewTestBuilder(oraclefile_rel, imageBase=0xf00000) + test_data = testcommon.BinaryViewTestBuilder(oraclefile_rel, options={'loader.imageBase' : 0xf00000}) binary_oracle = OracleTestFile(os.path.join(outdir, oraclefile_rel) + "_rebasing") for method in test_data.methods(): binary_oracle.add_entry(test_data, method) diff --git a/suite/testcommon.py b/suite/testcommon.py index d81f263b..193ce5d8 100644 --- a/suite/testcommon.py +++ b/suite/testcommon.py @@ -106,12 +106,12 @@ class BinaryViewTestBuilder(Builder): - Function doc string used as 'on error' message - Should return: list of strings """ - def __init__(self, filename, imageBase=None): + def __init__(self, filename, options=None): self.filename = os.path.join(os.path.dirname(__file__), filename) - if imageBase is None: + if options is None: self.bv = BinaryViewType.get_view_of_file(self.filename) else: - self.bv = BinaryViewType.get_view_of_file_with_options(self.filename, options={'loader.imageBase' : imageBase}) + self.bv = BinaryViewType.get_view_of_file_with_options(self.filename, options=options) if self.bv is None: print("%s is not an executable format" % filename) return -- cgit v1.3.1