mesa/src/amd/compiler/tests
Rhys Perry ebeda07801 aco/tests: fix 32-bit build
"call of overloaded ‘Operand(long unsigned int)’ is ambiguous"

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11627>
2021-06-29 09:55:32 +00:00
..
check_output.py aco/tests: improve reporting of failed code checks 2021-06-03 03:49:07 +00:00
framework.h aco/tests: Fix GFX10_3 being printed as gfx11 2020-12-29 18:57:10 +00:00
glsl_scraper.py aco: add framework for testing isel and integration tests 2020-07-30 16:13:08 +00:00
helpers.cpp aco/tests: add SDWA tests 2021-06-08 08:57:43 +00:00
helpers.h aco/tests: add SDWA tests 2021-06-08 08:57:43 +00:00
main.cpp aco/tests: Use _exit in child process 2021-03-16 15:32:33 +00:00
meson.build aco/tests: add SDWA tests 2021-06-08 08:57:43 +00:00
README.md aco/tests: add tests for form_hard_clauses() 2021-06-03 03:49:07 +00:00
test_assembler.cpp aco: lower p_constaddr into separate instructions earlier 2021-03-11 16:31:19 +00:00
test_builder.cpp aco: remove dead code for the handling of exec temporaries 2021-02-12 22:41:31 +00:00
test_hard_clause.cpp aco/tests: add tests for form_hard_clauses() 2021-06-03 03:49:07 +00:00
test_insert_nops.cpp aco/tests: add test for waNsaCannotFollowWritelane 2021-03-17 12:31:05 +00:00
test_isel.cpp aco: do not clause NSA instructions 2021-06-03 03:49:07 +00:00
test_optimizer.cpp aco/tests: add SDWA tests 2021-06-08 08:57:43 +00:00
test_optimizer_postRA.cpp aco/tests: fix 32-bit build 2021-06-29 09:55:32 +00:00
test_regalloc.cpp aco/ra: fix get_reg_for_operand() with vector operands 2021-05-17 13:31:07 +00:00
test_sdwa.cpp aco/tests: add SDWA tests 2021-06-08 08:57:43 +00:00
test_tests.cpp
test_to_hw_instr.cpp aco/tests: add tests for p_extract/p_insert lowering 2021-06-08 08:57:43 +00:00

Tests are wrapped in a BEGIN_TEST/END_TEST and write data to the output file pointer. Tests have checks against the output. They are single line comments prefixed with certain characters:

  • ! fails the test if the current line does not match the pattern
  • >> skips to the first line which matches the pattern, or fails the test if there is none
  • ; executes python code to extend the pattern syntax by inserting functions into the variable dictionary, fail the test, insert more checks or consume characters from the output

Before this prefix, there can be a ~ to only perform the check for certain variants (a regex directly following the ~ is used).

Pattern Syntax

Patterns can define variables which can be accessed in both python code and the pattern itself. These are useful for readability or dealing with unstable identifiers in the output. Variable identifiers are sequences of digits, ascii letters or _ (though they cannot start with a digit).

  • \ can be used to match the following literal character without interpreting it.
  • Most characters expect the same characters in the output.
  • A sequence of spaces in the pattern expects a sequence of spaces or tabs in the output.
  • A # in the pattern expects an unsigned integer in the output. The # can be followed by an identifier to store the integer in a variable.
  • A $ in the pattern stores the output until the first whitespace character into a variable.
  • A % in the pattern followed by an identifier is the same as a # but it expects a % before the integer in the output. It basically matches a ACO temporary.
  • A @ calls a variable as a function. It can be followed by an argument string wrapped in ( and ).

Functions

  • s64, s96, s128, v2, v3, etc, expand to a pattern which matches a disassembled instruction's definition or operand. It later checks that the size and alignment is what's expected.
  • match_func expands to a sequence of $ and inserts functions with expand to the extracted output
  • search_re consumes the rest of the line and fails the test if the pattern is not found