[Mesa-dev] [PATCH 4/4] glsl: Add unit tests for lower_jumps.cpp
Chad Versace
chad at chad-versace.us
Wed Jul 20 09:26:23 PDT 2011
On 07/18/2011 11:37 AM, Paul Berry wrote:
> These tests invoke do_lower_jumps() in isolation (using the glsl_test
> executable) and verify that it transforms the IR in the expected way.
>
> The unit tests may be run from the top level directory using "make
> check".
>
> For reference, I've also checked in the Python script
> create_test_cases.py, which was used to generate these tests. It is
> not necessary to run this script in order to run the tests.
> ---
> Makefile | 6 +-
> src/glsl/tests/compare_ir | 59 ++
> src/glsl/tests/lower_jumps/.gitignore | 1 +
> src/glsl/tests/lower_jumps/create_test_cases.py | 643 ++++++++++++++++++++
> src/glsl/tests/lower_jumps/lower_breaks_1.opt_test | 13 +
> .../lower_jumps/lower_breaks_1.opt_test.expected | 5 +
> src/glsl/tests/lower_jumps/lower_breaks_2.opt_test | 15 +
> .../lower_jumps/lower_breaks_2.opt_test.expected | 7 +
> src/glsl/tests/lower_jumps/lower_breaks_3.opt_test | 17 +
> .../lower_jumps/lower_breaks_3.opt_test.expected | 8 +
> src/glsl/tests/lower_jumps/lower_breaks_4.opt_test | 15 +
> .../lower_jumps/lower_breaks_4.opt_test.expected | 7 +
> src/glsl/tests/lower_jumps/lower_breaks_5.opt_test | 16 +
> .../lower_jumps/lower_breaks_5.opt_test.expected | 7 +
> src/glsl/tests/lower_jumps/lower_breaks_6.opt_test | 29 +
> .../lower_jumps/lower_breaks_6.opt_test.expected | 29 +
> .../lower_guarded_conditional_break.opt_test | 21 +
> ...wer_guarded_conditional_break.opt_test.expected | 20 +
> .../lower_jumps/lower_pulled_out_jump.opt_test | 28 +
> .../lower_pulled_out_jump.opt_test.expected | 25 +
> .../tests/lower_jumps/lower_returns_1.opt_test | 12 +
> .../lower_jumps/lower_returns_1.opt_test.expected | 4 +
> .../tests/lower_jumps/lower_returns_2.opt_test | 13 +
> .../lower_jumps/lower_returns_2.opt_test.expected | 5 +
> .../tests/lower_jumps/lower_returns_3.opt_test | 20 +
> .../lower_jumps/lower_returns_3.opt_test.expected | 21 +
> .../tests/lower_jumps/lower_returns_4.opt_test | 14 +
> .../lower_jumps/lower_returns_4.opt_test.expected | 16 +
> .../lower_jumps/lower_returns_main_false.opt_test | 17 +
> .../lower_returns_main_false.opt_test.expected | 8 +
> .../lower_jumps/lower_returns_main_true.opt_test | 17 +
> .../lower_returns_main_true.opt_test.expected | 13 +
> .../lower_jumps/lower_returns_sub_false.opt_test | 16 +
> .../lower_returns_sub_false.opt_test.expected | 8 +
> .../lower_jumps/lower_returns_sub_true.opt_test | 16 +
> .../lower_returns_sub_true.opt_test.expected | 13 +
> .../lower_jumps/lower_unified_returns.opt_test | 26 +
> .../lower_unified_returns.opt_test.expected | 21 +
> .../remove_continue_at_end_of_loop.opt_test | 13 +
> ...emove_continue_at_end_of_loop.opt_test.expected | 5 +
> ..._non_void_at_end_of_loop_lower_nothing.opt_test | 16 +
> ..._at_end_of_loop_lower_nothing.opt_test.expected | 8 +
> ...n_non_void_at_end_of_loop_lower_return.opt_test | 16 +
> ...d_at_end_of_loop_lower_return.opt_test.expected | 19 +
> ..._at_end_of_loop_lower_return_and_break.opt_test | 16 +
> ...f_loop_lower_return_and_break.opt_test.expected | 19 +
> ...turn_void_at_end_of_loop_lower_nothing.opt_test | 14 +
> ..._at_end_of_loop_lower_nothing.opt_test.expected | 6 +
> ...eturn_void_at_end_of_loop_lower_return.opt_test | 14 +
> ...d_at_end_of_loop_lower_return.opt_test.expected | 11 +
> ..._at_end_of_loop_lower_return_and_break.opt_test | 14 +
> ...f_loop_lower_return_and_break.opt_test.expected | 11 +
> src/glsl/tests/optimization-test | 28 +
> src/glsl/tests/sexps.py | 103 ++++
> 54 files changed, 1543 insertions(+), 1 deletions(-)
> create mode 100755 src/glsl/tests/compare_ir
> create mode 100644 src/glsl/tests/lower_jumps/.gitignore
> create mode 100644 src/glsl/tests/lower_jumps/create_test_cases.py
> create mode 100755 src/glsl/tests/lower_jumps/lower_breaks_1.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_breaks_1.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_breaks_2.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_breaks_2.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_breaks_3.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_breaks_3.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_breaks_4.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_breaks_4.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_breaks_5.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_breaks_5.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_breaks_6.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_breaks_6.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_1.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_1.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_2.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_2.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_3.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_3.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_4.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_4.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_main_false.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_main_false.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_main_true.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_main_true.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_sub_false.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_sub_false.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_returns_sub_true.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_returns_sub_true.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/lower_unified_returns.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/lower_unified_returns.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test.expected
> create mode 100755 src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test
> create mode 100644 src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test.expected
> create mode 100755 src/glsl/tests/optimization-test
> create mode 100644 src/glsl/tests/sexps.py
I'm in favor of adding these unit tests. I can think of no reliable way, other than unit testing,
to prevent regressions of optpass explosion lolz. And I feel that
these particular unit tests are a good approach.
Acked-by: Chad Versace <chad at chad-versace.us>
I like how each test is encapsulated in an individual bash script. This ensures that
1) the testrunner's arguments are documented along with each test, and 2) prevents
passing incorrect arguments to the testrunner.
--
Chad Versace
chad at chad-versace.us
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110720/892fc57e/attachment-0001.pgp>
More information about the mesa-dev
mailing list