Patchwork [6,of,7,resend] tests: ensure that C and Python path encoding agree

login
register
mail settings
Submitter Bryan O'Sullivan
Date Dec. 12, 2012, 9:11 p.m.
Message ID <b23eec6a55ee3292b46a.1355346661@australite.local>
Download mbox | patch
Permalink /patch/76/
State Superseded
Delegated to: Matt Mackall
Headers show

Comments

Bryan O'Sullivan - Dec. 12, 2012, 9:11 p.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1355346577 28800
# Node ID b23eec6a55ee3292b46abdb980adf9d9096d3e1f
# Parent  9fcae4777e797bd8ec8f968b4fde7a148e0963c0
tests: ensure that C and Python path encoding agree
Matt Mackall - Jan. 17, 2013, 9:28 p.m.
On Wed, 2012-12-12 at 13:11 -0800, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano@fb.com>
> # Date 1355346577 28800
> # Node ID b23eec6a55ee3292b46abdb980adf9d9096d3e1f
> # Parent  9fcae4777e797bd8ec8f968b4fde7a148e0963c0
> tests: ensure that C and Python path encoding agree

This series is queued for default, except for this one that collides
with an earlier patch from Adrian. Thanks!
Adrian Buehlmann - Jan. 19, 2013, 6:08 p.m.
On 2013-01-17 22:28, Matt Mackall wrote:
> On Wed, 2012-12-12 at 13:11 -0800, Bryan O'Sullivan wrote:
>> # HG changeset patch
>> # User Bryan O'Sullivan <bryano@fb.com>
>> # Date 1355346577 28800
>> # Node ID b23eec6a55ee3292b46abdb980adf9d9096d3e1f
>> # Parent  9fcae4777e797bd8ec8f968b4fde7a148e0963c0
>> tests: ensure that C and Python path encoding agree
> 
> This series is queued for default, except for this one that collides
> with an earlier patch from Adrian. Thanks!

Ugh. I was somehow hoping you would have waited with including these after 2.5...

The Microsoft C compiler and linker on Windows complains with:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27_x64\include -IC:\Python27_x64\PC /Tcmercurial/pathencode.c /Fobuild\temp.win-amd64-2.7\Release\mercurial/pathencode.obj
pathencode.c
mercurial/pathencode.c(708) : warning C4013: 'alloca' undefined; assuming extern returning int
mercurial/pathencode.c(708) : warning C4047: 'initializing' : 'char *' differs in levels of indirection from 'int'
mercurial/pathencode.c(709) : warning C4047: 'initializing' : 'char *' differs in levels of indirection from 'int'
mercurial/pathencode.c(710) : warning C4047: 'initializing' : 'char *' differs in levels of indirection from 'int'
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27_x64\libs /LIBPATH:C:\Python27_x64\PCbuild\amd64 /EXPORT:initparsers build\temp.win-amd64-2.7\Release\mercurial/parsers.obj build\temp.win-amd64-2.7\Release\mercurial/pathencode.obj /OUT:C:\Users\adi\hgrepos\hg-main\mercurial\parsers.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\mercurial\parsers.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\mercurial\parsers.pyd.manifest
parsers.obj : warning LNK4197: export 'initparsers' specified multiple times; using first specification
   Creating library build\temp.win-amd64-2.7\Release\mercurial\parsers.lib and object build\temp.win-amd64-2.7\Release\mercurial\parsers.exp
pathencode.obj : error LNK2019: unresolved external symbol alloca referenced in function hashencode
C:\Users\adi\hgrepos\hg-main\mercurial\parsers.pyd : fatal error LNK1120: 1 unresolved externals
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

Patch

diff --git a/tests/test-pathencode.py b/tests/test-pathencode.py
--- a/tests/test-pathencode.py
+++ b/tests/test-pathencode.py
@@ -157,7 +157,15 @@  def genpath(rng, count):
 def runtests(rng, seed, count):
     nerrs = 0
     for p in genpath(rng, count):
-        hybridencode(p)
+        he = hybridencode(p)
+        pe = parsers.pathencode(p)
+        if pe != he:
+            if nerrs == 0:
+                print >> sys.stderr, 'seed:', hex(seed)[:-1]
+            print >> sys.stderr, repr(p)
+            print >> sys.stderr, '  hybrid %r' % he
+            print >> sys.stderr, '  path   %r' % pe
+            nerrs += 1
     return nerrs
 
 def main():