[PATCH] run-test: replace backslashes in TESTDIR
Adrian Buehlmann
adrian at cadifra.com
Sat Jun 9 19:23:15 CDT 2012
On 2012-06-09 17:17, Mads Kiilerich wrote:
> Mads Kiilerich wrote, On 06/04/2012 03:20 AM:
>> Adrian Buehlmann wrote, On 06/03/2012 07:40 PM:
>>> # HG changeset patch
>>> # User Adrian Buehlmann<adrian at cadifra.com>
>>> # Date 1338744923 -7200
>>> # Node ID 81f15de595760f3592e34b8d97c5f9ef2e760a80
>>> # Parent 7b460b49bf7b75c5a4ab444915c52802c9f97f33
>>> run-test: replace backslashes in TESTDIR
>>>
>>> This may cause troubles in MSYS on Windows.
>>
>> pushed to crew default, thanks.
>
> - as http://selenic.com/repo/hg/rev/ac3e063eebf1 .
>
> It looked good and innocent, but it happens to cause troubles in MSYS on
> Windows.
>
> For example test-ssh.t will fail because msys see a "something
> c:/something" path and assume it is a posix path list and translate it
> to the windows style which is "something C;c:/MinGW/.../something".
> (http://www.mingw.org/wiki/Posix_path_conversion )
>
> What trouble did it fix? AFAICS it would be better to back it out.
>
> We could probably apply some workarounds like using "\"python\"
> \"$TESTDIR..." to avoid msys being too clever, but I would prefer not to
> do so if we don't have to.
It turns out that the sequence C:/ in arguments is indeed absolutely deadly
when MSYS sees this in an argument.
So, at the moment, I indeed fail to find a different solution than to avoid
C:/ and have C:\ instead.
If I do
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -599,8 +599,9 @@
def hghave(reqs):
# TODO: do something smarter when all other uses of hghave is gone
+ tdir = TESTDIR.replace('\\', '/')
proc = Popen4('%s -c "%s/hghave %s"' %
- (options.shell, TESTDIR, ' '.join(reqs)), TESTDIR, 0)
+ (options.shell, tdir, ' '.join(reqs)), TESTDIR, 0)
proc.communicate()
ret = proc.wait()
if wifexited(ret):
@@ -909,7 +910,7 @@
# Make a tmp subdirectory to work in
testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
- os.path.join(HGTMP, os.path.basename(test)).replace('\\', '/')
+ os.path.join(HGTMP, os.path.basename(test))
replacements = [
(r':%s\b' % options.port, ':$HGPORT'),
@@ -1229,7 +1230,7 @@
del os.environ[k]
global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
- TESTDIR = os.environ["TESTDIR"] = os.getcwd().replace('\\', '/')
+ TESTDIR = os.environ["TESTDIR"] = os.getcwd()
if options.tmpdir:
options.keep_tmpdir = True
tmpdir = options.tmpdir
I get as close as
$ python run-tests.py --local test-run-tests.t test-ssh.t
.
--- C:\Users\adi\hgrepos\hg-main\tests\test-ssh.t
+++ C:\Users\adi\hgrepos\hg-main\tests\test-ssh.t.err
@@ -332,7 +332,7 @@
$ echo "baz" > bar
$ hg ci -A -m "unpushable commit" bar
$ hg push --ssh "sh ../ssh.sh"
- pushing to ssh://user@dummy/$TESTTMP/remote
+ pushing to ssh://user@dummy/C:%5CUsers%5Cadi%5CAppData%5CLocal%5CTemp%5Chgtests.ekqr3z%5Ctest-ssh.t/remote
searching for changes
remote: Permission denied
remote: abort: prechangegroup.hg-ssh hook failed
ERROR: C:\Users\adi\hgrepos\hg-main\tests\test-ssh.t output changed
!
Failed test-ssh.t: output changed
# Ran 2 tests, 0 skipped, 1 failed.
Note that having "C:/" in $TESTTMP is harmful as well.
If I re-add the replace('\\', '/') for $TESTTMP, it fails with
$ python run-tests.py --local test-run-tests.t test-ssh.t
.
--- C:\Users\adi\hgrepos\hg-main\tests\test-ssh.t
+++ C:\Users\adi\hgrepos\hg-main\tests\test-ssh.t.err
@@ -320,51 +320,23 @@
> EOF
$ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
- requesting all changes
- adding changesets
- adding manifests
- adding file changes
- added 4 changesets with 5 changes to 4 files (+1 heads)
- updating to branch default
- 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ remote: Illegal repository "$TESTTMP\C;c:MinGWmsys1.0UsersadiAppDataLocalTemphgtests.pq83uftest-ssh.tremote"
+ abort: no suitable response from remote hg!
+ [255]
[..]
More information about the Mercurial-devel
mailing list