Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Validation Configuration

The [validation] section controls Phase 4: semantic equivalence checking between the original program and the transpiled Rust output.

Top-Level Settings

[validation]
trace_syscalls = true
run_original_tests = true
diff_output = true
benchmark = false
KeyTypeDefaultDescription
trace_syscallsbooltrueRecord and compare syscall traces via Renacer
run_original_testsbooltrueExecute the original project’s test suite against transpiled code
diff_outputbooltrueGenerate unified diff of stdout/stderr between original and transpiled runs
benchmarkboolfalseRun performance benchmarks after validation

Syscall Trace Comparison

When trace_syscalls is enabled, Batuta invokes Renacer to capture the syscall sequences of both the original and transpiled programs. The traces are compared structurally: matching syscall names, argument patterns, and return values. Divergences are reported as validation warnings.

This is the strongest form of behavioral equivalence checking available in the pipeline.

Renacer Configuration

[validation.renacer]
trace_syscalls = []
output_format = "json"
KeyTypeDefaultDescription
trace_syscallsarray[]Specific syscalls to trace (empty means all)
output_formatstring"json"Trace output format: "json" or "text"

Filtering Syscalls

When tracing all syscalls produces too much noise, restrict the set to the calls that matter for your application.

[validation.renacer]
trace_syscalls = ["read", "write", "open", "close", "mmap"]
output_format = "json"

Numerical Tolerance

Floating-point results may differ between the original runtime and the transpiled Rust code due to instruction ordering, fused multiply-add availability, or different math library implementations. Batuta applies a default relative tolerance of 1e-6 when comparing numeric outputs in diff mode.

To adjust tolerance for specific comparisons, use the --tolerance flag on the CLI:

batuta validate --tolerance 1e-4

Benchmark Settings

When benchmark = true, Batuta runs the transpiled binary through a timing harness after validation passes. Results are stored in .batuta-state.json and included in the report.

# Enable benchmarks for a single run without changing the config file
BATUTA_VALIDATION_BENCHMARK=true batuta validate

Navigate: Table of Contents