changeset 34953:0ccb43d4cf01 stable 4.4

test-dispatch: stabilize the test When cwd is removed and `hg` is executed, some shells may run `getcwd` before forking and executing, some may not do it, some may print a different error message. The test should be shell-independent so let's just avoid checking the error message. Differential Revision: https://phab.mercurial-scm.org/D1282
author Jun Wu <quark@fb.com>
date Wed, 01 Nov 2017 14:22:26 -0700
parents 05ebb553bd03
children 43d8e2fc1457
files tests/test-dispatch.t
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-dispatch.t	Wed Nov 01 15:34:22 2017 -0500
+++ b/tests/test-dispatch.t	Wed Nov 01 14:22:26 2017 -0700
@@ -68,9 +68,13 @@
   $ mkdir $TESTTMP/repo1
   $ cd $TESTTMP/repo1
   $ rm -rf $TESTTMP/repo1
-  $ HGDEMANDIMPORT=disable hg version -q
-  abort: error getting current working directory: * (glob) (no-chg !)
-  chg: abort: failed to getcwd (errno = *) (glob) (chg !)
-  [255]
+
+The output could be one of the following and something else:
+ chg: abort: failed to getcwd (errno = *) (glob)
+ abort: error getting current working directory: * (glob)
+ sh: 0: getcwd() failed: No such file or directory
+Since the exact behavior depends on the shell, only check it returns non-zero.
+  $ HGDEMANDIMPORT=disable hg version -q 2>/dev/null || false
+  [1]
 
 #endif