D1282: test-dispatch: stabilize the test

quark (Jun Wu) phabricator at mercurial-scm.org
Wed Nov 1 17:25:10 EDT 2017


quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1282

AFFECTED FILES
  tests/test-dispatch.t

CHANGE DETAILS

diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -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



To: quark, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list