Skip to content

Commit d71440c

Browse files
sylvestreAlonely0
authored andcommitted
awk: document GNU awk compatibility testing
1 parent 7a449f5 commit d71440c

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,42 @@ version, that is, 1.95.0 at the time of writing.
4747

4848
Check out https://github.com/uutils/awk/issues/16.
4949

50+
## Testing
51+
52+
### GNU awk (gawk) Compatibility Testing
53+
54+
Track compatibility against GNU awk by running the upstream gawk testsuite
55+
against our Rust binary. Rather than reimplement gawk's test harness, we drive
56+
gawk's own (GPL) test Makefile with `make check AWK=<wrapper>`, where the wrapper
57+
execs our `awk` — the gawk sources are fetched fresh at test time and never
58+
copied into this repo.
59+
60+
```bash
61+
# Fetch the gawk testsuite (one-time setup)
62+
mkdir -p ../gnu.awk && (cd ../gnu.awk && bash ../awk/util/fetch-gnu.sh)
63+
64+
# Run compatibility tests
65+
./util/run-gnu-testsuite.sh
66+
67+
# Verbose mode shows the diff for each failing test
68+
./util/run-gnu-testsuite.sh -v
69+
70+
# Generate JSON results for CI
71+
./util/run-gnu-testsuite.sh --json-output results.json
72+
```
73+
74+
The harness builds our `awk`, runs gawk's `make check` with a wrapper named
75+
`gawk`, and classifies each test the way gawk's own `pass-fail` target does: a
76+
leftover `_<name>` file is a failure, its absence a pass, and tests that never
77+
run (group-skipped because of missing locales, MPFR, or shared-library support)
78+
are reported as skipped.
79+
80+
### Unit Tests
81+
82+
```bash
83+
cargo test --workspace
84+
```
85+
5086
## Contributing
5187

5288
To contribute to uutils AWK, please see [CONTRIBUTING](https://github.com/uutils/coreutils/blob/main/CONTRIBUTING.md).

0 commit comments

Comments
 (0)