cli tutorial
This tutorial shows how to build the floating-conformance executable and
run the four conformance runners through it, either directly or through the
just conformance tooling that downloads and plans whole corpora.
| I want to | Use |
|---|---|
| build the executable and see its usage | run … tooling/src/cli -- --help |
| run decTest, ITL, MPFR or TestFloat data | --backend gda, itl, mpfr, testfloat |
| run whole pinned corpora in parallel | just conformance … |
| use the result in a script | the exit code and --json |
| see the options of one runner | the runner tutorials |
Quick start
The executable is native-only and is built from a checkout of the
repository, not installed with moon add. From the repository root, build it
and print the usage line:
sh tools/run_moon_clean_exec.sh run --release --target native tooling/src/cli -- --help
usage: floating-conformance --backend <gda|testfloat|mpfr|itl> [backend options]
Run the committed GDA smoke file (the default path of the gda runner):
sh tools/run_moon_clean_exec.sh run --release --target native tooling/src/cli -- --backend gda
The runner prints a summary and the process exits with 0 when every
executable row passed.
Everyday tasks
Choose a backend
Everything after the dispatcher’s own options goes to the runner:
floating-conformance --backend gda --json testdata/decimal_gda/smoke.decTest
floating-conformance --backend itl testdata/interval/smoke.itl
floating-conformance --backend mpfr --json testdata/binary/mpfr-4.2.2-elementary.txt
floating-conformance --backend testfloat --function f64_mul --rounding rnear_even vectors.tv
(floating-conformance stands for the built executable, for example
_build/conformance/gda/native/release/build/gda-conformance.exe.)
Use the tooling instead of raw invocations
For full corpora, let tools/conformance.py build the executable, fetch the
pinned data, plan the phases and run the shards in parallel:
just conformance build decimal_gda
just conformance smoke binary
just conformance run interval
just gate decimal_gda 8
Read the exit code
0 means success, 1 means failing cases (for itl also diagnostic cases;
in strict mode also unsupported cases), 2 means a usage, file or parse
error. Scripts should check the code
and, with --json, parse the single JSON object on standard output.
Going further
- Each runner has its own options; see the tutorials for gda_expr_cli, itl_expr_cli, mpfr_expr_cli and testfloat_expr_cli.
- To execute corpora in MoonBit code without a process, call the frontends directly, for example gda_expr.
Common pitfalls
--helpis the dispatcher’s.--backend gda --helpprints the dispatcher usage and exits with0; it does not show the runner’s options.- Relative default paths. Runners default to files under
testdata/; run them from the repository root. - One backend per invocation.
--backendmay be given only once. - An empty directory is not an error. The
gdarunner rejects a named file without the.decTestsuffix (not a .decTest file: PATH, exit2), but a directory contributes only its direct.decTestfiles, so a directory without any gives an empty run that exits with0.
Next steps
- cli API for the exact options and exit codes.
- internal/runner_cli for the shared option parser.
- cli design for the layering.
- verification for the published corpus claims.