jbush001 / NyuziProcessor

GPGPU microprocessor architecture
Apache License 2.0
1.96k stars 348 forks source link

Approximate image comparison for render tests #182

Open jbush001 opened 5 years ago

jbush001 commented 5 years ago

Currently, the render tests compute a SHA-1 checksum of the output from the renderer, then compare that to a known value to determine if the test passes. This is fragile, because minor floating point differences (even that are spec compliant) can cause minor variations, which break tests. For example, the emulator and verilator need different checksums.

Instead, make the test harness load the reference image and perform a pixel-wise comparison, computing the mean squared error between them. If this is below a threshold, the test should pass.

Currently, this is handled in tests/test_harness.py, run_render_test. Since the project now uses the Python Imaging Library (PIL), that could be used to load the reference image and possibly to help with the comparison.