Skip to content

test(basics): fix and re-enable realloc + cross-program-invocation native#52

Merged
mikemaccana merged 1 commit into
mainfrom
claude/basics-natives-investigation
Jun 5, 2026
Merged

test(basics): fix and re-enable realloc + cross-program-invocation native#52
mikemaccana merged 1 commit into
mainfrom
claude/basics-natives-investigation

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Summary

basics/realloc/native and basics/cross-program-invocation/native were excluded in .github/.ghaignore as "build and test error". I investigated — the real cause was their LiteSVM Rust tests pointing include_bytes!() at target/deploy/<program>.so, while build-and-test compiles the program .so into tests/fixtures/. So cargo test failed to even compile (file not found).

Fixes

realloc/native

  • Fix the include_bytes!() path → ../../tests/fixtures/realloc_program.so. Test passes.

cross-program-invocation/native

  • Fix both include_bytes!() paths → tests/fixtures/.
  • A second, subtler bug: hand depends on lever with the cpi (= no-entrypoint) feature. Building the whole workspace in one cargo build-sbf unified that feature onto lever, producing an entrypoint-less lever.so (896 bytes) that LiteSVM rejected with InvalidAccountData. build-and-test now builds each program separately, so lever.so keeps its entrypoint (81 KB) and the CPI test passes.

Both

  • Remove the dead TypeScript suites: realloc's was a false-green node:test-under-ts-mocha suite (plus its now-unused ts/ client helpers); cpi's was a localnet-only test (reads ~/.config/solana/id.json). Strip their JS tooling, regenerate the lockfiles, and rewire build-and-test to just build the fixtures the LiteSVM cargo test consumes.
  • Drop both from .github/.ghaignore so CI builds and tests them.

All verified locally against the CI toolchain (Solana 3.1.14 / platform-tools v1.52): full install → build-and-test → cargo test is green for both. realloc-program (a root workspace member) also passes cargo fmt --check + cargo clippy -D warnings.

Note: cross-program-invocation/native is its own cargo workspace (not a member of the root workspace), so rust.yml's clippy doesn't lint it; its CI is build + test via native.yml, which is green.

https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP


Generated by Claude Code

…native

Both native examples were excluded in .ghaignore as "build and test error".
The real cause was the LiteSVM Rust tests pointing include_bytes!() at
target/deploy/<program>.so, but build-and-test compiles the program .so into
tests/fixtures/ — so cargo test failed to compile (file not found).

- realloc: fix the include_bytes!() path to tests/fixtures/realloc_program.so.
- cross-program-invocation: fix both include_bytes!() paths to tests/fixtures/.
  Additionally, `hand` depends on `lever` with the `cpi` (= `no-entrypoint`)
  feature, so building the whole workspace at once unified that feature onto
  `lever` and produced an entrypoint-less lever.so (896 bytes) that LiteSVM
  rejected with InvalidAccountData. build-and-test now builds each program
  separately so lever.so keeps its entrypoint.

Also remove the false-green / localnet-only TypeScript suites (realloc's
node:test-under-ts-mocha suite plus its now-unused ts/ client helpers, and
cpi's localnet test), strip their JS tooling, and drop both examples from
.github/.ghaignore so CI builds and tests them via the LiteSVM cargo tests.
@mikemaccana mikemaccana merged commit 01c455b into main Jun 5, 2026
18 checks passed
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