[Mesa-dev] [PATCH 04/11] glsl: Add a unit test for lower_jumps.cpp

Paul Berry stereotype441 at gmail.com
Wed Jul 6 16:39:28 PDT 2011

On 6 July 2011 12:18, Ian Romanick <idr at freedesktop.org> wrote:
> Hash: SHA1
> On 07/05/2011 03:07 PM, Paul Berry wrote:
>> This test invokes do_lower_jumps() in isolation (using the glsl_test
>> executable) and verifies that it transforms the IR in the expected
>> way.
>> The unit test may be run from the top level directory using "make
>> check".
> So, here's my problem with this.  I just spent 15 minutes looking at
> this, and I have no idea what the tests are doing.  It is completely
> impenetrable what IR is going into the optimization pass.  This is why
> developers hate glean and oglconform.  It take 10x time to figure out
> what the test is doing than it takes to fix the bug.  I should be able
> to look at a regression test or a unit test and *instantly* know what
> it's doing.  I shouldn't have to trace through the test code to figure
> that out.
> It looks like this is just a bunch of code that creates some IR.  Why
> can't we just have that IR as text files?  If there are a bunch of them,
> we can have scripts that generate those text files.
> It also looks like these tests send in one set of IR and expect some
> other exact set of IR to come out.  That seems fragile.  For testing
> lowering passes (of all kinds), don't we just want to send in some IR
> and check that the bits that were supposed to be lowered no longer exist?

For those following along on the list, Ian and I just had a discussion
about this.  I'm going to code up an alternative where the tests are
simple files containing input IR and expected output IR, and the
python code just takes care of verifying that the actual output
matches the expected output.  Hopefully that will be easier to follow
and maintain.

More information about the mesa-dev mailing list