Making tests hashing-algorithm-agnostic

Mads Kiilerich mads at kiilerich.com
Wed Oct 29 10:54:52 CDT 2014


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?

I do not see how swappable hash algorithms possibly could be a feature 
we should care about in the test suite.

For local testing while hacking, you can apply whatever hacks gets the 
job done for you.

The actual hashes matters for some tests. Ignoring hash changes will 
probably make it very hard to debug and is not a good idea.

Instead, I can imagine putting some hacks in the code that for all 
content calculates both hashes and append them to a file in /tmp . Once 
that has been created, it will be quite trivial to make a 
search'n'replace, either in run-tests to replace your hashes with the 
good old ones in the test output, or just modifying the test files once 
and for all. The latter would probably also automatically handle the 
places where a test specify hashes explicitly ... except for the places 
where short prefixes are specified. You will still see some failures in 
places where the test depends on the sort order of hashes or uniqueness 
of short prefixes.

/Mads


More information about the Mercurial-devel mailing list