[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r27266 - trunk/subversion/tests/cmdline/svntest

From: Blair Zajac <blair_at_orcaware.com>
Date: 2007-10-18 03:33:06 CEST

David Glasser wrote:
> On 10/17/07, Blair Zajac <blair@orcaware.com> wrote:
>> glasser@tigris.org wrote:
>>> Author: glasser
>>> Date: Wed Oct 17 17:29:04 2007
>>> New Revision: 27266
>>>
>>> Log:
>>> Make sure we wait on the right PID in the test suite. Makes
>>> --parallel more stable.
>>>
>>> * subversion/tests/cmdline/svntest/main.py
>>> (): Instead of checking to see if we have os.wait, check to see if
>>> we have popen2.Popen3.
>>> (open_pipe): New function to replace calls to os.popen3; returns the
>>> three file descriptors and a token to pass to wait_on_pipe. On
>>> Unix this token is the Popen3 object and the command; on Windows it
>>> is None.
>>> (wait_on_pipe): New function; on Unix, waits on the provided Popen3
>>> object and deals with errors.
>>> (spawn_process): Use open_pipe and wait_on_pipe instead of os.popen3
>>> and dealing with wait itself.
>>> (copy_repos): Use open_pipe and wait_on_pipe instead of os.popen3
>>> and child endangerment.
>>>
>>>
>>> Modified:
>>> trunk/subversion/tests/cmdline/svntest/main.py
>>>
>>> Modified: trunk/subversion/tests/cmdline/svntest/main.py
>>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest/main.py?pathrev=27266&r1=27265&r2=27266
>>> ==============================================================================
>>> --- trunk/subversion/tests/cmdline/svntest/main.py (original)
>>> +++ trunk/subversion/tests/cmdline/svntest/main.py Wed Oct 17 17:29:04 2007
>>> @@ -94,12 +94,11 @@
>>> file_scheme_prefix = 'file://'
>>> _exe = ''
>>>
>>> -# os.wait() specifics
>>> try:
>>> - from os import wait
>>> - platform_with_os_wait = True
>>> + from popen2 import Popen3
>>> + platform_with_popen3_class = True
>>> except ImportError:
>>> - platform_with_os_wait = False
>>> + platform_with_popen3_class = False
>>>
>>> # The location of our mock svneditor script.
>>> if sys.platform == 'win32':
>>> @@ -300,6 +299,43 @@
>>> arg = arg.replace('$', '\$')
>>> return '"%s"' % (arg,)
>>>
>>> +def open_pipe(command, mode):
>>> + """Opens a popen3 pipe to COMMAND in MODE.
>>> +
>>> + Returns (infile, outfile, errfile, waiter); waiter
>>> + should be passed to wait_on_pipe."""
>>> + if platform_with_popen3_class:
>>> + kid = Popen3(command, True)
>>> + return kid.tochild, kid.fromchild, kid.childerr, (kid, command)
>>> + else:
>>> + inf, outf, errf = os.popen3(command, mode)
>>> + return inf, outf, errf, None
>>> +
>>> +def wait_on_pipe(waiter):
>>> + """Waits for KID (opened with open_pipe) to finish, dying
>>> + if it does. Returns kid's exit code."""
>>> + if waiter is None:
>>> + return
>> Even on Windows, don't you want to wait, even though you may pick up the wrong
>> PID? Better than leaving the child processes un-waited upon.
>
> I agree, but is this a regression? I thought (and the docs back me
> up) that windows didn't have os.wait and so the platform_has_os_wait
> blocks weren't being executed.

Oh, for some reason I thought Windows had os.wait().

> If people think it's OK to require Python 2.2 or 2.4 for the test
> suite we should jus use subprocess, which works on both platforms,
> though.

I like the idea. We should start a new thread to get a sign off and any
considerations on this.

Blair

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 18 03:33:48 2007

This is an archived mail posted to the Subversion Dev mailing list.