Bug 1619393 - Reftest improvements for fuzzy tests r=gw
Add support for a `fuzzy-range` keyword in reftest.list. It is similar to `fuzzy` but it allows multiple pairs of `max_difference, num_differences` numbers that introduce multiple buckets of allowed differences. For example, `fuzzy-range(5,100,20,10)` allows at most 100 pixels with a difference of at most 5, _plus_ an extra 10 pixels at most that have a difference more than 5 but less than or equal to 20. The total number of differing pixels allowed is thus 110, but only if 100 of those differ by <= 5 and the remaining 10 by <= 20. 110 pixels with a difference <= 5 will still fail. This is intentional to encourage tighter bounds in tests where many pixels are slightly off and a few outliers are off by a lot. The number of parameters is arbitrary; longer lists can get confusing so this change also introduces optional support for writing `<=` in front of the max difference and `*` in front of the max pixel count, eg. `fuzzy-range(<=5,*100,<=20,*10)` (no spaces). Any pixels that exceed the highest maximum will fail the test, similar to `fuzzy`. Steps tested: 1. the same tests fail in exactly the same way before and after; 2. reordered the `fuzzy` statements for raster_root_A/B/C to no longer be sorted by max difference, and verified that the tests pass/fail the same way; (then sort them again which is easier to understand); 3. tests using the new feature still fail when the ref no longer matches (deliberately broke the _ref version and verified test failed); Differential Revision: https://phabricator.services.mozilla.com/D65247 [ghsync] From https://hg.mozilla.org/mozilla-central/rev/8c07488c9a3f0a76e01ce34e060d071a2310612d