sigildocs

(sigil test native-backend)

(sigil test native-backend) - Native Codegen Backend Test Runner

Runs test files through native compilation instead of bytecode. For each test file:

  1. Run via bytecode to get baseline output
  2. Build a native executable via the host-supplied build-fn (the build-fn owns codegen + linking)
  3. Run the native binary
  4. Compare outputs

Categories: PASS - native output matches bytecode DIFF - native output differs from bytecode BUILDFAIL - build-fn returned success? = #f (covers what used to be split into COMPILEFAIL + BUILDFAIL; granularity folded into build-fn's build-output diagnostic string) RUNFAIL - native binary crashes or exits non-zero with signal TIMEOUT - native binary hangs (>30s) BC_FAIL - bytecode run itself fails (skip baseline)

The native backend is dependency-inverted at the top entry point run-native-backend-tests. Hosts (sigil-cli, embedded harnesses, the future sigilc self-test) supply the build-fn callback. There is no direct dependency on (sigil build) or (sigil compiler) here.

Exports

strip-ansiprocedure

Strip ANSI escape codes from a string

Filter output lines, removing build noise and empty lines.

Filter native output lines, removing empty lines and trailing result values from the standalone main.

Check if a line is build noise from sigil run

Run a command and capture stdout as lines. Returns (exit-code . lines).

Run a command and capture stderr. Drains stdout to avoid buffer deadlock. Returns (exit-code . stderr-string).

Read all lines from a port

drain-portprocedure

Drain a port without accumulating data

file->labelprocedure

Build the label for a test file (dir/name)

Build a safe filename from a test path for temp files

Run a single test file through the native backend pipeline. Returns a native-backend-result.

Steps 2-4: Build via host-supplied build-fn, run, and compare. The build-fn owns both Scheme→C codegen and linking.

Steps 4-5: Run native binary and compare with bytecode.

lines-equal?procedure

Compare two lists of lines for equality

Create a brief diff summary showing first difference

Run native backend tests for a list of files. Prints progress and returns a native-backend-summary.

files: list of test file paths options: alist with optional keys: verbose - show diff details quiet - suppress per-test output results-dir - directory for artifacts (default: /tmp/native-test-results) sigil-bin - bytecode binary used for the baseline run (default: build/boot/bin/sigil under current dir)

Keyword arguments: build-fn: (build-fn config sources output-path opts) => (values success? artifact-path build-output) REQUIRED for native runs. Ownership: codegen + linking. config: symbol like 'dev / 'release, or a workspace-resolved config record. Threaded into every build-fn call so hosts can pick output dirs / flags / features.

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)