tests fail because largefile writes path different on windows
Simon Heimberg
simohe at besonet.ch
Mon Jan 20 01:59:44 CST 2014
--On 19. Januar 2014 23:15 -0600 Matt Mackall <mpm at selenic.com> wrote:
> On Fri, 2014-01-17 at 19:12 +0100, Simon Heimberg wrote:
>> Does anybody know why largefile writes file:// with two slashes on linux
>> but three slashes (file:///) on windows? From a failing result on
>> buildbot [1]:
>>
>> linux: file://$TESTTMP ( file://$TESTTMP/d )
>> windows: file:///$TESTTMP ( file:///$TESTTMP\d, the \ is handled by
>> glob )
>>
>> Do we care about two or three slashes?
>> So should we fix the expected test result (with a pattern) or the output
>> of largefile?
>
> This should probably be made to match. It should be two slashes?
After thinking once more:
It should be three slashes (because there is no hostname in the file url
[1]).
And there always _are_ three slashes. On linux, $TESTTMP starts with one
slash (/tmp/xxx), on windows it does not (C:\users\xxx). So the output is
correct, we should adapt the matching of the test result.
I propose to replace
large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available
from file://$TESTTMP/d (glob)
with re matching
large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available
from file:///?\$TESTTMP[/\\]d (re)
Then we also match backslash on linux. (This is handled os dependant by
glob.) But this does not look problematic for me.
An alternative would be to write a * for the 3rd slash:
large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available
from file:/*/$TESTTMP/d (glob)
Then we would match any number of arbitrary characters between / and /. The
first one looks clearer for me, but this one needs no escaping (\\ and \$).
Possibility number 3 is #if XXX...#endif around the command and its output.
But I do not like this much duplication. And I do not know which test I
should use for matching the start of $TESTTMP. I guess #if windows, but not
sure if this would also be correct on cygwin. (We can not add #if inside
the result, right? This would need only one line duplicated.)
Which variant is preferred?
[1] http://en.wikipedia.org/wiki/File_URI_scheme
>
> --
> Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list