Rizin
unix-like reverse engineering framework and cli tools
regress Namespace Reference

Classes

class  RegressTest
 

Functions

def main ()
 
def to_hex (s)
 
def str_syntax (syntax)
 
def str_arch_mode (a, m)
 
def test_regression (verbose)
 

Variables

 directory = dirname(__file__)
 
 modules = glob.glob(directory+"/*.py")
 
list __all__ = [ basename(f)[:-3] for f in modules if isfile(f)]
 
 suite = unittest.TestSuite()
 
 m = __import__(module)
 
 realcl = getattr(m,cl)
 
tuple all_tests
 
int _python3 = 3
 

Function Documentation

◆ main()

def regress.main ( void  )

Definition at line 13 of file regress.py.

13 def main():
14  unittest.main()
15 
def main()
Definition: regress.py:13

◆ str_arch_mode()

def regress.str_arch_mode (   a,
  m 
)

Definition at line 718 of file regress.py.

718 def str_arch_mode(a, m):
719  amlist = {
720  (CS_ARCH_X86, CS_MODE_16): "X86-16bit",
721  (CS_ARCH_X86, CS_MODE_32): "X86-32bit",
722  (CS_ARCH_X86, CS_MODE_64): "X86-64bit",
723  }
724 
725  return amlist[(a, m)]
726 
727 
728 # ## Test cs_disasm_quick()
def str_arch_mode(a, m)
Definition: regress.py:718

Referenced by test_regression().

◆ str_syntax()

def regress.str_syntax (   syntax)

Definition at line 708 of file regress.py.

708 def str_syntax(syntax):
709  slist = {
710  0: "",
711  CS_OPT_SYNTAX_INTEL: "intel",
712  CS_OPT_SYNTAX_ATT: "att",
713  }
714 
715  return slist[syntax]
716 
717 
def str_syntax(syntax)
Definition: regress.py:708

Referenced by test_regression().

◆ test_regression()

def regress.test_regression (   verbose)

Definition at line 729 of file regress.py.

729 def test_regression(verbose):
730  for (arch, mode, syntax, address, code, expected_output) in all_tests:
731  #print("%s %s: %s = " %(str_arch_mode(arch, mode), str_syntax(syntax), to_hex(code)), end=""),
732  output = "%s %s: %s = " %(str_arch_mode(arch, mode), str_syntax(syntax), to_hex(code))
733  md = Cs(arch, mode)
734  if syntax != 0:
735  md.syntax = syntax
736  insn = list(md.disasm(code, address))[0]
737  output2 = "%s %s" % (insn.mnemonic, insn.op_str)
738  if output2 != expected_output:
739  print(output, output2)
740  print("\t --> ERROR: expected output = %s" %(expected_output))
741  elif verbose:
742  print(output, output2)
743 
744 
static void list(RzEgg *egg)
Definition: rz-gg.c:52
def to_hex(s)
Definition: regress.py:701
def test_regression(verbose)
Definition: regress.py:729

References len, list(), str_arch_mode(), str_syntax(), and to_hex().

◆ to_hex()

def regress.to_hex (   s)

Definition at line 701 of file regress.py.

701 def to_hex(s):
702  if _python3:
703  return " ".join("0x{0:02x}".format(c) for c in s) # <-- Python 3 is OK
704  else:
705  return " ".join("0x{0:02x}".format(ord(c)) for c in s)
706 
707 

Referenced by test_regression().

Variable Documentation

◆ __all__

list regress.__all__ = [ basename(f)[:-3] for f in modules if isfile(f)]
private

Definition at line 21 of file regress.py.

◆ _python3

int regress._python3 = 3
private

Definition at line 698 of file regress.py.

◆ all_tests

tuple regress.all_tests

Definition at line 8 of file regress.py.

◆ directory

string regress.directory = dirname(__file__)

Definition at line 17 of file regress.py.

Referenced by read_image_delay_import_directory(), and rz_lib_opendir().

◆ m

regress.m = __import__(module)

Definition at line 25 of file regress.py.

Referenced by __holdMouseState(), __init_panel_param(), apprentice_r_magic_strength(), backref(), branch(), bs1(), buf_format(), build_move16(), build_tree(), bythirds(), cdb_findnext(), check_format(), combine_sequences(), disasm_until_ret(), dissect(), esil_of(), fast(), file_buffer(), file_mdump(), file_mmap(), file_signextend(), filter(), flagbar_foreach(), gen_bitlen(), genmask(), get_crossing_matrix(), get_filetype(), get_method_list_t(), getvalue(), hex_op_masks_extract(), listxrefs(), LZ4_NbCommonBytes(), macro_call(), magiccheck(), MAIN_NAME(), map_p2v(), match(), matcher(), mconvert(), MCOperandInfo_isOptionalDef(), MCOperandInfo_isPredicate(), mem(), mem_16bit_2reg(), mem_32bit_2reg(), mget(), mpc_calloc(), mpc_fail(), mpc_optimise_unretained(), mpcaf_fold_regex(), mprint(), multmodp(), myregwrite(), operator<<(), pager_all_matches(), pager_color_line(), parse(), parse_codeview_modifier(), parse_mime(), TestBasic.platform.platform(), print_insn_hppa(), reverse_lt_8bits(), rsp_sign_extend(), rz_analysis_esil_signext(), rz_asm_tokenize_asm_regex(), rz_asn1_stringify_oid(), rz_big_powm(), rz_bin_object_p2v(), rz_bin_object_v2p(), rz_cmd_debug_dmS_handler(), rz_cmd_macro_add(), rz_cmd_macro_list(), rz_cmd_macro_meta(), rz_cmd_macro_rm(), rz_core_bin_class_fields_print(), rz_core_bin_class_methods_print(), rz_core_get_boundaries_prot(), rz_core_visual_hudclasses(), rz_debug_dmp_init(), rz_debug_dmp_maps(), rz_debug_dmp_modules(), rz_debug_map_clone(), rz_debug_winkd_maps(), rz_debug_winkd_modules(), rz_diff_matches_new(), rz_diff_myers_distance(), rz_file_mmap(), rz_file_mmap_free(), rz_file_mmap_resize(), rz_io_map_exists(), rz_io_open_at(), rz_main_free(), rz_main_new(), rz_main_run(), rz_meta_set_with_subtype(), rz_open_maps_prioritize_binid_handler(), rz_punycode_encode(), rz_x509_certificate_json(), rz_x509_crlentry_json(), rz_x509_extensions_json(), rz_x509_subjectpublickeyinfo_dump(), rz_x509_subjectpublickeyinfo_json(), rz_x509_tbscertificate_json(), set_layout(), set_test_type(), set_xref(), sh_il_div1(), sh_il_muls(), sh_il_mulu(), sh_op_get_param_movl(), show_class(), slide_hash(), slow(), std_16bit_2reg(), std_32bit_2reg(), std_32bit_3reg(), str_split_list_common_regex(), string_modifier_check(), thumb_assemble(), uv__idna_toascii_label(), uv__strdup(), uv__strndup(), xnu_dbg_maps(), and xtensa_si_op().

◆ modules

◆ realcl

regress.realcl = getattr(m,cl)

Definition at line 28 of file regress.py.

◆ suite

regress.suite = unittest.TestSuite()

Definition at line 22 of file regress.py.