Environment to run tests in, changing file permissions on Cygwin
Dr Rainer Woitok
rainer.woitok at gmail.com
Fri Feb 12 13:12:11 UTC 2016
Greetings,
On Saturday, 2016-01-30 17:22:59 +0100, I myself wrote:
> ...
> The answer is in "posix.py" starting at line 290 or so:
>
> if sys.platform == 'cygwin':
> . . .
> # Cygwin translates native ACLs to POSIX permissions,
> # but these translations are not supported by native
> # tools, so the exec bit tends to be set erroneously.
> # Therefore, disable executable bit access on Cygwin.
> def checkexec(path):
> return False
>
> # Similarly, Cygwin's symlink emulation is likely to create
> # problems when Mercurial is used from both Cygwin and native
> # Windows, with other native tools, or on shared volumes
> def checklink(path):
> return False
> ...
>
> It's been three years now that I use a patch against "posix.py" which
> comments out exactly these last two lines above, because I desparately
> need symlink support in my Mercurial repositories. Up to now I cannot
> report any ill side effects. I'll probably just comment out the short-
> circuitted "checkexec" definition, too, and see what happens.
Meanwhile I've undone the shortcirquitting of function "checkexec" in
"posix.py", and again I cannot report any ill side effects. In order to
run the Mercurial test suite, however, I first had to patch "tests/run-
tests.py" to make the tests immune against the environment I force these
tests to run in:
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -759,6 +759,7 @@
env['TERM'] = 'xterm'
for k in ('HG HGPROF CDPATH GREP_OPTIONS http_proxy no_proxy ' +
+ 'HGPLAIN HGPLAINEXCEPT PS4 ' +
'NO_PROXY').split():
if k in env:
del env[k]
I then ran "make local" against my local Mercurial repository, but this
did not re-compile "tests/run-tests.pyc". Is this a bug or a feature?
Anyway, obviously "make TESTFLAGS=-l tests" ran the patched script "run-
tests.py", because I did not get the former errors caused by environment
variable "PS4" being set to "Trace:". In fact the first test "failure"
I got was "test-run-tests.t" immediately noticing that I had tinkered
with "run-tests.py" :-)
Most of the other test failures that came up seem harmless, as for inst-
ance:
--- /home/Rainer/repo/mercurial/tests/test-hgweb-commands.t
+++ /home/Rainer/repo/mercurial/tests/test-hgweb-commands.t.err
@@ -2213,9 +2213,9 @@
$ PATH_INFO=/bookmarks; export PATH_INFO
$ QUERY_STRING='style=raw'
$ python hgweb.cgi | grep -v ETag:
- Status: 200 Script output follows\r (esc)
- Content-Type: text/plain; charset=ascii\r (esc)
- \r (esc)
+ Status: 200 Script output follows
+ Content-Type: text/plain; charset=ascii
+
listbookmarks hides secret bookmarks
or
--- /home/Rainer/repo/mercurial/tests/test-convert-svn-source.t
+++ /home/Rainer/repo/mercurial/tests/test-convert-svn-source.t.err
@@ -28,10 +28,10 @@
$ cd ..
$ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | sort
-
- Adding projB/mytrunk (glob)
- Adding projB/tags (glob)
+ Adding projB/mytrunk
+ Adding projB/tags
Committed revision 1.
+ Committing transaction...
Update svn repository
More important is perhaps the following failure, because in this respect
Cygwin obviously behaves like Windows (the two "#if" clauses should thus
probably read "#if no-windows && no-cygwin" or whatever the precise syn-
tax is):
--- /home/Rainer/repo/mercurial/tests/test-hgignore.t
+++ /home/Rainer/repo/mercurial/tests/test-hgignore.t.err
@@ -60,6 +60,8 @@
$ touch 'foo#bar' 'quux#'
#if no-windows
$ touch 'baz\#wat'
+ touch: cannot touch 'baz\\#wat': No such file or directory
+ [1]
#endif
$ cat <<'EOF' >> .hgignore
> # full-line comment
@@ -76,6 +78,8 @@
$ rm 'foo#bar' 'quux#'
#if no-windows
$ rm 'baz\#wat'
+ rm: cannot remove 'baz\\#wat': No such file or directory
+ [1]
#endif
Check it does not ignore the current directory '.':
But I just have no idea what the following test failure really means,
and thus, whether or not I should worry:
--- /home/Rainer/repo/mercurial/tests/test-module-imports.t
+++ /home/Rainer/repo/mercurial/tests/test-module-imports.t.err
@@ -7,6 +7,19 @@
$ TERM=dumb
$ export TERM
$ python -m doctest $import_checker
+ **********************************************************************
+ File "/home/Rainer/repo/mercurial/tests/../contrib/import-checker.py", line 173, in import-checker.list_stdlib_modules
+ Failed example:
+ 'cStringIO' in mods
+ Expected:
+ True
+ Got:
+ False
+ **********************************************************************
+ 1 items had failures:
+ 1 of 6 in import-checker.list_stdlib_modules
+ ***Test Failed*** 1 failures.
+ [1]
Run additional tests for the import checker
@@ -142,5 +155,104 @@
these may expose other cycles.
$ hg locate 'mercurial/**.py' 'hgext/**.py' | sed 's-\\-/-g' | python "$import_checker" -
+ hgext/bugzilla.py:283: mixed imports
+ stdlib: re, urlparse, xmlrpclib
+ relative: time
+ hgext/convert/common.py:8: mixed imports
+ stdlib: base64, errno, os, re, subprocess
+ relative: datetime
+ hgext/convert/hg.py:21: mixed imports
+ stdlib: os
+ relative: cStringIO, time
+ hgext/gpg.py:8: mixed imports
+ stdlib: os, tempfile
+ relative: binascii
+ hgext/notify.py:136: mixed imports
+ stdlib: email, socket
+ relative: time
+ hgext/patchbomb.py:67: mixed imports
+ stdlib: errno, os, socket, tempfile
+ relative: cStringIO
+ hgext/zeroconf/__init__.py:27: mixed imports
+ stdlib: os, socket
+ relative: time
+ mercurial/archival.py:11: stdlib import follows local import: gzip
+ mercurial/archival.py:12: stdlib import follows local import: os
+ mercurial/archival.py:13: stdlib import follows local import: struct
+ mercurial/archival.py:14: stdlib import follows local import: tarfile
+ mercurial/archival.py:16: stdlib import follows local import: zipfile
+ mercurial/branchmap.py:11: stdlib import follows local import: struct
+ mercurial/cmdutil.py:10: mixed imports
+ stdlib: errno, os, re, sys, tempfile
+ relative: cStringIO
+ mercurial/commands.py:11: mixed imports
+ stdlib: difflib, errno, os, re, shlex, tempfile
+ relative: time
+ mercurial/commands.py:21: mixed imports
+ stdlib: random
+ relative: operator
+ mercurial/crecord.py:14: stdlib import follows local import: locale
+ mercurial/crecord.py:15: stdlib import follows local import: os
+ mercurial/crecord.py:16: stdlib import follows local import: re
+ mercurial/crecord.py:17: stdlib import follows local import: signal
+ mercurial/crecord.py:18: stdlib import follows local import: struct
+ mercurial/crecord.py:19: stdlib import follows local import: sys
+ mercurial/crecord.py:20: stdlib import follows local import: tempfile
+ mercurial/dispatch.py:21: stdlib import follows local import: traceback
+ mercurial/formatter.py:11: stdlib import follows local import: os
+ mercurial/help.py:11: stdlib import follows local import: os
+ mercurial/help.py:12: stdlib import follows local import: textwrap
+ mercurial/hgweb/protocol.py:11: stdlib import follows local import: cgi
+ mercurial/hgweb/protocol.py:12: stdlib import follows local import: urllib
+ mercurial/httpclient/__init__.py:45: stdlib import follows local import: errno
+ mercurial/httpclient/__init__.py:46: stdlib import follows local import: httplib
+ mercurial/httpclient/__init__.py:47: stdlib import follows local import: logging
+ mercurial/httpclient/__init__.py:48: stdlib import follows local import: rfc822
+ mercurial/httpclient/__init__.py:50: stdlib import follows local import: socket
+ mercurial/localrepo.py:15: stdlib import follows local import: urllib
+ mercurial/localrepo.py:16: stdlib import follows local import: weakref
+ mercurial/lock.py:15: stdlib import follows local import: warnings
+ mercurial/lsprof.py:4: stdlib import follows local import: sys
+ mercurial/manifest.py:11: stdlib import follows local import: heapq
+ mercurial/manifest.py:12: stdlib import follows local import: os
+ mercurial/manifest.py:13: stdlib import follows local import: struct
+ mercurial/pure/mpatch.py:11: stdlib import follows local import: struct
+ mercurial/pure/parsers.py:11: stdlib import follows local import: struct
+ mercurial/patch.py:12: stdlib import follows local import: collections
+ mercurial/patch.py:13: stdlib import follows local import: copy
+ mercurial/patch.py:14: stdlib import follows local import: email
+ mercurial/patch.py:15: stdlib import follows local import: errno
+ mercurial/patch.py:16: stdlib import follows local import: os
+ mercurial/patch.py:17: stdlib import follows local import: posixpath
+ mercurial/patch.py:18: stdlib import follows local import: re
+ mercurial/patch.py:19: stdlib import follows local import: shutil
+ mercurial/patch.py:20: stdlib import follows local import: tempfile
+ mercurial/posix.py:18: stdlib import follows local import: stat
+ mercurial/posix.py:19: stdlib import follows local import: sys
+ mercurial/posix.py:20: stdlib import follows local import: tempfile
+ mercurial/tags.py:16: stdlib import follows local import: errno
+ mercurial/templatefilters.py:14: stdlib import follows local import: urllib
+ mercurial/url.py:14: stdlib import follows local import: httplib
+ mercurial/url.py:15: stdlib import follows local import: os
+ mercurial/url.py:16: stdlib import follows local import: socket
+ mercurial/url.py:17: stdlib import follows local import: urllib
+ mercurial/url.py:18: stdlib import follows local import: urllib2
+ mercurial/util.py:19: stdlib import follows local import: calendar
+ mercurial/util.py:20: stdlib import follows local import: collections
+ mercurial/util.py:22: stdlib import follows local import: errno
+ mercurial/util.py:23: stdlib import follows local import: gc
+ mercurial/util.py:24: stdlib import follows local import: hashlib
+ mercurial/util.py:25: stdlib import follows local import: imp
+ mercurial/util.py:26: stdlib import follows local import: os
+ mercurial/util.py:27: stdlib import follows local import: re
+ mercurial/util.py:28: stdlib import follows local import: shutil
+ mercurial/util.py:29: stdlib import follows local import: signal
+ mercurial/util.py:30: stdlib import follows local import: socket
+ mercurial/util.py:31: stdlib import follows local import: subprocess
+ mercurial/util.py:32: stdlib import follows local import: sys
+ mercurial/util.py:33: stdlib import follows local import: tempfile
+ mercurial/util.py:34: stdlib import follows local import: textwrap
+ mercurial/util.py:36: stdlib import follows local import: traceback
+ mercurial/util.py:37: stdlib import follows local import: urllib
Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
[1]
ERROR: test-module-imports.t output changed
Neither do I have any idea as to what to make of this one:
--- /home/Rainer/repo/mercurial/tests/test-subrepo-missing.t
+++ /home/Rainer/repo/mercurial/tests/test-subrepo-missing.t.err
@@ -64,8 +64,12 @@
$ hg up 0
remote changed .hgsubstate which local deleted
use (c)hanged version or leave (d)eleted? c
+ subrepository subrepo diverged (local revision: , remote revision: 07f494440405)
+ (M)erge, keep (l)ocal or keep (r)emote? m
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg st
+ M .hgsubstate
$ ls subrepo
a
ERROR: test-subrepo-missing.t output changed
The last failure found by the test suite is again Cygwin specific, and
these tests sould probably be grouped along the lines "#if no-root &&
no-cygwin" versus "#if root || cygwin" here:
--- /home/Rainer/repo/mercurial/tests/test-serve.t
+++ /home/Rainer/repo/mercurial/tests/test-serve.t.err
@@ -48,8 +48,7 @@
#if no-root
$ KILLQUIETLY=Y
$ hgserve -p daytime
- abort: cannot start server at 'localhost:13': Permission denied
- abort: child process failed to start
+ listening at http://localhost/ (bound to 127.0.0.1:13)
% errors
$ KILLQUIETLY=N
#endif
ERROR: test-serve.t output changed
Sincerely,
Rainer
More information about the Mercurial
mailing list