Patchwork [1,of,4,evolve-ext] tests: make tests work on Mac OS

login
register
mail settings
Submitter Laurent Charignon
Date April 3, 2015, 2:09 a.m.
Message ID <3a9143852da729fb8c01.1428026995@lcharignon-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/8465/
State Accepted
Headers show

Comments

Laurent Charignon - April 3, 2015, 2:09 a.m.
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com>
# Date 1428014651 25200
#      Thu Apr 02 15:44:11 2015 -0700
# Node ID 3a9143852da729fb8c0183ca5bbce2009ea02f8b
# Parent  ffa32ca659f1eb26e0f67e68f698837766819c3f
tests: make tests work on Mac OS

wc -m adds spacing before the results, we trim them to make the test pass on
Mac OS.
Jordi GutiƩrrez Hermoso - April 3, 2015, 6:28 p.m.
On Thu, 2015-04-02 at 19:09 -0700, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1428014651 25200
> #      Thu Apr 02 15:44:11 2015 -0700
> # Node ID 3a9143852da729fb8c0183ca5bbce2009ea02f8b
> # Parent  ffa32ca659f1eb26e0f67e68f698837766819c3f
> tests: make tests work on Mac OS
> 
> wc -m adds spacing before the results, we trim them to make the test pass on
> Mac OS.
[snip]
> -  $ wc -m .hg/store/obsinhibit
> +  $ wc -m .hg/store/obsinhibit | sed -e 's/^[ \t]*//'

The usual way to deal with slight variations in output is by globbing
or regexing on the output, e.g. from test-setdiscovery:

  $ hg heads -t --template . | wc -c
  \s*261 (re)
Pierre-Yves David - April 3, 2015, 6:41 p.m.
On 04/02/2015 07:09 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon@fb.com>
> # Date 1428014651 25200
> #      Thu Apr 02 15:44:11 2015 -0700
> # Node ID 3a9143852da729fb8c0183ca5bbce2009ea02f8b
> # Parent  ffa32ca659f1eb26e0f67e68f698837766819c3f
> tests: make tests work on Mac OS

That first one is pushed to main, Thanks.

Patch

diff --git a/tests/test-inhibit.t b/tests/test-inhibit.t
--- a/tests/test-inhibit.t
+++ b/tests/test-inhibit.t
@@ -132,12 +132,12 @@ 
 check public revision got cleared
 (when adding the second inhibitor, the first one is removed because it is public)
 
-  $ wc -m .hg/store/obsinhibit
+  $ wc -m .hg/store/obsinhibit | sed -e 's/^[ \t]*//'
   20 .hg/store/obsinhibit
   $ hg prune 7
   1 changesets pruned
   $ hg debugobsinhibit --hidden 18214586bf78
-  $ wc -m .hg/store/obsinhibit
+  $ wc -m .hg/store/obsinhibit | sed -e 's/^[ \t]*//'
   20 .hg/store/obsinhibit
   $ hg log -G
   @  9:55c73a90e4b4 add cJ
@@ -158,7 +158,7 @@ 
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   working directory now at cf5c4f4554ce
   $ hg debugobsinhibit --hidden 55c73a90e4b4
-  $ wc -m .hg/store/obsinhibit
+  $ wc -m .hg/store/obsinhibit | sed -e 's/^[ \t]*//'
   20 .hg/store/obsinhibit
   $ hg log -G
   o  9:55c73a90e4b4 add cJ