Skip to content

Latest commit

 

History

History
85 lines (60 loc) · 1.93 KB

File metadata and controls

85 lines (60 loc) · 1.93 KB

Testing Guide

This guide summarizes testing layers and commands in this repository.

Toolchain note: use stock Zig + elf2sbpf for on-chain builds.

Test Layers

  1. SDK unit tests (sdk/) — core types, serialization
  2. Program SDK tests (src/) — syscall stubs and on-chain helpers
  3. Client SDK tests (client/) — RPC and transaction utilities
  4. Integration tests (program-test/, client/integration/)
  5. Anchor tests (anchor/)

Run Tests

Program SDK

zig build test --summary all

SDK Only

cd sdk
zig build test --summary all

Client SDK

cd client
zig build test --summary all

Client Integration (requires validator)

# Option A: surfpool (CI uses this)
surfpool start --no-tui &

# Option B: solana-test-validator
solana-test-validator &

cd client
zig build integration-test --summary all

Program Integration

./program-test/test.sh

Anchor

cd anchor
zig build test --summary all

Examples (validated elf2sbpf migration path)

cd examples/programs
zig build -Dexample=hello_world -Delf2sbpf-bin=/absolute/path/to/elf2sbpf
zig build -Dexample=counter -Delf2sbpf-bin=/absolute/path/to/elf2sbpf
zig build -Dexample=transfer_lamports -Delf2sbpf-bin=/absolute/path/to/elf2sbpf

CI / Validation Summary

  • Format: zig fmt / project formatter checks
  • SDK: cd sdk && zig build test --summary all
  • Client: cd client && zig build test --summary all
  • Program SDK: zig build test --summary all
  • Integration: ./program-test/test.sh /path/to/zig /path/to/elf2sbpf
  • Examples: cd examples/programs && zig build -Dexample=hello_world -Delf2sbpf-bin=/path/to/elf2sbpf (repeat for counter / transfer_lamports)
  • Anchor: cd anchor && zig build test --summary all

Notes

  • Prefer stock Zig 0.16.x.
  • Some tests require a local validator (see Client Integration).