[PATCH] tests: make run-tests.py executable on Windows
Patrick Mézard
pmezard at gmail.com
Thu May 5 04:36:53 CDT 2011
Le 05/05/11 11:28, Friedrich, Anna-Christina a écrit :
>
> Now I understand your proposal.
> Yes, that's working fine and we avoid copying the replacement-loop.
> Do I have to submit a new patch?
Yes. But before that, could you address the other remarks I made in my first response (about the hg.bat content)?
> -----Original Message-----
> From: Patrick Mézard [mailto:pmezard at gmail.com]
> Sent: Donnerstag, 5. Mai 2011 11:00
> To: Friedrich, Anna-Christina
> Cc: Mercurial Devel
> Subject: Re: [PATCH] tests: make run-tests.py executable on Windows
>
> Le 05/05/11 10:47, Friedrich, Anna-Christina a écrit :
>> Do you mean set testtmp to e.g. "C:\Temp" ?
>> I don't think that's useful. Consider environment variable for
>> temporary files is set to something else than "C:\Temp".
>> It is not predictable whether the letters of pathname are upper or lower case.
>>
>> Maybe you mean something else?
>
> I suggest modifying the regular expression itself to make it case-insensitive. In windows case we would have (untested):
>
> ('(?i)' + re.escape(testtmp), '$TESTTMP'),
>
> instead of:
>
> (re.escape(testtmp), '$TESTTMP'),
>
> That way, the replace code is the same in both cases.
>
>
>
>> -----Original Message-----
>> From: Patrick Mézard [mailto:pmezard at gmail.com]
>> Sent: Donnerstag, 5. Mai 2011 10:32
>> To: Friedrich, Anna-Christina
>> Cc: Mercurial Devel
>> Subject: Re: [PATCH] tests: make run-tests.py executable on Windows
>>
>> Please keep the mailing-list in CC.
>>
>> Le 05/05/11 10:17, Friedrich, Anna-Christina a écrit :
>>> That's a problem on Windows:
>>> The temporary file in Python is written with lower case e.g. "c:\temp\".
>>> Output on Windows gives you upper case "C:\Temp\".
>>> Matching those is only possible while ignoring case.
>>>
>>> In order to not touch the Output in Linux, I just added this loop inside "system == nt" condition.
>>
>> Ok. If this is only related to temporary files, what do you think of fixing the regular expression itself in windows case right there:
>>
>>
>> http://hg.intevation.org/mercurial/crew/file/8468ec1109d1/tests/run-te
>> sts.py#l796
>>
>> ?
>>
>>> -----Original Message-----
>>> From: Patrick Mézard [mailto:pmezard at gmail.com]
>>> Sent: Donnerstag, 5. Mai 2011 10:10
>>> To: Friedrich, Anna-Christina
>>> Cc: mercurial-devel at selenic.com
>>> Subject: Re: [PATCH] tests: make run-tests.py executable on Windows
>>>
>>> Le 05/05/11 09:45, Friedrich, Anna-Christina a écrit :
>>>> # HG changeset patch
>>>> # User Anna Friedrich <anna-christina.friedrich at draeger.com
>>>> <mailto:anna-christina.friedrich at draeger.com>>
>>>> # Date 1304515012 -7200
>>>> # Node ID ec0a6fe1d001aeac0f05ce7cbce8ae36264d8bf7
>>>> # Parent 643b8212813e631b5525049fc4321a34a4def105
>>>> possible to run batch scripts in testsuite
>>>>
>>>> With those changes it is possible to run Batch-Tests on Windows, so
>>>> that tests run in the same environment as hg is used(i.e. cmd.exe).
>>>>
>>>>
>>>> diff -r 643b8212813e -r ec0a6fe1d001 contrib/win32/hg.bat
>>>> --- a/contrib/win32/hg.bat Wed Feb 16 15:02:30 2011 +0100
>>>> +++ b/contrib/win32/hg.bat Wed May 04 15:16:52 2011 +0200
>>>> @@ -8,5 +8,5 @@
>>>> rem install does not put python.exe on the PATH...
>>>> rem %~dp0 is the directory of this script
>>>>
>>>> -"%~dp0..\python" "%~dp0hg" %*
>>>> +"%~dp0\python" "%~dp0hg" %*
>>>
>>> Could you elaborate on this one?
>>>
>>> "hg.bat" is copied along with the hg script by setup.py, and I think they end up in pythonXX/scripts. In this case, the modified "%~dp0\python" no longer references the python executable in python/. Am I missing something?
>>>
>>>> endlocal
>>>> diff -r 643b8212813e -r ec0a6fe1d001 tests/run-tests.py
>>>> --- a/tests/run-tests.py Wed Feb 16 15:02:30 2011 +0100
>>>> +++ b/tests/run-tests.py Wed May 04 15:16:52 2011 +0200
>>>> @@ -344,8 +344,9 @@
>>>> os.symlink(sys.executable, mypython)
>>>> except AttributeError:
>>>> # windows fallback
>>>> - shutil.copyfile(sys.executable, mypython)
>>>> - shutil.copymode(sys.executable, mypython)
>>>> + mypythonexe = mypython + '.exe'
>>>> + shutil.copyfile(sys.executable, mypythonexe)
>>>> + shutil.copymode(sys.executable, mypythonexe)
>>>
>>> Looks right, I wonder if the first part of the function (with findprogram()) shouldn't be fixed as well.
>>>
>>>> def installhg(options):
>>>> vlog("# Performing temporary installation of HG") @@ -601,6
>>>> +602,8 @@
>>>> ret = fromchild.close()
>>>> if ret is None:
>>>> ret = 0
>>>> + for s, r in replacements:
>>>> + output = re.sub(s, r, output,flags=re.IGNORECASE)
>>>> else:
>>>> proc = Popen4(cmd)
>>>> def cleanup():
>>>
>>> Why is the replacement loop twenty lines below not good enough?
>>>
>>>> ---
>>>> This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
>>>
>>> I guess I should not have read all this
>>>
>>> --
>>> Patrick Mézard
>>>
>>
>>
>
>
More information about the Mercurial-devel
mailing list