Patchwork D1126: test-dispatch: make the test compatible with chg

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2017, 11:52 p.m.
Message ID <differential-rev-PHID-DREV-ir24c3ycttcm74yqouij-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25037/
State Superseded
Headers show

Comments

phabricator - Oct. 16, 2017, 11:52 p.m.
singhsrb created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The test is broken when run with chg because it prints a different
  error message when chg is running. This commit fixes the test by special casing
  for chg.

TEST PLAN
  Ran the test 'test-dispatch.t' with and without '--chg' option.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-dispatch.t

CHANGE DETAILS




To: singhsrb, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 16, 2017, 11:56 p.m.
quark requested changes to this revision.
quark added a comment.
This revision now requires changes to proceed.


  Just a small nit.

INLINE COMMENTS

> test-dispatch.t:77
>    $ HGDEMANDIMPORT=disable hg version -q
>    abort: error getting current working directory: * (glob)
>    [255]

Alternatively, you can use individual line matching without duplicating the `hg version` line:

  abort: error getting current working directory: * (glob) (no-chg !)
  chg: abort: failed to getcwd (errno = *) (glob) (chg !)

> test-dispatch.t:85
> +  $ HGDEMANDIMPORT=disable hg version -q
> +  chg: abort: failed to getcwd (errno = 2, No such file or directory)
> +  [255]

`errno` and error message could be platform dependent:

  chg: ... (errno = *) (glob)

REPOSITORY
  rHG Mercurial

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

To: singhsrb, #hg-reviewers, quark
Cc: quark, mercurial-devel
phabricator - Oct. 17, 2017, 12:10 a.m.
singhsrb added inline comments.

INLINE COMMENTS

> quark wrote in test-dispatch.t:77
> Alternatively, you can use individual line matching without duplicating the `hg version` line:
> 
>   abort: error getting current working directory: * (glob) (no-chg !)
>   chg: abort: failed to getcwd (errno = *) (glob) (chg !)

That certainly seems like a better approach. Thanks!

> quark wrote in test-dispatch.t:85
> `errno` and error message could be platform dependent:
> 
>   chg: ... (errno = *) (glob)

Hmmm, didn't consider that. Thanks!

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -68,8 +68,21 @@ 
   $ mkdir $TESTTMP/repo1
   $ cd $TESTTMP/repo1
   $ rm -rf $TESTTMP/repo1
+
+#endif
+
+#if rmcwd no-chg
+
   $ HGDEMANDIMPORT=disable hg version -q
   abort: error getting current working directory: * (glob)
   [255]
 
 #endif
+
+#if rmcwd chg
+
+  $ HGDEMANDIMPORT=disable hg version -q
+  chg: abort: failed to getcwd (errno = 2, No such file or directory)
+  [255]
+
+#endif