|
1 | 1 | #!/usr/bin/env python3 |
2 | | -"""A script to generate FileCheck statements for mlir unit tests. |
| 2 | +""" |
| 3 | +=============================================================== |
| 4 | +A script to generate FileCheck statements for mlir unit tests. |
| 5 | +=============================================================== |
3 | 6 |
|
4 | 7 | This script is a utility to add FileCheck patterns to an mlir file. |
5 | 8 |
|
6 | | -NOTE: The input .mlir is expected to be the output from the parser, not a |
| 9 | +NOTE: The input ``.mlir`` is expected to be the output from the parser, not a |
7 | 10 | stripped down variant. |
8 | 11 |
|
9 | 12 | Example usage: |
10 | | -$ generate-test-checks.py foo.mlir |
11 | | -$ mlir-opt foo.mlir -transformation | generate-test-checks.py |
12 | | -$ mlir-opt foo.mlir -transformation | generate-test-checks.py --source foo.mlir |
13 | | -$ mlir-opt foo.mlir -transformation | generate-test-checks.py --source foo.mlir -i |
14 | | -$ mlir-opt foo.mlir -transformation | generate-test-checks.py --source foo.mlir -i --source_delim_regex='gpu.func @' |
| 13 | +
|
| 14 | +.. code-block:: shell |
| 15 | +
|
| 16 | + $ generate-test-checks.py foo.mlir |
| 17 | + $ mlir-opt foo.mlir -transformation | generate-test-checks.py |
| 18 | + $ mlir-opt foo.mlir -transformation | generate-test-checks.py --source foo.mlir |
| 19 | + $ mlir-opt foo.mlir -transformation | generate-test-checks.py --source foo.mlir -i |
| 20 | + $ mlir-opt foo.mlir -transformation | generate-test-checks.py --source foo.mlir -i --source_delim_regex='gpu.func @' |
15 | 21 |
|
16 | 22 | The script will heuristically generate CHECK/CHECK-LABEL commands for each line |
17 | 23 | within the file. By default this script will also try to insert string |
18 | | -substitution blocks for all SSA value names. If --source file is specified, the |
| 24 | +substitution blocks for all SSA value names. If ``--source file`` is specified, the |
19 | 25 | script will attempt to insert the generated CHECKs to the source file by looking |
20 | | -for line positions matched by --source_delim_regex. |
| 26 | +for line positions matched by ``--source_delim_regex``. |
21 | 27 |
|
22 | 28 | The script is designed to make adding checks to a test case fast, it is *not* |
23 | 29 | designed to be authoritative about what constitutes a good test! |
|
0 commit comments