changeset 50292:adecb1ab4a0d stable

tests: add a rewriting step to detect EACCES errors
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Fri, 10 Mar 2023 18:20:19 +0000
parents 862969b6c359
children f1f3a8eb93a1
files tests/common-pattern.py tests/test-blackbox.t tests/test-clone.t tests/test-convert.t tests/test-hgrc.t tests/test-journal-exists.t tests/test-lock-badness.t tests/test-permissions.t tests/test-repair-strip.t tests/test-ssh-bundle1.t tests/test-ssh-repoerror.t tests/test-ssh.t tests/test-status.t tests/test-template-map.t
diffstat 14 files changed, 30 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/tests/common-pattern.py	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/common-pattern.py	Fri Mar 10 18:20:19 2023 +0000
@@ -136,6 +136,11 @@
         # 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',
--- a/tests/test-blackbox.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-blackbox.t	Fri Mar 10 18:20:19 2023 +0000
@@ -322,8 +322,8 @@
 #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
--- a/tests/test-clone.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-clone.t	Fri Mar 10 18:20:19 2023 +0000
@@ -633,7 +633,7 @@
   $ 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 @@
   $ hg init b
   $ cd b
   $ hg clone . ../a
-  abort: Permission denied: *../a* (glob)
+  abort: $EACCES$: *../a* (glob)
   [255]
   $ cd ..
   $ chmod 700 a
--- a/tests/test-convert.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-convert.t	Fri Mar 10 18:20:19 2023 +0000
@@ -468,7 +468,7 @@
   $ chmod 000 bogusdir
 
   $ hg convert a bogusdir
-  abort: Permission denied: *bogusdir* (glob)
+  abort: $EACCES$: *bogusdir* (glob)
   [255]
 
 user permissions should succeed
--- a/tests/test-hgrc.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-hgrc.t	Fri Mar 10 18:20:19 2023 +0000
@@ -59,7 +59,7 @@
 #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
 
--- a/tests/test-journal-exists.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-journal-exists.t	Fri Mar 10 18:20:19 2023 +0000
@@ -47,7 +47,7 @@
 
   $ 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
--- a/tests/test-lock-badness.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-lock-badness.t	Fri Mar 10 18:20:19 2023 +0000
@@ -135,7 +135,7 @@
   $ 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
--- a/tests/test-permissions.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-permissions.t	Fri Mar 10 18:20:19 2023 +0000
@@ -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
--- a/tests/test-repair-strip.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-repair-strip.t	Fri Mar 10 18:20:19 2023 +0000
@@ -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
--- a/tests/test-ssh-bundle1.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-ssh-bundle1.t	Fri Mar 10 18:20:19 2023 +0000
@@ -403,9 +403,9 @@
   $ 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]
--- a/tests/test-ssh-repoerror.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-ssh-repoerror.t	Fri Mar 10 18:20:19 2023 +0000
@@ -13,7 +13,7 @@
   $ 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 @@
   > 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 @@
   $ 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]
 
--- a/tests/test-ssh.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-ssh.t	Fri Mar 10 18:20:19 2023 +0000
@@ -456,7 +456,7 @@
   $ 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]
--- a/tests/test-status.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-status.t	Fri Mar 10 18:20:19 2023 +0000
@@ -849,7 +849,7 @@
 
   $ chmod 0 subdir
   $ hg status --include subdir
-  subdir: Permission denied
+  subdir: $EACCES$
   R subdir/removed
   ! subdir/clean
   ! subdir/deleted
--- a/tests/test-template-map.t	Tue Mar 07 03:42:40 2023 +0100
+++ b/tests/test-template-map.t	Fri Mar 10 18:20:19 2023 +0000
@@ -1260,7 +1260,7 @@
   $ touch q
   $ chmod 0 q
   $ hg log --style ./q
-  abort: Permission denied: './q'
+  abort: $EACCES$: './q'
   [255]
 #endif
 
@@ -1309,7 +1309,7 @@
   $ 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