From 87b71edf4d6dc69d3cbb8f9d0ebb57f55512d8c5 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 24 Aug 2015 20:53:26 +0800 Subject: [PATCH] suite: add verbose output mode to regress.py --- suite/regress.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/suite/regress.py b/suite/regress.py index 8661f59ab..6b9b42fc0 100755 --- a/suite/regress.py +++ b/suite/regress.py @@ -480,20 +480,25 @@ def str_arch_mode(a, m): # ## Test cs_disasm_quick() -def test_regression(): +def test_regression(verbose): for (arch, mode, syntax, address, code, expected_output) in all_tests: - print("%s %s: %s = " %(str_arch_mode(arch, mode), str_syntax(syntax), to_hex(code)), end=""), + #print("%s %s: %s = " %(str_arch_mode(arch, mode), str_syntax(syntax), to_hex(code)), end=""), + output = "%s %s: %s = " %(str_arch_mode(arch, mode), str_syntax(syntax), to_hex(code)) md = Cs(arch, mode) if syntax != 0: md.syntax = syntax insn = list(md.disasm(code, address))[0] - output = "%s %s" % (insn.mnemonic, insn.op_str) - print(output) - if output != expected_output: + output2 = "%s %s" % (insn.mnemonic, insn.op_str) + if output2 != expected_output: + print(output, output2) print("\t --> ERROR: expected output = %s" %(expected_output)) - - print() + elif verbose: + print(output, output2) if __name__ == '__main__': - test_regression() + import sys + if len(sys.argv) == 2 and sys.argv[1] == "-v": + test_regression(True) # quiet + else: + test_regression(False) # verbose