| 1 |
# Trace test data |
| 2 |
|
| 3 |
## Trace golden tests |
| 4 |
|
| 5 |
Trace tests can be generated by running |
| 6 |
|
| 7 |
``` |
| 8 |
go generate . |
| 9 |
``` |
| 10 |
|
| 11 |
with the relevant toolchain in this directory. |
| 12 |
|
| 13 |
This will put the tests into a `tests` directory where the trace reader |
| 14 |
tests will find them. |
| 15 |
|
| 16 |
A subset of tests can be regenerated by specifying a regexp pattern for |
| 17 |
the names of tests to generate in the `GOTRACETEST` environment |
| 18 |
variable. |
| 19 |
Test names are defined as the name of the `.go` file that generates the |
| 20 |
trace, but with the `.go` extension removed. |
| 21 |
|
| 22 |
## Trace test programs |
| 23 |
|
| 24 |
The trace test programs in the `testprog` directory generate traces to |
| 25 |
stdout. |
| 26 |
Otherwise they're just normal programs. |
| 27 |
|
| 28 |
## Trace debug commands |
| 29 |
|
| 30 |
The `cmd` directory contains helpful tools for debugging traces. |
| 31 |
|
| 32 |
* `gotraceraw` parses traces without validation. |
| 33 |
It can produce a text version of the trace wire format, or convert |
| 34 |
the text format back into bytes. |
| 35 |
* `gotracevalidate` parses traces and validates them. |
| 36 |
It performs more rigorous checks than the parser does on its own, |
| 37 |
which helps for debugging the parser as well. |
| 38 |
In fact, it performs the exact same checks that the tests do. |