Skip to content

z: integrate GCC compile-only torture tests into test command#53

Merged
ppenna merged 1 commit into
devfrom
feature-gcc-testsuite
May 16, 2026
Merged

z: integrate GCC compile-only torture tests into test command#53
ppenna merged 1 commit into
devfrom
feature-gcc-testsuite

Conversation

@ppenna

@ppenna ppenna commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Integrates GCC's built-in compile-only torture tests (gcc.c-torture/compile/) into the ./z test command to validate code generation for the Nanvix cross-compiler targets.

Changes

New files

  • .nanvix/dejagnu/baseboards/nanvix-sim.exp — DejaGnu board file configuring the Nanvix target (linker flags, simulator settings, target capabilities)
  • .nanvix/dejagnu/nanvix-sim-run — Wrapper script adapting nanvixd.elf to the simulator interface DejaGnu expects
  • .nanvix/dejagnu/site.exp.in — Template for DejaGnu site configuration

Modified

  • z — Added check_steps() function and integrated it as the final step of test_steps()

How it works

  1. Compile-only tests run make check-gcc RUNTESTFLAGS="--target_board=nanvix-sim compile.exp" which exercises thousands of C programs through the cross-compiler, catching code generation bugs without needing target execution.

  2. Execution tests (optional, requires /dev/kvm) use the nanvix-sim-run wrapper to run binaries on nanvixd.elf via the DejaGnu simulator protocol.

Usage

# Full test suite (smoke + integration + GCC torture compile tests):
./z test

The check_steps() function also supports being called directly with different suites if exposed later:

  • compile — compile-only torture tests (default, no KVM needed)
  • execute — execution tests via nanvixd (requires /dev/kvm)
  • all — both

Copilot AI review requested due to automatic review settings May 16, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Integrates GCC's compile-only torture test suite into the ./z test flow by introducing a check_steps() Bash function and the DejaGnu configuration (board file, site template, and simulator wrapper) needed to drive make check-gcc against the *-nanvix cross-compiler targets.

Changes:

  • Add check_steps() to z and call it from test_steps() so ./z test runs make check-gcc with --target_board=nanvix-sim compile.exp.
  • Add DejaGnu board file (nanvix-sim.exp), site template (site.exp.in), and a nanvix-sim-run wrapper that adapts nanvixd.elf to the simulator interface.
  • Support optional execute / all suites in check_steps, with a print of the gcc.sum summary.
Show a summary per file
File Description
z Adds check_steps() and wires it as the final phase of test_steps(); generates nanvix-site.exp, installs the simulator wrapper, and invokes make check-gcc.
.nanvix/dejagnu/baseboards/nanvix-sim.exp New DejaGnu board file selecting the in-tree compiler, hard-coding Nanvix link flags, and pointing the simulator hook at nanvix-sim-run.
.nanvix/dejagnu/nanvix-sim-run New Bash wrapper that runs an ELF binary on nanvixd.elf under timeout, suppressing stderr.
.nanvix/dejagnu/site.exp.in New site.exp template that appends the Nanvix board directory to DejaGnu's boards_dir.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 8

Comment thread z Outdated
Comment thread z Outdated
Comment thread z Outdated
Comment thread .nanvix/dejagnu/baseboards/nanvix-sim.exp
Comment thread .nanvix/dejagnu/nanvix-sim-run Outdated
Comment thread .nanvix/dejagnu/nanvix-sim-run Outdated
Comment thread z Outdated
Comment thread z
Introduce infrastructure to run GCC's built-in testsuite against the
Nanvix cross-compiler, validating code generation for i686-nanvix and
x86_64-nanvix targets.

New files:
- .nanvix/dejagnu/baseboards/nanvix-sim.exp: DejaGnu board file that
  configures target capabilities (no signals, no argv, status wrapper),
  linker flags for libposix.a/user.ld, and simulator invocation.
- .nanvix/dejagnu/nanvix-sim-run: Wrapper adapting nanvixd.elf to the
  simulator interface DejaGnu expects. Logs nanvixd diagnostics to a
  separate file, passes test program stderr through, and emits a
  recognizable marker on timeout (--foreground -k 5).
- .nanvix/dejagnu/site.exp.in: Template for DejaGnu site configuration
  that adds the custom board directory to the search path.

Modified:
- z: Add check_steps() function supporting compile, execute, and all
  test suites. Integrate into test_steps() as an opt-in step gated by
  Z_RUN_TORTURE=1 to avoid blocking routine developer test runs.
  Environment variables are scoped to the make child process. The sim
  wrapper install is guarded by a writability check. The .sum file is
  parsed for unexpected failures since make check-gcc always returns 0.

Usage:
  Z_RUN_TORTURE=1 ./z test     # smoke + integration + torture tests
  ./z test                     # smoke + integration only (default)
@ppenna ppenna force-pushed the feature-gcc-testsuite branch from 4e74588 to 958f81c Compare May 16, 2026 21:41
@ppenna ppenna merged commit 59f1be2 into dev May 16, 2026
1 check passed
@ppenna ppenna deleted the feature-gcc-testsuite branch May 16, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants