comparison tests/run-tests.py @ 46326:3e23794b9e1c

run-tests: work around the Windows firewall popup for server processes Windows doesn't have a `python3` executable, so cc0b332ab9fc 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 Differential Revision: https://phab.mercurial-scm.org/D9815
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 18 Jan 2021 00:50:01 -0500
parents 08fd76a553c9
children 85c0c7145f8e
comparison
equal deleted inserted replaced
46325:e5e6282fa66a 46326:3e23794b9e1c
3468 # child processes may race, which is harmless 3468 # child processes may race, which is harmless
3469 if err.errno != errno.EEXIST: 3469 if err.errno != errno.EEXIST:
3470 raise 3470 raise
3471 else: 3471 else:
3472 # Windows doesn't have `python3.exe`, and MSYS cannot understand the 3472 # Windows doesn't have `python3.exe`, and MSYS cannot understand the
3473 # reparse point with that name provided by Microsoft. Copy the 3473 # reparse point with that name provided by Microsoft. Create a
3474 # current interpreter to PATH with that name so the shebang lines 3474 # simple script on PATH with that name that delegates to the py3
3475 # work. 3475 # launcher so the shebang lines work.
3476 if os.getenv('MSYSTEM'): 3476 if os.getenv('MSYSTEM'):
3477 shutil.copy( 3477 with open(osenvironb[b'RUNTESTDIR'] + b'/python3', 'wb') as f:
3478 sys.executable, 3478 f.write(b'#!/bin/sh\n')
3479 _bytes2sys(self._tmpbindir + b'/python3.exe'), 3479 f.write(b'py -3 "$@"\n')
3480 )
3481 3480
3482 exedir, exename = os.path.split(sysexecutable) 3481 exedir, exename = os.path.split(sysexecutable)
3483 vlog( 3482 vlog(
3484 "# Modifying search path to find %s as %s in '%s'" 3483 "# Modifying search path to find %s as %s in '%s'"
3485 % (exename, pyexename, exedir) 3484 % (exename, pyexename, exedir)