def test_to_str_safe(self): if PY3: assert to_str_safe(b"bytes") == "bytes" assert to_str_safe("string") == "string" assert to_str_safe('System Administrator\u2019s Mouse') == 'System Administrator\u2019s Mouse' else: assert to_str_safe(b"bytes") == "bytes" assert to_str_safe("string") == "string" assert to_str_safe(u"string") == "string" assert to_str_safe(u'System Administrator\u2019s Mouse') == 'System Administrator\xe2\x80\x99s Mouse'
def binary_to_elf_file(binary_file, base_address): temp_test_elf_name = tempfile.mktemp('.elf') objcopyOutput = subprocess.check_output([OBJCOPY, "-v", "-I", "binary", "-O", "elf32-littlearm", "-B", "arm", "-S", "--set-start", "0x%x" % base_address, "--change-addresses", "0x%x" % base_address, binary_file, temp_test_elf_name], stderr=subprocess.STDOUT) print(to_str_safe(objcopyOutput)) # Need to escape backslashes on Windows. if sys.platform.startswith('win'): temp_test_elf_name = temp_test_elf_name.replace('\\', '\\\\') return temp_test_elf_name
def binary_to_elf_file(binary_file, base_address): temp_test_elf_name = tempfile.mktemp('.elf') objcopyOutput = subprocess.check_output([OBJCOPY, "-v", "-I", "binary", "-O", "elf32-littlearm", "-B", "arm", "-S", "--set-start", "0x%x" % base_address, "--change-addresses", "0x%x" % base_address, binary_file, temp_test_elf_name], stderr=subprocess.STDOUT) print(to_str_safe(objcopyOutput)) # Need to escape backslashes on Windows. if sys.platform.startswith('win'): temp_test_elf_name = temp_test_elf_name.replace('\\', '\\\\') return temp_test_elf_name
def test_to_str_safe(self): if PY3: assert to_str_safe(b"bytes") == "bytes" assert to_str_safe("string") == "string" assert to_str_safe('System Administrator\u2019s Mouse' ) == 'System Administrator\u2019s Mouse' else: assert to_str_safe(b"bytes") == "bytes" assert to_str_safe("string") == "string" assert to_str_safe(u"string") == "string" assert to_str_safe(u'System Administrator\u2019s Mouse' ) == 'System Administrator\xe2\x80\x99s Mouse'
def test_to_str_safe(self): assert to_str_safe(b"bytes") == "bytes" assert to_str_safe("string") == "string" assert to_str_safe('System Administrator\u2019s Mouse' ) == 'System Administrator\u2019s Mouse'