summaryrefslogtreecommitdiff
path: root/suite
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2020-09-13 23:11:32 -0400
committerBrian Potchik <brian@vector35.com>2020-09-13 23:11:32 -0400
commit1acc58d472470f96f12ac4dfc78dc221775d18d3 (patch)
tree4978099506a83fbbbd347a5d0d69b42a821c34e2 /suite
parent4b15ec8bebac3e04e954d4eb216df66cb101c02a (diff)
Disable logging during headless unit tests.
Diffstat (limited to 'suite')
-rwxr-xr-xsuite/generator.py6
-rw-r--r--suite/testcommon.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/suite/generator.py b/suite/generator.py
index a349789e..7f91a97f 100755
--- a/suite/generator.py
+++ b/suite/generator.py
@@ -125,12 +125,17 @@ class TestBinaryNinjaAPI(unittest.TestCase):
if __name__ == "__main__":
api_only = False
+ disable_logging = True
if len(sys.argv) > 1:
for i in range(1, len(sys.argv)):
if sys.argv[i] == '-v' or sys.argv[i] == '-V' or sys.argv[i] == '--verbose':
config.verbose = True
elif sys.argv[i] == '--api-only':
config.api_only = True
+ elif sys.argv[i] == '--log':
+ disable_logging = False
+ if disable_logging:
+ testcommon.disable_logging()
test_suite = unittest.defaultTestLoader.loadTestsFromModule(api_test)
test_suite = unittest.defaultTestLoader.loadTestsFromModule(rebasing_test)
@@ -322,6 +327,7 @@ def generate(test_store, outdir, exclude_binaries):
def main():
+ testcommon.disable_logging()
usage = "usage: %prog [-q] [-x] [-o <dir>] [-i <dir>]"
parser = OptionParser(usage=usage)
default_output = os.path.relpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "suite"))
diff --git a/suite/testcommon.py b/suite/testcommon.py
index 036dc8ac..4b49213e 100644
--- a/suite/testcommon.py
+++ b/suite/testcommon.py
@@ -60,6 +60,9 @@ def fixStrRepr(string):
return string.replace(b"\xe2\x80\xa6".decode("utf8"), "\\xe2\\x80\\xa6")
+def disable_logging():
+ binja.disable_logging()
+
def get_file_list(test_store_rel):
test_store = os.path.join(os.path.dirname(__file__), test_store_rel)
all_files = []
@@ -889,7 +892,7 @@ class VerifyBuilder(Builder):
try:
with binja.open_view(file_name) as bv:
# ConstantValue
- lhs = bv.parse_possiblevalueset("0", binja.RegisterValueType.ConstantValue)
+ lhs = bv.parse_possiblevalueset("0", binja.RegisterValueType.ConstantValue)
rhs = binja.PossibleValueSet.constant(0)
assert lhs == rhs
lhs = bv.parse_possiblevalueset("$here + 2", binja.RegisterValueType.ConstantValue, 0x2000)