I've commited the patch for blame_tests.py in 1876734. Thank you.
On 2020/04/19 22:53, Branko Čibej wrote:
> On 19.04.2020 14:47, Johan Corveleyn wrote:
>> Would you also have an idea on how to fix the PYTHONLEGACYWINDOWSSTDIO issue?
>> I mean: would it ever be possible to run the testsuite without
>> defining that envvar? Or will that remain necessary?
>
>
> Depending on how the testsuite is implemented, which I forget in detail,
> it might be. The os.dup2() method allows child processes to inherit the
> redirected standard handles. Reassigning os.stdout will not do that.
> There might be a way to maintain the inheritance behaviour by creating
> child processes differently.
Actually I tried the patch below (in FreeBSD), but it is not enogh.
Duplication of file descriptor is still needed. Output during test is
redirected to the log file, however the results of the tests written
in Python are not redirected.
[[[
Index: build/run_tests.py
===================================================================
--- build/run_tests.py (revision 1876712)
+++ build/run_tests.py (working copy)
@@ -847,10 +847,8 @@
sys.stdout.flush()
sys.stderr.flush()
self.log.flush()
- old_stdout = os.dup(sys.stdout.fileno())
- old_stderr = os.dup(sys.stderr.fileno())
- os.dup2(self.log.fileno(), sys.stdout.fileno())
- os.dup2(self.log.fileno(), sys.stderr.fileno())
+ old_stdout = sys.stdout
+ old_stderr = sys.stderr
# These have to be class-scoped for use in the progress_func()
self.dots_written = 0
@@ -867,7 +865,8 @@
if self.dots_written < dot_count:
dots_to_write = dots - self.dots_written
self.dots_written = dots
- os.write(old_stdout, b'.' * dots_to_write)
+ old_stdout.write('.' * dots_to_write)
+ old_stdout.flush()
self.progress_lock.release()
serial_only = hasattr(prog_mod, 'serial_only') and prog_mod.serial_only
@@ -886,7 +885,8 @@
test_selection=test_nums)
except svntest.Failure:
if self.log:
- os.write(old_stdout, b'.' * dot_count)
+ old_stdout.write('.' * dot_count)
+ old_stdout.flush()
failed = True
# restore some values
@@ -893,10 +893,8 @@
if self.log:
sys.stdout.flush()
sys.stderr.flush()
- os.dup2(old_stdout, sys.stdout.fileno())
- os.dup2(old_stderr, sys.stderr.fileno())
- os.close(old_stdout)
- os.close(old_stderr)
+ sys.stdout = old_stdout
+ sys.stderr = old_stderr
return failed
]]]
If reconstruction of _io._WindowsConsoleIO from stored old descripor is
allowed (i.e. documented in the specification), it seems to be possible
to write work around.
Cheers,
--
Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>/<futatuki_at_poem.co.jp>
Received on 2020-04-20 00:00:48 CEST