Submitter | Matt Harbison |
---|---|
Date | Dec. 3, 2017, 6:54 a.m. |
Message ID | <8e58a105a6fc156673e8.1512284095@Envy> |
Download | mbox | patch |
Permalink | /patch/25903/ |
State | Accepted |
Headers | show |
Comments
On Sun, 03 Dec 2017 01:54:55 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison <matt_harbison@yahoo.com> > # Date 1512261214 18000 > # Sat Dec 02 19:33:34 2017 -0500 > # Node ID 8e58a105a6fc156673e852ec9a40f2d517fc7ceb > # Parent c65000767eec5a1a159c73cd2fe7b6741a1dea84 > tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages > +# Various platform error strings, keyed on a common replacement string > +_errors = { > + br'$ENOENT$': ( > + # strerror() > + br'No such file or directory', > + > + # FormatMessage(ERROR_FILE_NOT_FOUND) > + br'The system cannot find the file specified', > + ), > +} > + > +for replace, msgs in _errors.items(): > + substitutions.extend((m, replace) for m in msgs) > diff --git a/tests/test-acl.t b/tests/test-acl.t > --- a/tests/test-acl.t > +++ b/tests/test-acl.t > @@ -925,7 +925,7 @@ > bundle2-input-bundle: 4 parts total > transaction abort! > rollback completed > - abort: No such file or directory: ../acl.config > + abort: $ENOENT$: ../acl.config IIRC, this sort of messages are locale dependent on Windows, and we can't easily switch the Windows locale. Foozy, can you test if this series works for you?
On Sun, 03 Dec 2017 03:59:37 -0500, Yuya Nishihara <yuya@tcha.org> wrote: > On Sun, 03 Dec 2017 01:54:55 -0500, Matt Harbison wrote: >> # HG changeset patch >> # User Matt Harbison <matt_harbison@yahoo.com> >> # Date 1512261214 18000 >> # Sat Dec 02 19:33:34 2017 -0500 >> # Node ID 8e58a105a6fc156673e852ec9a40f2d517fc7ceb >> # Parent c65000767eec5a1a159c73cd2fe7b6741a1dea84 >> tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages > >> +# Various platform error strings, keyed on a common replacement string >> +_errors = { >> + br'$ENOENT$': ( >> + # strerror() >> + br'No such file or directory', >> + >> + # FormatMessage(ERROR_FILE_NOT_FOUND) >> + br'The system cannot find the file specified', >> + ), >> +} >> + >> +for replace, msgs in _errors.items(): >> + substitutions.extend((m, replace) for m in msgs) >> diff --git a/tests/test-acl.t b/tests/test-acl.t >> --- a/tests/test-acl.t >> +++ b/tests/test-acl.t >> @@ -925,7 +925,7 @@ >> bundle2-input-bundle: 4 parts total >> transaction abort! >> rollback completed >> - abort: No such file or directory: ../acl.config >> + abort: $ENOENT$: ../acl.config > > IIRC, this sort of messages are locale dependent on Windows, and we can't > easily switch the Windows locale. I'm almost positive that's the case. A few years back, we had a bug where FormatMessage was defined to FormatMessageA, and was producing garbage for GetLastError() when a Japanese locale was used. But given that the error message in the test output is currently in plain English, it would seem that we are already limited to only certain locales? > Foozy, can you test if this series works for you?
On Sun, 03 Dec 2017 12:07:59 -0500, Matt Harbison wrote: > On Sun, 03 Dec 2017 03:59:37 -0500, Yuya Nishihara <yuya@tcha.org> wrote: > > > On Sun, 03 Dec 2017 01:54:55 -0500, Matt Harbison wrote: > >> # HG changeset patch > >> # User Matt Harbison <matt_harbison@yahoo.com> > >> # Date 1512261214 18000 > >> # Sat Dec 02 19:33:34 2017 -0500 > >> # Node ID 8e58a105a6fc156673e852ec9a40f2d517fc7ceb > >> # Parent c65000767eec5a1a159c73cd2fe7b6741a1dea84 > >> tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages > > > >> +# Various platform error strings, keyed on a common replacement string > >> +_errors = { > >> + br'$ENOENT$': ( > >> + # strerror() > >> + br'No such file or directory', > >> + > >> + # FormatMessage(ERROR_FILE_NOT_FOUND) > >> + br'The system cannot find the file specified', > >> + ), > >> +} > >> + > >> +for replace, msgs in _errors.items(): > >> + substitutions.extend((m, replace) for m in msgs) > >> diff --git a/tests/test-acl.t b/tests/test-acl.t > >> --- a/tests/test-acl.t > >> +++ b/tests/test-acl.t > >> @@ -925,7 +925,7 @@ > >> bundle2-input-bundle: 4 parts total > >> transaction abort! > >> rollback completed > >> - abort: No such file or directory: ../acl.config > >> + abort: $ENOENT$: ../acl.config > > > > IIRC, this sort of messages are locale dependent on Windows, and we can't > > easily switch the Windows locale. > > I'm almost positive that's the case. A few years back, we had a bug where > FormatMessage was defined to FormatMessageA, and was producing garbage for > GetLastError() when a Japanese locale was used. > > But given that the error message in the test output is currently in plain > English, it would seem that we are already limited to only certain locales? Okay, hope that is true. Queued, thanks.
Patch
diff --git a/tests/common-pattern.py b/tests/common-pattern.py --- a/tests/common-pattern.py +++ b/tests/common-pattern.py @@ -37,3 +37,17 @@ br' - - [$LOGDATE$] "GET' ), ] + +# Various platform error strings, keyed on a common replacement string +_errors = { + br'$ENOENT$': ( + # strerror() + br'No such file or directory', + + # FormatMessage(ERROR_FILE_NOT_FOUND) + br'The system cannot find the file specified', + ), +} + +for replace, msgs in _errors.items(): + substitutions.extend((m, replace) for m in msgs) diff --git a/tests/test-acl.t b/tests/test-acl.t --- a/tests/test-acl.t +++ b/tests/test-acl.t @@ -925,7 +925,7 @@ bundle2-input-bundle: 4 parts total transaction abort! rollback completed - abort: No such file or directory: ../acl.config + abort: $ENOENT$: ../acl.config no rollback information available 0:6675d58eff77 diff --git a/tests/test-addremove.t b/tests/test-addremove.t --- a/tests/test-addremove.t +++ b/tests/test-addremove.t @@ -31,8 +31,7 @@ $ hg forget foo $ hg -v addremove nonexistent - nonexistent: The system cannot find the file specified (windows !) - nonexistent: No such file or directory (no-windows !) + nonexistent: $ENOENT$ [1] $ cd .. @@ -86,8 +85,7 @@ $ rm c $ hg ci -A -m "c" nonexistent - nonexistent: The system cannot find the file specified (windows !) - nonexistent: No such file or directory (no-windows !) + nonexistent: $ENOENT$ abort: failed to mark all new/missing files as added/removed [255] diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -556,8 +556,8 @@ $ rm baz $ hg annotate -ncr "wdir()" baz - abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !) - abort: No such file or directory: $TESTTMP/repo/baz (no-windows !) + abort: $TESTTMP\repo\baz: $ENOENT$ (windows !) + abort: $ENOENT$: $TESTTMP/repo/baz (no-windows !) [255] annotate removed file @@ -565,8 +565,8 @@ $ hg rm baz $ hg annotate -ncr "wdir()" baz - abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !) - abort: No such file or directory: $TESTTMP/repo/baz (no-windows !) + abort: $TESTTMP\repo\baz: $ENOENT$ (windows !) + abort: $ENOENT$: $TESTTMP/repo/baz (no-windows !) [255] $ hg revert --all --no-backup --quiet diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t --- a/tests/test-dispatch.t +++ b/tests/test-dispatch.t @@ -87,8 +87,7 @@ [255] $ hg log -b --cwd=inexistent default - abort: No such file or directory: 'inexistent' (no-windows !) - abort: The system cannot find the file specified: 'inexistent' (windows !) + abort: $ENOENT$: 'inexistent' [255] $ hg log -b '--config=ui.traceback=yes' 2>&1 | grep '^Traceback' @@ -201,7 +200,7 @@ 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 + sh: 0: getcwd() failed: $ENOENT$ Since the exact behavior depends on the shell, only check it returns non-zero. $ HGDEMANDIMPORT=disable hg version -q 2>/dev/null || false [1] diff --git a/tests/test-extdata.t b/tests/test-extdata.t --- a/tests/test-extdata.t +++ b/tests/test-extdata.t @@ -88,8 +88,7 @@ $ mkdir sub $ cd sub $ hg log -qr "extdata(filedata)" - abort: error: The system cannot find the file specified (windows !) - abort: error: No such file or directory (no-windows !) + abort: error: $ENOENT$ [255] $ hg log -qr "extdata(shelldata)" 2:f6ed99a58333 diff --git a/tests/test-hgignore.t b/tests/test-hgignore.t --- a/tests/test-hgignore.t +++ b/tests/test-hgignore.t @@ -265,7 +265,7 @@ $ cp otherignore goodignore $ echo "include:badignore" >> otherignore $ hg status - skipping unreadable pattern file 'badignore': No such file or directory + skipping unreadable pattern file 'badignore': $ENOENT$ A dir/b.o $ mv goodignore otherignore diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t --- a/tests/test-histedit-arguments.t +++ b/tests/test-histedit-arguments.t @@ -354,7 +354,8 @@ $ mv ../corrupt-histedit .hg/histedit-state $ hg histedit --abort warning: encountered an exception during histedit --abort; the repository may not have been completely cleaned up - abort: .*(No such file or directory:|The system cannot find the file specified).* (re) + abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows !) + abort: $ENOENT$: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg (glob) (no-windows !) [255] Histedit state has been exited $ hg summary -q diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -685,7 +685,7 @@ $ hg up null loading update.ne hook failed: - abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py + abort: $ENOENT$: $TESTTMP/d/repo/nonexistent.py [255] $ hg id diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t --- a/tests/test-largefiles-update.t +++ b/tests/test-largefiles-update.t @@ -216,8 +216,7 @@ $ hg add --large largeY $ hg status -A large1 - large1: The system cannot find the file specified (windows !) - large1: No such file or directory (no-windows !) + large1: $ENOENT$ $ hg status -A large2 ? large2 @@ -309,8 +308,7 @@ rebasing 4:07d6153b5c04 "#4" (tip) $ hg status -A large1 - large1: The system cannot find the file specified (windows !) - large1: No such file or directory (no-windows !) + large1: $ENOENT$ $ hg status -A largeX C largeX @@ -320,8 +318,7 @@ $ hg transplant -q 1 4 $ hg status -A large1 - large1: The system cannot find the file specified (windows !) - large1: No such file or directory (no-windows !) + large1: $ENOENT$ $ hg status -A largeX C largeX @@ -331,8 +328,7 @@ $ hg transplant -q --merge 1 --merge 4 $ hg status -A large1 - large1: The system cannot find the file specified (windows !) - large1: No such file or directory (no-windows !) + large1: $ENOENT$ $ hg status -A largeX C largeX diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -1271,7 +1271,7 @@ $ rm .hg/unshelverebasestate $ hg unshelve --abort unshelve of 'default' aborted - abort: (No such file or directory|The system cannot find the file specified) (re) + abort: $ENOENT$ [255] Can the user leave the current state? $ hg up -C . diff --git a/tests/test-status-rev.t b/tests/test-status-rev.t --- a/tests/test-status-rev.t +++ b/tests/test-status-rev.t @@ -83,8 +83,7 @@ ! missing_missing_missing-tracked $ hg status -A --rev 1 'glob:missing_missing_missing-untracked' - missing_missing_missing-untracked: The system cannot find the file specified (windows !) - missing_missing_missing-untracked: No such file or directory (no-windows !) + missing_missing_missing-untracked: $ENOENT$ Status between first and second commit. Should ignore dirstate status. diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t +++ b/tests/test-subrepo-git.t @@ -640,9 +640,10 @@ traceback #if no-windows $ hg forget 'notafile*' - notafile*: No such file or directory + notafile*: $ENOENT$ [1] #else +error: The filename, directory name, or volume label syntax is incorrect $ hg forget 'notafile' notafile: * (glob) [1] diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t --- a/tests/test-subrepo-svn.t +++ b/tests/test-subrepo-svn.t @@ -571,15 +571,9 @@ Test forgetting files, not implemented in svn subrepo, used to traceback -#if no-windows $ hg forget 'notafile*' - notafile*: No such file or directory + notafile*: $ENOENT$ [1] -#else - $ hg forget 'notafile' - notafile: * (glob) - [1] -#endif Test a subrepo referencing a just moved svn path. Last commit rev will be different from the revision, and the path will be different as diff --git a/tests/test-walk.t b/tests/test-walk.t --- a/tests/test-walk.t +++ b/tests/test-walk.t @@ -378,7 +378,7 @@ f glob:glob glob:glob $ hg debugwalk glob:glob matcher: <patternmatcher patterns='(?:glob$)'> - glob: No such file or directory + glob: $ENOENT$ $ hg debugwalk glob:glob:glob matcher: <patternmatcher patterns='(?:glob\\:glob$)'> f glob:glob glob:glob exact