Path fun on Windows
Adrian Buehlmann
adrian at cadifra.com
Wed Jun 6 10:10:49 CDT 2012
On 2012-06-06 16:10, Mads Kiilerich wrote:
> On 06/06/12 15:37, Adrian Buehlmann wrote:
[..]
>> I think it would be worth a try and seeing how it works with removing
>> the pwd -W alias.
>>
>> Maybe we then need to find a way to map tempdir paths in the output
>> lines like
>>
>> /tmp/hgtests.qfl8xz/test-a.t
>>
>> back to
>>
>> $TESTTMP
>>
>> Or perhaps we should simply avoid writing such paths to the output.
>
> I guess it will fail in places where we write `pwd` to a config file.
> The advantage of `pwd -W` is that it doesn't require further escaping in
> sh and is understood by windows.
>
Indeed it fails.
I came up with
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -612,10 +612,11 @@
f.close()
script = []
+ script.append('pwd\n') # let's have the value of MSYS's alias for $TESTTMP
+ # as the first line in the ouput, so we can replace
+ # it with "$TESTTMP" too in the rest of the ouput
if options.debug:
script.append('set -x\n')
- if os.getenv('MSYSTEM'):
- script.append('alias pwd="pwd -W"\n')
for n, l in enumerate(t):
if not l.endswith('\n'):
l += '\n'
@@ -701,6 +702,15 @@
postout = []
ret = 0
for n, l in enumerate(output):
+ if n == 0:
+ # The first line in the output is a path that should
+ # be replaced with $TESTTMP later, so we don't see MSYS
+ # paths like '/tmp/hgtests.qfl8xz/test-a.t' in the
+ # output
+ testtmpalias = l.rstrip('\n')
+ continue
+ else:
+ l = l.replace(testtmpalias, "$TESTTMP")
lout, lcmd = l, None
if salt in l:
lout, lcmd = l.split(salt, 1)
which works for quite a number of tests, but it fails for example for test-abort-checkin.t,
which contains
$ abspath=`pwd`/abortcommit.py
$ echo "[extensions]" >> $HGRCPATH
$ echo "mq=" >> $HGRCPATH
$ echo "abortcommit = $abspath" >> $HGRCPATH
and then fails with
$ hg init foo
+ *** failed to import extension abortcommit from $TESTTMP/abortcommit.py: [Errno 2] No such file or directory
so we *do* have to keep the "pwd -W" alias for MSYS.
More information about the Mercurial-devel
mailing list