[Request] [+ ] D9815: run-tests: work around the Windows firewall popup for server processes
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Mon Jan 18 06:45:47 UTC 2021
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Windows doesn't have a `python3` executable, so cc0b332ab9fc <https://phab.mercurial-scm.org/rHGcc0b332ab9fc60aeda2a4b52b1ff8f5dd41376b1> attempted to work
around the issue by copying the current python to `python3.exe`. That put it in
`_tmpbindir` because of failures in `test-run-tests.t` when using `_bindir`,
which looked like a process was trying to open it to write out a copy while it
was in use. (Interestingly, I couldn't reproduce this running the test by
itself in a loop for a couple of hours, but it happens constantly when running
all tests.) The problem with using `_tmpbindir` is that it is the randomly
generated path for the test run, and instead of Windows Firewall remembering the
executable signature or image hash when allowing the process to open a server
port, it apparently remembers the image path. That means every run will trigger
a popup to allow it, which is bad for firing off a test run and walking away.
I tried to symlink to the python executable, but that currently requires admin
priviledges[1]. This will prompt the first time if the underlying python binary
has never opened a server port, but appears to avoid it on subsequent runs.
[1] https://bugs.python.org/issue40687
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9815
AFFECTED FILES
.hgignore
tests/run-tests.py
CHANGE DETAILS
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3470,14 +3470,13 @@
raise
else:
# Windows doesn't have `python3.exe`, and MSYS cannot understand the
- # reparse point with that name provided by Microsoft. Copy the
- # current interpreter to PATH with that name so the shebang lines
- # work.
+ # reparse point with that name provided by Microsoft. Create a
+ # simple script on PATH with that name that delegates to the py3
+ # launcher so the shebang lines work.
if os.getenv('MSYSTEM'):
- shutil.copy(
- sys.executable,
- _bytes2sys(self._tmpbindir + b'/python3.exe'),
- )
+ with open(osenvironb[b'RUNTESTDIR'] + b'/python3', 'wb') as f:
+ f.write(b'#!/bin/sh\n')
+ f.write(b'py -3 "$@"\n')
exedir, exename = os.path.split(sysexecutable)
vlog(
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -26,6 +26,7 @@
tests/hypothesis-generated
tests/annotated
tests/exceptions
+tests/python3
tests/*.err
tests/htmlcov
build
To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210118/98920033/attachment.html>
More information about the Mercurial-patches
mailing list