diff --git a/docs/_autosummary/hexrec.xxd.CHAR_ASCII.rst b/docs/_autosummary/hexrec.xxd.CHAR_ASCII.rst new file mode 100644 index 0000000..882be07 --- /dev/null +++ b/docs/_autosummary/hexrec.xxd.CHAR_ASCII.rst @@ -0,0 +1,6 @@ +CHAR\_ASCII +=========== + +.. currentmodule:: hexrec.xxd + +.. autodata:: CHAR_ASCII \ No newline at end of file diff --git a/docs/_autosummary/hexrec.xxd.HUMAN_ASCII.rst b/docs/_autosummary/hexrec.xxd.CHAR_EBCDIC.rst similarity index 54% rename from docs/_autosummary/hexrec.xxd.HUMAN_ASCII.rst rename to docs/_autosummary/hexrec.xxd.CHAR_EBCDIC.rst index d088d3b..97fa767 100644 --- a/docs/_autosummary/hexrec.xxd.HUMAN_ASCII.rst +++ b/docs/_autosummary/hexrec.xxd.CHAR_EBCDIC.rst @@ -1,6 +1,6 @@ -HUMAN\_ASCII +CHAR\_EBCDIC ============ .. currentmodule:: hexrec.xxd -.. autodata:: HUMAN_ASCII \ No newline at end of file +.. autodata:: CHAR_EBCDIC \ No newline at end of file diff --git a/docs/_autosummary/hexrec.xxd.HUMAN_EBCDIC.rst b/docs/_autosummary/hexrec.xxd.HUMAN_EBCDIC.rst deleted file mode 100644 index 893e295..0000000 --- a/docs/_autosummary/hexrec.xxd.HUMAN_EBCDIC.rst +++ /dev/null @@ -1,6 +0,0 @@ -HUMAN\_EBCDIC -============= - -.. currentmodule:: hexrec.xxd - -.. autodata:: HUMAN_EBCDIC \ No newline at end of file diff --git a/docs/_autosummary/hexrec.xxd.humanize.rst b/docs/_autosummary/hexrec.xxd.humanize.rst deleted file mode 100644 index c16904d..0000000 --- a/docs/_autosummary/hexrec.xxd.humanize.rst +++ /dev/null @@ -1,6 +0,0 @@ -humanize -======== - -.. currentmodule:: hexrec.xxd - -.. autofunction:: humanize \ No newline at end of file diff --git a/docs/_autosummary/hexrec.xxd.rst b/docs/_autosummary/hexrec.xxd.rst index 6486861..88f0de2 100644 --- a/docs/_autosummary/hexrec.xxd.rst +++ b/docs/_autosummary/hexrec.xxd.rst @@ -13,8 +13,8 @@ :template: custom-base-template.rst :nosignatures: - ~HUMAN_ASCII - ~HUMAN_EBCDIC + ~CHAR_ASCII + ~CHAR_EBCDIC @@ -28,7 +28,6 @@ :template: custom-base-template.rst :nosignatures: - ~humanize ~parse_seek ~xxd_core diff --git a/src/hexrec/cli.py b/src/hexrec/cli.py index 3ee9f9e..4366bdd 100644 --- a/src/hexrec/cli.py +++ b/src/hexrec/cli.py @@ -676,7 +676,6 @@ def flood( """) @click.option('-I', '--input-format', type=FORMAT_CHOICE, help=""" Forces the input file format. - Required for the standard input. """) @click.option('-V', '--version', is_flag=True, is_eager=True, expose_value=False, callback=print_hexdump_version, help=""" @@ -808,7 +807,6 @@ def hexdump( """) @click.option('-I', '--input-format', type=FORMAT_CHOICE, help=""" Forces the input file format. - Required for the standard input. """) @click.option('-V', '--version', is_flag=True, is_eager=True, expose_value=False, callback=print_hexdump_version, help=""" @@ -1207,6 +1205,16 @@ def del_header( @click.option('-u', '--upper', 'upper', is_flag=True, help=""" Uses upper case hex letters on data only. """) +@click.option('-I', '--input-format', type=FORMAT_CHOICE, help=""" + Forces the input file format. +""") +@click.option('-O', '--output-format', type=FORMAT_CHOICE, help=""" + Forces the output file format. +""") +@click.option('--seek-zeroes/--no-seek-zeroes', 'oseek_zeroes', is_flag=True, + default=True, help=""" + Output seeking writes zeroes while seeking. +""") @click.option('-v', '--version', is_flag=True, is_eager=True, expose_value=False, callback=print_version, help=""" Prints the package version number. @@ -1230,6 +1238,9 @@ def xxd( iseek: int, upper_all: bool, upper: bool, + input_format: str, + output_format: str, + oseek_zeroes: bool, infile: str, outfile: str, ) -> None: @@ -1242,6 +1253,19 @@ def xxd( infile = None if infile == '-' else infile outfile = None if outfile == '-' else outfile + output_path = outfile + output_file = None + input_type = None + + if input_format: + input_type = guess_input_type(infile, input_format) + input_file = input_type.load(infile) + infile = input_file.memory + + if output_format: + output_type = guess_output_type(outfile, input_format, input_type) + output_file = output_type() + outfile = output_file.memory xxd_core( infile=infile, @@ -1262,4 +1286,8 @@ def xxd( iseek=iseek, upper_all=upper_all, upper=upper, + oseek_zeroes=oseek_zeroes, ) + + if output_format: + output_file.save(output_path) diff --git a/src/hexrec/hexdump.py b/src/hexrec/hexdump.py index 7f90035..3d1491a 100644 --- a/src/hexrec/hexdump.py +++ b/src/hexrec/hexdump.py @@ -501,8 +501,8 @@ def hexdump_core( format_handlers = [_format_default] do_squeezing = not no_squeezing - instream = None - outstream = None + instream: Optional[IO, SparseMemoryIO] = None + outstream: Optional[IO] = None try: # Input stream binding if infile is None: diff --git a/src/hexrec/utils.py b/src/hexrec/utils.py index f33272f..355ac40 100644 --- a/src/hexrec/utils.py +++ b/src/hexrec/utils.py @@ -30,7 +30,6 @@ import sys from typing import Any from typing import Iterator -from typing import List from typing import Mapping from typing import Optional from typing import Sequence @@ -43,12 +42,6 @@ from .base import AnyBytes from .base import EllipsisType -BIN8_TO_STR: List[str] = [bin(i)[2:].zfill(8) for i in range(256)] -STR_TO_BIN8: Mapping[str, int] = {s: i for i, s in enumerate(BIN8_TO_STR)} - -BIN8_TO_BYTES: List[bytes] = [bin(i)[2:].zfill(8).encode() for i in range(256)] -BYTES_TO_BIN8: Mapping[bytes, int] = {s: i for i, s in enumerate(BIN8_TO_BYTES)} - SUFFIX_SCALE: Mapping[str, int] = { 'k': 2**10, 'm': 2**20, diff --git a/src/hexrec/xxd.py b/src/hexrec/xxd.py index 9de74b1..1d5e7ae 100644 --- a/src/hexrec/xxd.py +++ b/src/hexrec/xxd.py @@ -25,22 +25,25 @@ r"""Emulation of the xxd utility.""" +import binascii import io import os import re import sys from typing import IO -from typing import Mapping +from typing import List from typing import Optional from typing import Tuple from typing import Union +from bytesparse import Memory +from bytesparse.base import ImmutableMemory +from bytesparse.base import MutableMemory + from .base import AnyBytes -from .utils import BIN8_TO_BYTES +from .utils import SparseMemoryIO from .utils import chop -from .utils import hexlify from .utils import parse_int -from .utils import unhexlify _SEEKING_REGEX = re.compile(r'^(?P\+?-?)-?(?P\w+)$') @@ -50,61 +53,55 @@ ZERO_BLOCK_SIZE = 1 << 20 # 1 MiB -HUMAN_ASCII = (b'................' - b'................' - b' !"#$%&\'()*+,-./' - b'0123456789:;<=>?' - b'@ABCDEFGHIJKLMNO' - b'PQRSTUVWXYZ[\\]^_' - b'`abcdefghijklmno' - b'pqrstuvwxyz{|}~.' - b'................' - b'................' - b'................' - b'................' - b'................' - b'................' - b'................' - b'................') -r"""Mapping from byte to human-readable ASCII characters.""" - -HUMAN_EBCDIC = (b'................' - b'................' - b'................' - b'................' - b' ...........<(+|' - b'&.........!$*);~' - b'-/.........,%_>?' - b'.........`:#@\'="' - b'.abcdefghi......' - b'.jklmnopqr^.....' - b'..stuvwxyz...[..' - b'.............]..' - b'{ABCDEFGHI......' - b'}JKLMNOPQR......' - b'\\.STUVWXYZ......' - b'0123456789......') -r"""Mapping from byte to human-readable EBCDIC characters.""" - - -def humanize( - chunk: AnyBytes, - charset: Union[bytes, Mapping[int, bytes]], -) -> bytes: - r"""Translates bytes to a human-readable representation. - - Args: - chunk (bytes): - A chunk of bytes. - - charset (list of chr): - A mapping from byte (index) to character. - - Returns: - str: Human-readable byte string. - """ - - return bytes(charset[b] for b in chunk) +_HEX_LOWER = [b'%02x' % b for b in range(256)] + [b'--', b'>>', b'<<'] +_HEX_UPPER = [b'%02X' % b for b in range(256)] + [b'--', b'>>', b'<<'] + +_BIN8: List[bytes] = ( + [bin(i)[2:].zfill(8).encode() for i in range(256)] + + [b'--------', b'>>>>>>>>', b'<<<<<<<<'] +) + +CHAR_ASCII = ( + b'................' + b'................' + b' !"#$%&\'()*+,-./' + b'0123456789:;<=>?' + b'@ABCDEFGHIJKLMNO' + b'PQRSTUVWXYZ[\\]^_' + b'`abcdefghijklmno' + b'pqrstuvwxyz{|}~.' + b'................' + b'................' + b'................' + b'................' + b'................' + b'................' + b'................' + b'................' + b' ><' +) +r"""Mapping from integer to ASCII characters.""" + +CHAR_EBCDIC = ( + b'................' + b'................' + b'................' + b'................' + b' ...........<(+|' + b'&.........!$*);~' + b'-/.........,%_>?' + b'.........`:#@\'="' + b'.abcdefghi......' + b'.jklmnopqr^.....' + b'..stuvwxyz...[..' + b'.............]..' + b'{ABCDEFGHI......' + b'}JKLMNOPQR......' + b'\\.STUVWXYZ......' + b'0123456789......' + b' ><' +) +r"""Mapping from integer to EBCDIC characters.""" def parse_seek(value: Optional[str]) -> Tuple[str, int]: @@ -131,8 +128,44 @@ def parse_seek(value: Optional[str]) -> Tuple[str, int]: return ss, sv +def _unhexlify(line: AnyBytes) -> Union[AnyBytes, ImmutableMemory]: + + line = line.translate(None, b' \t.:\r\n') + + if 0x3C in line: + line = line.replace(b'<', b'-') + + if 0x3E in line: + line = line.replace(b'>', b'-') + + if 0x2D in line: + zeroed = line.replace(b'-', b'0') + chunk = binascii.unhexlify(zeroed) + even = line[::2] + size = len(chunk) + memory = Memory.from_values(((None if even[i] == 0x2D else chunk[i]) + for i in range(size)), + start=0, endex=size) + return memory + else: + chunk = binascii.unhexlify(line) + return chunk + + +def _write_zeros( + stream: Union[IO, SparseMemoryIO], + size: int +) -> None: + + zero_block = bytes(ZERO_BLOCK_SIZE) + for _ in range(size // ZERO_BLOCK_SIZE): + stream.write(zero_block) + del zero_block + stream.write(bytes(size % ZERO_BLOCK_SIZE)) + + def xxd_core( - infile: Optional[Union[str, AnyBytes, IO]] = None, + infile: Optional[Union[str, AnyBytes, IO, ImmutableMemory]] = None, outfile: Optional[Union[str, AnyBytes, IO]] = None, autoskip: bool = False, bits: Optional[int] = None, @@ -151,6 +184,7 @@ def xxd_core( iseek: Optional[Union[int, str]] = None, upper_all: bool = False, upper: bool = False, + oseek_zeroes: bool = True, ) -> IO: r"""Emulation of the `xxd` utility core. @@ -260,6 +294,10 @@ def xxd_core( upper (bool): Uses upper case hex letters on data only. + oseek_zeroes (bool): + Output seeking fills with zeros. + Only affects `outfile` of :class:`bytesparse.base.MutableMemory`. + Returns: stream: The handle to the output stream. """ @@ -283,8 +321,10 @@ def xxd_core( if linesep is None: linesep = os.linesep.encode() - instream: Optional[IO] = None - outstream: Optional[IO] = None + instream: Optional[IO, SparseMemoryIO] = None + outstream: Optional[IO, SparseMemoryIO] = None + outsparse = False + try: # Input stream binding if infile is None: @@ -294,6 +334,8 @@ def xxd_core( instream = open(infile, 'rb') elif isinstance(infile, (bytes, bytearray, memoryview)): instream = io.BytesIO(infile) + elif isinstance(infile, ImmutableMemory): + instream = SparseMemoryIO(memory=infile) else: instream = infile @@ -303,11 +345,14 @@ def xxd_core( outstream = sys.stdout.buffer elif isinstance(outfile, str): outstream = open(outfile, 'w+b' if revert and oseek else 'wb') + elif isinstance(outfile, MutableMemory): + outstream = SparseMemoryIO(memory=outfile) + outsparse = True else: outstream = outfile # Input seeking - offset = parse_int(offset) if offset else 0 + offset = parse_int(offset or 0) if iseek is not None: ss, sv = parse_seek(str(iseek)) @@ -325,18 +370,17 @@ def xxd_core( # Output seeking if revert: - zero_block = bytes(ZERO_BLOCK_SIZE) - for _ in range((oseek or 0) // ZERO_BLOCK_SIZE): - outstream.write(zero_block) - del zero_block - outstream.write(bytes((oseek or 0) % ZERO_BLOCK_SIZE)) + if outsparse and not oseek_zeroes: + outstream.seek((oseek or 0), io.SEEK_CUR) + else: + _write_zeros(outstream, (oseek or 0)) # Output mode handling if revert: if postscript: # Plain hexadecimal input for line in instream: - data = unhexlify(line, delete=...) + data = _unhexlify(line) outstream.write(data) else: if cols is None: @@ -348,18 +392,17 @@ def xxd_core( # Interpret line contents groups = match.groupdict() address = (oseek or 0) + int(groups['address'], 16) - data = unhexlify(groups['data'], delete=...) + data = _unhexlify(groups['data']) data = data[:cols] # Write line data (fill gaps if needed) outstream.seek(0, io.SEEK_END) outoffset = outstream.tell() if outoffset < address: - zero_block = bytes(ZERO_BLOCK_SIZE) - for _ in range((address - outoffset) // ZERO_BLOCK_SIZE): - outstream.write(zero_block) - del zero_block - outstream.write(bytes((address - outoffset) % ZERO_BLOCK_SIZE)) + if outsparse and not oseek_zeroes: + outstream.seek((address - outoffset), io.SEEK_CUR) + else: + _write_zeros(outstream, (address - outoffset)) outstream.seek(address, io.SEEK_SET) outstream.write(data) @@ -378,7 +421,9 @@ def xxd_core( chunk = instream.read(min(cols, length - count)) if chunk: - outstream.write(hexlify(chunk, upper=upper)) + table = _HEX_UPPER if upper else _HEX_LOWER + line = b''.join(table[b] for b in chunk) + outstream.write(line) outstream.write(linesep) count += len(chunk) else: @@ -398,8 +443,7 @@ def xxd_core( if isinstance(infile, str): label = os.path.basename(infile) label = re.sub('[^0-9a-zA-Z]+', '_', label).encode() - outstream.write(b'unsigned char %s[] = {%s' - % (label, linesep)) + outstream.write(b'unsigned char %s[] = {%s' % (label, linesep)) else: label = None @@ -418,8 +462,8 @@ def xxd_core( if count: outstream.write(comma_linesep) outstream.write(indent) - token_fmt = b'%02X' if upper else b'%02x' - text = sep.join((token_fmt % b) for b in chunk) + table = _HEX_UPPER if upper else _HEX_LOWER + text = sep.join(table[b] for b in chunk) outstream.write(text) count += len(chunk) @@ -468,7 +512,7 @@ def xxd_core( if chunk: # Null line skipping - if autoskip and not any(chunk): + if autoskip and all(b == 0 for b in chunk): if last_zero: offset += len(chunk) count += len(chunk) @@ -480,17 +524,24 @@ def xxd_core( if groupsize: tokens = chop(chunk, groupsize) else: - tokens = (chunk,) + tokens = [chunk] if bits: - tokens = b' '.join(b''.join(BIN8_TO_BYTES[bits] for bits in token) for token in tokens) + table = _BIN8 + tokens = b' '.join(b''.join(table[b] for b in t) for t in tokens) elif groupsize: - tokens = b' '.join(hexlify(token[::-1] if endian else token, upper=upper) for token in tokens) + table = _HEX_UPPER if upper else _HEX_LOWER + if endian: + tokens = b' '.join(b''.join(table[b] for b in reversed(t)) for t in tokens) + else: + tokens = b' '.join(b''.join(table[b] for b in t) for t in tokens) else: - tokens = hexlify(*tokens, upper=upper) + table = _HEX_UPPER if upper else _HEX_LOWER + tokens = b' '.join(b''.join(table[b] for b in t) for t in tokens) # Comment text generation - text = humanize(chunk, HUMAN_EBCDIC if ebcdic else HUMAN_ASCII) + charset = CHAR_EBCDIC if ebcdic else CHAR_ASCII + text = bytes(charset[b] for b in chunk) # Line output line = line_fmt % (offset, tokens, text) diff --git a/tests/test_hexdump.py b/tests/test_hexdump.py index 9b0577d..e3bdcdd 100644 --- a/tests/test_hexdump.py +++ b/tests/test_hexdump.py @@ -45,6 +45,7 @@ def test_by_filename_hexdump(tmppath, datapath): for filename in test_filenames: filename = os.path.basename(filename) + print(filename) path_out = tmppath / filename path_ref = datapath / filename @@ -70,6 +71,7 @@ def test_by_filename_hd(tmppath, datapath): for filename in test_filenames: filename = os.path.basename(filename) + print(filename) path_out = tmppath / filename path_ref = datapath / filename diff --git a/tests/test_xxd.py b/tests/test_xxd.py index 013263e..0bf1937 100644 --- a/tests/test_xxd.py +++ b/tests/test_xxd.py @@ -63,12 +63,16 @@ def test_parse_seek(): assert parse_seek(None) == ('', 0) -def test_by_filename_xxd(tmppath, datapath): +def test_by_filename_text(tmppath, datapath): prefix = 'test_xxd_' - test_filenames = glob.glob(str(datapath / (prefix + '*.xxd'))) + test_filenames = glob.glob(str(datapath / (prefix + '*.c'))) + test_filenames += glob.glob(str(datapath / (prefix + '*.hexstr'))) + test_filenames += glob.glob(str(datapath / (prefix + '*.mot'))) + test_filenames += glob.glob(str(datapath / (prefix + '*.xxd'))) for filename in test_filenames: filename = os.path.basename(filename) + print(filename) path_out = tmppath / filename path_ref = datapath / filename @@ -87,12 +91,13 @@ def test_by_filename_xxd(tmppath, datapath): assert ans_out == ans_ref -def test_by_filename_bin(tmppath, datapath): +def test_by_filename_bytes(tmppath, datapath): prefix = 'test_xxd_' test_filenames = glob.glob(str(datapath / (prefix + '*.bin'))) for filename in test_filenames: filename = os.path.basename(filename) + print(filename) path_out = tmppath / filename path_ref = datapath / filename @@ -111,30 +116,6 @@ def test_by_filename_bin(tmppath, datapath): assert ans_out == ans_ref -def test_by_filename_c(tmppath, datapath): - prefix = 'test_xxd_' - test_filenames = glob.glob(str(datapath / (prefix + '*.c'))) - - for filename in test_filenames: - filename = os.path.basename(filename) - path_out = tmppath / filename - path_ref = datapath / filename - - cmdline = filename[len(prefix):].replace('_', ' ') - args = cmdline.split() - path_in = datapath / os.path.splitext(args[-1])[0] - args = ['xxd'] + args[:-1] + [str(path_in), str(path_out)] - - runner = CliRunner() - result = runner.invoke(_cast(Any, cli_main), args) - assert result.exit_code == 0 - - ans_out = read_text(path_out) - ans_ref = read_text(path_ref) - # if ans_out != ans_ref: raise AssertionError(str(path_ref)) - assert ans_out == ans_ref - - def test_xxd(datapath): with open(str(datapath / 'bytes.bin'), 'rb') as stream: data_in = memoryview(stream.read()) diff --git a/tests/test_xxd/holes.hexstr b/tests/test_xxd/holes.hexstr new file mode 100644 index 0000000..c6eabee --- /dev/null +++ b/tests/test_xxd/holes.hexstr @@ -0,0 +1,5 @@ +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>131415161718191a1b1c1d +1e1f--------------------------------303132333435363738393a3b +3c3d3e3f--------------------------------50515253545556575859 +5a5b5c5d5e5f--------------------------------7071727374757677 +78797a7b<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/tests/test_xxd/holes.mot b/tests/test_xxd/holes.mot new file mode 100644 index 0000000..9aeafdf --- /dev/null +++ b/tests/test_xxd/holes.mot @@ -0,0 +1,7 @@ +S0030000FC +S1100013131415161718191A1B1C1D1E1F97 +S1130030303132333435363738393A3B3C3D3E3F44 +S1130050505152535455565758595A5B5C5D5E5F24 +S10F0070707172737475767778797A7BFE +S5030004F8 +S9030000FC diff --git a/tests/test_xxd/test_xxd_-I_srec_holes.mot.xxd b/tests/test_xxd/test_xxd_-I_srec_holes.mot.xxd new file mode 100644 index 0000000..d43d502 --- /dev/null +++ b/tests/test_xxd/test_xxd_-I_srec_holes.mot.xxd @@ -0,0 +1,8 @@ +00000000: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>>>>>>>>>>>>> +00000010: >>>> >>13 1415 1617 1819 1a1b 1c1d 1e1f >>>............. +00000020: ---- ---- ---- ---- ---- ---- ---- ---- +00000030: 3031 3233 3435 3637 3839 3a3b 3c3d 3e3f 0123456789:;<=>? +00000040: ---- ---- ---- ---- ---- ---- ---- ---- +00000050: 5051 5253 5455 5657 5859 5a5b 5c5d 5e5f PQRSTUVWXYZ[\]^_ +00000060: ---- ---- ---- ---- ---- ---- ---- ---- +00000070: 7071 7273 7475 7677 7879 7a7b <<<< <<<< pqrstuvwxyz{<<<< diff --git a/tests/test_xxd/test_xxd_-p_-I_srec_holes.mot.hexstr b/tests/test_xxd/test_xxd_-p_-I_srec_holes.mot.hexstr new file mode 100644 index 0000000..b47bfcc --- /dev/null +++ b/tests/test_xxd/test_xxd_-p_-I_srec_holes.mot.hexstr @@ -0,0 +1,5 @@ +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>131415161718191a1b1c1d +1e1f--------------------------------303132333435363738393a3b +3c3d3e3f--------------------------------50515253545556575859 +5a5b5c5d5e5f--------------------------------7071727374757677 +78797a7b<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/tests/test_xxd/test_xxd_-r_-k_256_--no-seek-zeroes_-O_srec_bytes.xxd.mot b/tests/test_xxd/test_xxd_-r_-k_256_--no-seek-zeroes_-O_srec_bytes.xxd.mot new file mode 100644 index 0000000..8dffe7b --- /dev/null +++ b/tests/test_xxd/test_xxd_-r_-k_256_--no-seek-zeroes_-O_srec_bytes.xxd.mot @@ -0,0 +1,19 @@ +S0030000FC +S1130100000102030405060708090A0B0C0D0E0F73 +S1130110101112131415161718191A1B1C1D1E1F63 +S1130120202122232425262728292A2B2C2D2E2F53 +S1130130303132333435363738393A3B3C3D3E3F43 +S1130140404142434445464748494A4B4C4D4E4F33 +S1130150505152535455565758595A5B5C5D5E5F23 +S1130160606162636465666768696A6B6C6D6E6F13 +S1130170707172737475767778797A7B7C7D7E7F03 +S1130180808182838485868788898A8B8C8D8E8FF3 +S1130190909192939495969798999A9B9C9D9E9FE3 +S11301A0A0A1A2A3A4A5A6A7A8A9AAABACADAEAFD3 +S11301B0B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC3 +S11301C0C0C1C2C3C4C5C6C7C8C9CACBCCCDCECFB3 +S11301D0D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFA3 +S11301E0E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF93 +S11301F0F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF83 +S5030010EC +S9030000FC diff --git a/tests/test_xxd/test_xxd_-r_-p_-O_srec_holes.hexstr.mot b/tests/test_xxd/test_xxd_-r_-p_-O_srec_holes.hexstr.mot new file mode 100644 index 0000000..9aeafdf --- /dev/null +++ b/tests/test_xxd/test_xxd_-r_-p_-O_srec_holes.hexstr.mot @@ -0,0 +1,7 @@ +S0030000FC +S1100013131415161718191A1B1C1D1E1F97 +S1130030303132333435363738393A3B3C3D3E3F44 +S1130050505152535455565758595A5B5C5D5E5F24 +S10F0070707172737475767778797A7BFE +S5030004F8 +S9030000FC diff --git a/tests/test_xxd/test_xxd_-r_-p_-k_256_--no-seek-zeroes_-O_srec_bytes.hexstr.mot b/tests/test_xxd/test_xxd_-r_-p_-k_256_--no-seek-zeroes_-O_srec_bytes.hexstr.mot new file mode 100644 index 0000000..8dffe7b --- /dev/null +++ b/tests/test_xxd/test_xxd_-r_-p_-k_256_--no-seek-zeroes_-O_srec_bytes.hexstr.mot @@ -0,0 +1,19 @@ +S0030000FC +S1130100000102030405060708090A0B0C0D0E0F73 +S1130110101112131415161718191A1B1C1D1E1F63 +S1130120202122232425262728292A2B2C2D2E2F53 +S1130130303132333435363738393A3B3C3D3E3F43 +S1130140404142434445464748494A4B4C4D4E4F33 +S1130150505152535455565758595A5B5C5D5E5F23 +S1130160606162636465666768696A6B6C6D6E6F13 +S1130170707172737475767778797A7B7C7D7E7F03 +S1130180808182838485868788898A8B8C8D8E8FF3 +S1130190909192939495969798999A9B9C9D9E9FE3 +S11301A0A0A1A2A3A4A5A6A7A8A9AAABACADAEAFD3 +S11301B0B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC3 +S11301C0C0C1C2C3C4C5C6C7C8C9CACBCCCDCECFB3 +S11301D0D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFA3 +S11301E0E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF93 +S11301F0F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF83 +S5030010EC +S9030000FC