Skip to content

Add integration test harness and GitHub Actions CI - #4

Merged
CierCier merged 3 commits into
mainfrom
ci/integration-test-harness
Jul 20, 2026
Merged

CierCier merged 3 commits into
mainfrom
ci/integration-test-harness

Conversation

@CierCier

@CierCier CierCier commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • tests/run_tests.sh — new integration test harness: builds agc (cargo build -p agc), then compiles every tests/*.ag to a temp dir and runs it, printing a per-test PASS/FAIL line and a final summary; exits nonzero if any test fails. Supports running a single test by name (bash tests/run_tests.sh vec_test). Failed compile/run logs are dumped inline for CI debugging. A SKIP_TESTS list exists but is empty — all 18 tests currently pass. The two syscall tests intentionally exit with code 42 (sys_exit(42), per plan/runtime-migration.md Phase 1), encoded via a per-test expected_exit table.
  • .github/workflows/ci.yml — single job on push + pull_request (ubuntu-24.04): installs LLVM 22 from apt.llvm.org (matching inkwell's llvm22-1 feature / llvm-sys 221, with LLVM_SYS_221_PREFIX=/usr/lib/llvm-22), caches cargo registry + target keyed on Cargo.lock, then runs cargo test -p agc followed by bash tests/run_tests.sh.
  • Deleted tests/CMakeLists.txt and examples/CMakeLists.txt — both include(SilverUtils), which does not exist anywhere in the repo, so they were dead.
  • tests/README.md — rewritten to document the new harness instead of the defunct CMake/CTest flow.

Test plan

  • bash tests/run_tests.sh — 18/18 PASS, exit 0
  • Single-test mode, missing-test, compile-failure, and runtime-failure paths all return correct exit codes
  • cargo test -p agc — 220 passed
  • Workflow YAML validated with yamllint (syntactically clean; style-only warnings)

🤖 Generated with Claude Code

Greptile Summary

This PR replaces the defunct CMake/CTest build system (which depended on a non-existent SilverUtils module) with a self-contained bash integration harness (tests/run_tests.sh) and a GitHub Actions CI workflow (.github/workflows/ci.yml). It also rewrites the tests README to match the new harness.

  • tests/run_tests.sh builds agc, discovers every tests/*.ag file via glob, compiles and runs each in an isolated scratch directory with a 120-second timeout, per-test expected exit codes (syscall_test/syscall_wrapper_test intentionally exit 42), a skip list, and inline log dumps on failure.
  • .github/workflows/ci.yml runs on push to main and on all pull requests; installs LLVM 22 via the official apt repository (replacing the previously flagged llvm.sh approach), caches cargo artifacts under a key that includes llvm-22, then runs cargo test -p agc followed by bash tests/run_tests.sh.
  • The two dead CMakeLists.txt files (both include(SilverUtils) which never existed) are removed.

Confidence Score: 5/5

Safe to merge — the harness and workflow are well-structured, critical failure paths are explicitly checked, and the two deleted CMakeLists files were confirmed dead.

The changes are additive (a new bash harness, a new CI workflow, documentation, and two dead-file deletions) with no modifications to compiler or runtime code. All critical branches in run_tests.sh have explicit guards. The CI workflow now correctly restricts push triggers to main and includes LLVM version in the cache key. The two nits found — a wget failure that would surface later as an apt error, and a missing nullglob guard in the test glob — do not affect the correctness of any current CI run.

No files require special attention; both findings are in low-risk areas (CI diagnostics and an unreachable glob edge case).

Important Files Changed

Filename Overview
.github/workflows/ci.yml New CI workflow: installs LLVM 22 via apt (replacing the previously flagged llvm.sh approach), caches cargo with an LLVM-version-qualified key, runs unit tests then integration tests. The wget
tests/run_tests.sh New bash integration harness: builds agc, globs tests/*.ag, compiles and runs each with per-test expected exit codes and a timeout. Critical paths have explicit error checks. Minor: glob without nullglob would add a literal pattern string if the tests directory were empty.
tests/README.md Documentation rewritten to describe the new bash harness; old CMake/CTest instructions removed. Accurate and matches the harness behaviour.
tests/CMakeLists.txt Deleted dead file that depended on a non-existent SilverUtils CMake module.
examples/CMakeLists.txt Deleted dead file that also depended on the missing SilverUtils CMake module.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([bash tests/run_tests.sh]) --> B{Argument given?}
    B -- yes --> C[Resolve single tests/name.ag]
    B -- no --> D[Glob tests/*.ag into array]
    C --> E[cargo build -p agc]
    D --> E
    E -- fail --> F([exit 1])
    E -- success --> G[Check binary exists]
    G -- missing --> F
    G -- ok --> H[mktemp WORKDIR / set EXIT trap]
    H --> I[[For each test]]
    I --> J{is_skipped?}
    J -- yes --> K[SKIP]
    J -- no --> L[agc compile to WORKDIR/name]
    L -- fail --> M[FAIL: compile error, print log]
    L -- success --> N[timeout run in scratch rundir]
    N --> O{exit == expected_exit?}
    O -- yes --> P[PASS]
    O -- no, 124 --> Q[FAIL: timed out, print log]
    O -- no, other --> R[FAIL: wrong exit, print log]
    K --> I
    P --> I
    M --> I
    Q --> I
    R --> I
    I -- done --> S[Print summary]
    S --> T{any failed?}
    T -- yes --> U([exit 1])
    T -- no --> V([exit 0])
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A([bash tests/run_tests.sh]) --> B{Argument given?}
    B -- yes --> C[Resolve single tests/name.ag]
    B -- no --> D[Glob tests/*.ag into array]
    C --> E[cargo build -p agc]
    D --> E
    E -- fail --> F([exit 1])
    E -- success --> G[Check binary exists]
    G -- missing --> F
    G -- ok --> H[mktemp WORKDIR / set EXIT trap]
    H --> I[[For each test]]
    I --> J{is_skipped?}
    J -- yes --> K[SKIP]
    J -- no --> L[agc compile to WORKDIR/name]
    L -- fail --> M[FAIL: compile error, print log]
    L -- success --> N[timeout run in scratch rundir]
    N --> O{exit == expected_exit?}
    O -- yes --> P[PASS]
    O -- no, 124 --> Q[FAIL: timed out, print log]
    O -- no, other --> R[FAIL: wrong exit, print log]
    K --> I
    P --> I
    M --> I
    Q --> I
    R --> I
    I -- done --> S[Print summary]
    S --> T{any failed?}
    T -- yes --> U([exit 1])
    T -- no --> V([exit 0])
Loading

Reviews (3): Last reviewed commit: "tests: support inline comments in skip l..." | Re-trigger Greptile

- tests/run_tests.sh: builds agc, compiles and runs every tests/*.ag in a
  temp dir, prints per-test PASS/FAIL and a summary, exits nonzero on any
  failure. Supports running a single test by name. Syscall tests expect
  exit code 42 (they invoke sys_exit(42) per the runtime migration plan).
- .github/workflows/ci.yml: on push/PR, installs LLVM 22 (matching
  inkwell llvm22-1 / llvm-sys 221 with LLVM_SYS_221_PREFIX), caches cargo,
  runs cargo test -p agc and the integration harness.
- Delete stale tests/CMakeLists.txt and examples/CMakeLists.txt: both
  include(SilverUtils), which does not exist anywhere in the repo.
- Update tests/README.md to document the new harness.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 20, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a repo-local integration test harness for Silver (tests/*.ag) and wires both Rust unit tests (cargo test -p agc) and integration tests into a new GitHub Actions CI workflow, while removing unused CMake-based test/example scaffolding.

Changes:

  • Add tests/run_tests.sh to build agc, compile each tests/*.ag, execute binaries, and summarize PASS/FAIL (with per-test expected exit codes and timeouts).
  • Add .github/workflows/ci.yml to run compiler unit tests and the new integration harness on push/PR.
  • Remove dead CMakeLists files and update tests/README.md to document the new flow.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/run_tests.sh New bash harness to build the compiler and run .ag integration tests with logging and expected-exit handling.
tests/README.md Updates test documentation to describe the new harness and how to run tests locally/CI.
tests/CMakeLists.txt Deletes unused/invalid CMake-based test definitions.
examples/CMakeLists.txt Deletes unused/invalid CMake-based example build definitions.
.github/workflows/ci.yml Adds CI workflow to install LLVM 22, cache Cargo, and run unit + integration tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/run_tests.sh
Comment on lines +44 to +51
is_skipped() {
for skip in $SKIP_TESTS; do
if [ "$skip" = "$1" ]; then
return 0
fi
done
return 1
}
Comment thread tests/README.md Outdated
```

Tests return exit code 0 on success, 1 on failure, making them compatible with CTest.
Tests return exit code 0 on success, 1 on failure.
Comment thread .github/workflows/ci.yml Outdated
Comment on lines +18 to +23
wget -q https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22
# llvm.sh installs the clang/lld toolchain; llvm-sys additionally
# needs the LLVM development files (llvm-config, headers, libs).
sudo apt-get install -y llvm-22-dev libpolly-22-dev libzstd-dev zlib1g-dev
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
@CierCier
CierCier merged commit 2a306a4 into main Jul 20, 2026
2 checks passed
@CierCier
CierCier deleted the ci/integration-test-harness branch July 21, 2026 10:16
CierCier added a commit that referenced this pull request Aug 1, 2026
Add integration test harness and GitHub Actions CI
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