# HG changeset patch # User Arseniy Alekseyev # Date 2023-03-10 18:20:19 # Node ID adecb1ab4a0d5db96a53929818ad428719eaae8b # Parent 862969b6c3594bf349fce11b61f23c221ff0718a tests: add a rewriting step to detect EACCES errors diff --git a/tests/common-pattern.py b/tests/common-pattern.py --- a/tests/common-pattern.py +++ b/tests/common-pattern.py @@ -136,6 +136,11 @@ substitutions = [ # FormatMessage(ERROR_FILE_NOT_FOUND) br'The system cannot find the file specified', ), + br'$EACCES$': ( + br'Permission denied \(os error 13\)', + # strerror + br'Permission denied', + ), br'$ENOTDIR$': ( # strerror() br'Not a directory', diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t --- a/tests/test-blackbox.t +++ b/tests/test-blackbox.t @@ -322,8 +322,8 @@ Skip rotation if the .hg is read-only #if unix-permissions $ chmod -w .hg $ hg log -r. -T '{rev}\n' --config blackbox.maxsize=1 --debug - warning: cannot rename '$TESTTMP/blackboxtest3/.hg/blackbox.log.1' to '$TESTTMP/blackboxtest3/.hg/blackbox.log': Permission denied - warning: cannot write to blackbox.log: Permission denied + warning: cannot rename '$TESTTMP/blackboxtest3/.hg/blackbox.log.1' to '$TESTTMP/blackboxtest3/.hg/blackbox.log': $EACCES$ + warning: cannot write to blackbox.log: $EACCES$ 1 $ chmod +w .hg #endif diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -633,7 +633,7 @@ Inaccessible source $ mkdir a $ chmod 000 a $ hg clone a b - abort: Permission denied: *$TESTTMP/fail/a/.hg* (glob) + abort: $EACCES$: *$TESTTMP/fail/a/.hg* (glob) [255] Inaccessible destination @@ -641,7 +641,7 @@ Inaccessible destination $ hg init b $ cd b $ hg clone . ../a - abort: Permission denied: *../a* (glob) + abort: $EACCES$: *../a* (glob) [255] $ cd .. $ chmod 700 a diff --git a/tests/test-convert.t b/tests/test-convert.t --- a/tests/test-convert.t +++ b/tests/test-convert.t @@ -468,7 +468,7 @@ conversion to dir without permissions sh $ chmod 000 bogusdir $ hg convert a bogusdir - abort: Permission denied: *bogusdir* (glob) + abort: $EACCES$: *bogusdir* (glob) [255] user permissions should succeed diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t --- a/tests/test-hgrc.t +++ b/tests/test-hgrc.t @@ -59,7 +59,7 @@ Check %include #if unix-permissions no-root $ chmod u-r $TESTTMP/included $ hg showconfig section - config error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied*) (glob) + config error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included ($EACCES$*) (glob) [255] #endif diff --git a/tests/test-journal-exists.t b/tests/test-journal-exists.t --- a/tests/test-journal-exists.t +++ b/tests/test-journal-exists.t @@ -47,7 +47,7 @@ Check that zero-size journals are correc $ hg -R foo unbundle repo.hg adding changesets - abort: Permission denied: '$TESTTMP/repo/foo/.hg/store/.00changelog.i-*' (glob) + abort: $EACCES$: '$TESTTMP/repo/foo/.hg/store/.00changelog.i-*' (glob) [255] $ if test -f foo/.hg/store/journal; then echo 'journal exists :-('; fi diff --git a/tests/test-lock-badness.t b/tests/test-lock-badness.t --- a/tests/test-lock-badness.t +++ b/tests/test-lock-badness.t @@ -135,7 +135,7 @@ Pushing to a local read-only repo that c $ hg -R b push a pushing to a searching for changes - abort: could not lock repository a: Permission denied + abort: could not lock repository a: $EACCES$ [20] $ chmod 700 a/.hg/store diff --git a/tests/test-permissions.t b/tests/test-permissions.t --- a/tests/test-permissions.t +++ b/tests/test-permissions.t @@ -24,7 +24,7 @@ $ chmod -r .hg/store/data/a.i $ hg verify -q - abort: Permission denied: '$TESTTMP/t/.hg/store/data/a.i' + abort: $EACCES$: '$TESTTMP/t/.hg/store/data/a.i' [255] $ chmod +r .hg/store/data/a.i @@ -36,7 +36,7 @@ $ echo barber > a $ hg commit -m "2" trouble committing a! - abort: Permission denied: '$TESTTMP/t/.hg/store/data/a.i' + abort: $EACCES$: '$TESTTMP/t/.hg/store/data/a.i' [255] $ chmod -w . @@ -64,7 +64,7 @@ (fsmonitor makes "hg status" avoid accessing to "dir") $ hg status - dir: Permission denied* (glob) + dir: $EACCES$* (glob) M a #endif diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t --- a/tests/test-repair-strip.t +++ b/tests/test-repair-strip.t @@ -53,9 +53,9 @@ transaction abort! failed to truncate data/b.i rollback failed - please run hg recover - (failure reason: [Errno *] Permission denied .hg/store/data/b.i') (glob) + (failure reason: [Errno *] $EACCES$ .hg/store/data/b.i') (glob) strip failed, backup bundle - abort: Permission denied .hg/store/data/b.i' + abort: $EACCES$ .hg/store/data/b.i' % after update 0, strip 2 abandoned transaction found - run hg recover checking changesets @@ -89,7 +89,7 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: a - abort: Permission denied .hg/store/data/b.i' + abort: $EACCES$ .hg/store/data/b.i' % after update 0, strip 2 checking changesets checking manifests @@ -110,9 +110,9 @@ transaction abort! failed to truncate 00manifest.i rollback failed - please run hg recover - (failure reason: [Errno *] Permission denied .hg/store/00manifest.i') (glob) + (failure reason: [Errno *] $EACCES$ .hg/store/00manifest.i') (glob) strip failed, backup bundle - abort: Permission denied .hg/store/00manifest.i' + abort: $EACCES$ .hg/store/00manifest.i' % after update 0, strip 2 abandoned transaction found - run hg recover checking changesets diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -403,9 +403,9 @@ Test hg-ssh in read-only mode: $ hg push --ssh "sh ../ssh.sh" pushing to ssh://user@dummy/*/remote (glob) searching for changes - remote: Permission denied + remote: $EACCES$ remote: abort: pretxnopen.hg-ssh hook failed - remote: Permission denied + remote: $EACCES$ remote: pushkey-abort: prepushkey.hg-ssh hook failed updating 6c0482d977a3 to public failed! [1] diff --git a/tests/test-ssh-repoerror.t b/tests/test-ssh-repoerror.t --- a/tests/test-ssh-repoerror.t +++ b/tests/test-ssh-repoerror.t @@ -13,7 +13,7 @@ repository itself is non-readable $ chmod a-rx no-read $ hg id ssh://user@dummy/no-read - remote: abort: Permission denied: *$TESTTMP/no-read/.hg* (glob) + remote: abort: $EACCES$: *$TESTTMP/no-read/.hg* (glob) abort: no suitable response from remote hg [255] @@ -31,7 +31,7 @@ seems an unexpected case in real life, b > done $ hg id ssh://user@dummy/other - remote: abort: Permission denied: '$TESTTMP/other/.hg/requires' + remote: abort: $EACCES$: '$TESTTMP/other/.hg/requires' abort: no suitable response from remote hg [255] @@ -47,7 +47,7 @@ directory toward the repository is read $ chmod a-rx deep $ hg id ssh://user@dummy/deep/nested - remote: abort: Permission denied: *$TESTTMP/deep/nested/.hg* (glob) + remote: abort: $EACCES$: *$TESTTMP/deep/nested/.hg* (glob) abort: no suitable response from remote hg [255] diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -456,7 +456,7 @@ Test hg-ssh in read-only mode: $ hg push --ssh "sh ../ssh.sh" pushing to ssh://user@dummy/*/remote (glob) searching for changes - remote: Permission denied + remote: $EACCES$ remote: pretxnopen.hg-ssh hook failed abort: push failed on remote [100] diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -849,7 +849,7 @@ entirely: $ chmod 0 subdir $ hg status --include subdir - subdir: Permission denied + subdir: $EACCES$ R subdir/removed ! subdir/clean ! subdir/deleted diff --git a/tests/test-template-map.t b/tests/test-template-map.t --- a/tests/test-template-map.t +++ b/tests/test-template-map.t @@ -1260,7 +1260,7 @@ Error if style not readable: $ touch q $ chmod 0 q $ hg log --style ./q - abort: Permission denied: './q' + abort: $EACCES$: './q' [255] #endif @@ -1309,7 +1309,7 @@ Error if include fails: $ echo 'changeset = q' >> t #if unix-permissions no-root $ hg log --style ./t - abort: template file ./q: Permission denied + abort: template file ./q: $EACCES$ [255] $ rm -f q #endif