[PATCH] run-tests: fix b68a41420397 for Windows

Martin Geisler mg at aragost.com
Mon May 9 09:24:39 CDT 2011


Adrian Buehlmann <adrian at cadifra.com> writes:

> On 2011-05-09 15:26, Martin Geisler wrote:
>> Adrian Buehlmann <adrian at cadifra.com> writes:
>> 
>>> # HG changeset patch
>>> # User Adrian Buehlmann <adrian at cadifra.com>
>>> # Date 1304945704 -7200
>>> # Node ID e1d2a92f0e66d979143d27f272b753a7686c3729
>>> # Parent  abaf5a2982c36fe7e6992ebce6354a103375181f
>>> run-tests: fix b68a41420397 for Windows
>>>
>>> Before b68a41420397 it was at least possible to run things like
>>>
>>>   $ python run-tests.py test-check-code-hg.py
>>>   WARNING: Did not find prerequisite tool: gunzip.exe
>>>   .
>>>   # Ran 1 tests, 0 skipped, 0 failed.
>>>
>>> on Windows. Since b68a41420397 I now get:
>>>
>>>   $ python run-tests.py test-check-code-hg.py
>>>   Usage: run-tests.py [options] [tests]
>>>
>>>   run-tests.py: error: --shell must be executable
>>>
>>> This patch fixes it for me by bypassing the new check that was
>>> inserted with b68a41420397.
>>>
>>> diff --git a/tests/run-tests.py b/tests/run-tests.py
>>> --- a/tests/run-tests.py
>>> +++ b/tests/run-tests.py
>>> @@ -181,7 +181,7 @@
>>>          options.pure = True
>>>  
>>>      if not (os.path.isfile(options.shell) and
>>> -            os.access(options.shell, os.X_OK)):
>>> +            os.access(options.shell, os.X_OK) or os.name == 'nt'):
>>>          parser.error('--shell must be executable')
>> 
>> Could we instead provid a better default value for the shell on
>> Windows?
>> 
>> Before, "/bin/sh" was hard-coded and so I expect that nothing worked
>> anyway after the startup checks?
>
> It did work on Windows before your change, as I wrote in my change
> message. Did you read it?

Yes, of course I read it. Your commit message confused me: you show that
the startup tests can no longer be run and so I asked if you could run
anything else.

Now when I re-read your message, I see that you could indeed run a
Python-based test. Of course we should keep those working on Windows and
so the check I included is too restrictive.

I looked for a test that would exclude .t files on Windows in general,
but found none. If we want people to run the .t files on Windows, then I
think it's reasonable to also allow them to specify a shell.

But maybe we cannot check the --shell argument in a good way? If that is
what you're saying, then we'll of course disable the check on Windows.

> I have cygwin installed on Windows 7 here.
>
> $ python -c "import os; print os.path.isfile('/bin/sh')"
> False
>
> But
>
> $ /bin/sh
> sh-4.1$

Okay, so that shows that we cannot just use the Unix default on Windows,
even when running under Cygwin.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list