Making tests hashing-algorithm-agnostic

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Nov 5 08:46:45 CST 2014



On 11/04/2014 11:22 PM, Kyle Lippincott wrote:
>
>
> On Tue, Nov 4, 2014 at 1:55 PM, Pierre-Yves David
> <pierre-yves.david at ens-lyon.org <mailto:pierre-yves.david at ens-lyon.org>>
> wrote:
>
>
>
>     On 10/29/2014 08:23 PM, Kyle Lippincott wrote:
>
>
>
>         On Wed, Oct 29, 2014 at 8:54 AM, Mads Kiilerich
>         <mads at kiilerich.com <mailto:mads at kiilerich.com>
>         <mailto:mads at kiilerich.com <mailto:mads at kiilerich.com>>> wrote:
>
>              On 10/28/2014 08:51 PM, Kyle Lippincott wrote:
>
>                  I want to play around with different hashing
>         algorithms, and the
>                  current hard-coded hashes in the tests make that very
>         difficult.
>
>
>                  Thoughts?
>
>
>     Any strategy that implies to directly touch the test files are going
>     to be either impractical or awful or fragile or all of that.
>
>
> Can you elaborate?  It's easy to write a script that looks greps for
> '[0-9a-f]{12,}' and replaces it with with a named capture.  We can add
> stuff to check-code to verify that new ones don't sneak in, which will
> make it not-fragile.

I'm really not appealed by the has capture option. There is two main reason:

   First, having test output being significantly different from the 
vanilla mercurial output is a bad idea. The closer it is from real 
output the easier it is to spot output issue or to use test as example 
output from people. Such substitution also affect our ability to use 
`runt-tests.py -i` in a simple way.

   Second, having hardcoded hash in the test suite is very valuable. If 
any change made introduce a subtle behavior change, it will likely be 
caught by a hash change. This appened to me multiple time in the past 
and this will keep saving us for sneaking regression.

I can see how valuable such approach would be for you very specific 
case, but it is not common enough to impact everything else.

>     --
>     Pierre-Yves David
>
>     PS: you also appear to use a broken MUA.
>
>
> I'm just using gmail, the message I replied to had most of its quoting
> removed, which might have caused it?  Not sure.

Your MUA is doing stupid things with quoting. It would be nice if you 
could get it fixed.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list