tests: make 'f' tool open files in binary mode when hexdumping

On Windows, the various bundle hexdumps were being truncated at the first
occurrence of 0x1a.  The line endings in the sequence generation then needs to
be standardized on LF so that the file is the same for the tool tests.
This commit is contained in:
Matt Harbison 2015-11-09 12:49:31 -05:00
parent b2610217fb
commit cbc163de28
2 changed files with 7 additions and 1 deletions

View File

@ -44,7 +44,7 @@ def visit(opts, filenames, outfile):
if opts.type:
facts.append('file')
if opts.hexdump or opts.dump or opts.md5:
content = file(f).read()
content = file(f, 'rb').read()
elif islink:
if opts.type:
facts.append('link')

View File

@ -43,7 +43,13 @@ Tests of the file helper tool
foo: mode=644
#endif
#if no-windows
$ python $TESTDIR/seq.py 10 > bar
#else
Convert CRLF -> LF for consistency
$ python $TESTDIR/seq.py 10 | sed "s/$//" > bar
#endif
#if unix-permissions symlink
$ chmod +x bar
$ f bar --newer foo --mode --type --size --dump --links --bytes 7