[Mesa-dev] glsl: revised unit tests for lower_jumps.cpp
stereotype441 at gmail.com
Fri Jul 8 15:30:23 PDT 2011
The following patch series is a rework of the contentious unit tests
in my patch series from Tuesday ("glsl: improvements to
lower_jumps.cpp"). Based on concerns about the maintainability and
readability of the tests in Python form, I've re-worked them into
simple bash scripts that invoke glsl_test with the proper arguments
and feed it the necessary input IR using a bash "here document".
These tests may be found in patch 4 of the series. They have
extension *.opt_test, and their expected outputs have extension
*.opt_test.expected. Hopefully the new form of the tests will be a
lot easier for people to read and review.
To run the tests, use "make check" from the toplevel directory.
For reference, I went ahead and included the python script I used to
generate the tests. However, it is not invoked as part of building or
testing mesa anymore--the important files to understand are the
*.opt_test and *.opt_test.expected files.
Patch 3 of the series contains the C++ code for glsl_test, which is
used by the unit tests to run an optimization pass in isolation.
Patch 2 refactors the initialize_context() function (from the builtin
compiler) so that it can be re-used in glsl_test without duplicating
code (thanks to Ian for catching me being sloppy in my last patch
Patch 1 puts a guard around a definition of the INLINE macro in
src/mesa/main/compiler.h so that it doesn't conflict with macros
defined elsewhere in mesa. This was necessary in order to avoid
having patch 2 generate a bunch of compile warnings. In an ideal
world, we would clean the code up so that it doesn't contain duplicate
declarations of the INLINE macro (or perhaps just use "inline", since
it is standard as of C99), but I don't feel like shaving that
particular yak today.
[PATCH 1/4] mesa: Add an ifndef guard around the definition of the INLINE macro
[PATCH 2/4] glsl: Move initialize_context() to glsl_parser_extras.cpp so it can be re-used.
[PATCH 3/4] glsl: Create a standalone executable for testing optimization passes.
[PATCH 4/4] glsl: Add unit tests for lower_jumps.cpp
More information about the mesa-dev