tests: use Python to write binary data in lfs test instead of shell
authorAugie Fackler <raf@durin42.com>
Sat, 09 Dec 2017 19:42:51 -0600
changeset 35376 c7d49b87c1ee
parent 35375 ea645c6c6d46
child 35377 c0b6fa74e007
tests: use Python to write binary data in lfs test instead of shell The shell construct here appears to be unevenly supported: it works in /bin/sh on FreeBSD, but it doesn't seem to work when /bin/sh is dash. Using a Python inline directive works fine, so let's just do that instead. Differential Revision: https://phab.mercurial-scm.org/D1636
tests/test-lfs.t
--- a/tests/test-lfs.t	Sun Dec 10 05:41:05 2017 +0530
+++ b/tests/test-lfs.t	Sat Dec 09 19:42:51 2017 -0600
@@ -232,9 +232,10 @@
   $ hg mv b1 a2
   $ hg commit -m b
   $ hg status
-  $ HEADER=$'\1\n'
-  $ printf '%sSTART-WITH-HG-FILELOG-METADATA' "$HEADER" > a2
-  $ printf '%sMETA\n' "$HEADER" > a1
+  >>> with open('a2', 'wb') as f:
+  ...     f.write(b'\1\nSTART-WITH-HG-FILELOG-METADATA')
+  >>> with open('a1', 'wb') as f:
+  ...     f.write(b'\1\nMETA\n')
   $ hg commit -m meta
   $ hg status
   $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'