changeset 26950:6686ae524f94

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 09 Nov 2015 12:49:31 -0500
parents b639b2f186bf
children af1ae4ee755c
files tests/f tests/test-tools.t
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/f	Thu Nov 12 14:29:02 2015 -0800
+++ b/tests/f	Mon Nov 09 12:49:31 2015 -0500
@@ -44,7 +44,7 @@
             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')
--- a/tests/test-tools.t	Thu Nov 12 14:29:02 2015 -0800
+++ b/tests/test-tools.t	Mon Nov 09 12:49:31 2015 -0500
@@ -43,7 +43,13 @@
   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