Skip to content

Commit 8f5a335

Browse files
authored
implement mollusk conformance testing (#42)
* implement mollusk conformance testing * use `target` artifact dir * rip
1 parent 0d33b93 commit 8f5a335

File tree

4 files changed

+34
-89
lines changed

4 files changed

+34
-89
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ jobs:
141141
exit 1;
142142
fi
143143
144-
fd_conformance:
145-
name: Builtin-BPF Conformance Test
144+
conformance:
145+
name: Conformance Test
146146
runs-on: ubuntu-latest
147147
needs: build_programs
148148
steps:
@@ -160,16 +160,17 @@ jobs:
160160
run: |
161161
sudo apt-get update
162162
sudo apt-get install -y libudev-dev pkg-config
163+
cargo install mollusk-svm-cli
163164
164165
- name: Restore Program Builds
165166
uses: actions/cache/restore@v4
166167
with:
167168
path: ./**/*.so
168169
key: ${{ runner.os }}-builds-${{ github.sha }}
169170

170-
- name: Builtin-BPF Conformance Test
171+
- name: Conformance Test
171172
shell: bash
172-
run: pnpm zx ./scripts/ci/fd-conformance.mjs
173+
run: pnpm zx ./scripts/ci/conformance.mjs
173174

174175
## SKIP: IDL is hand-cranked here for now.
175176
##

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[workspace]
22
resolver = "2"
33
members = ["clients/rust", "program"]
4-
# Required for CI
5-
exclude = ["solana-conformance/impl/solfuzz-agave"]
64

75
[workspace.package]
86
authors = ["Anza Technology Maintainers <[email protected]>"]

scripts/ci/conformance.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env zx
2+
3+
// Mollusk conformance testing of this Core BPF Config program against the
4+
// version running on mainnet-beta.
5+
6+
import 'zx/globals';
7+
import { getProgramId, getProgramSharedObjectPath, workingDirectory } from '../utils.mjs';
8+
9+
const programId = getProgramId('program');
10+
const programBinaryPath = getProgramSharedObjectPath('program');
11+
const baseBinaryDirPath = path.join(workingDirectory, 'target', 'dump-solana');
12+
const baseBinaryPath = path.join(baseBinaryDirPath, 'base.so');
13+
const molluskFixturesPath = path.join(workingDirectory, 'program', 'fuzz', 'blob');
14+
15+
// Clone the program from mainnet-beta.
16+
await $`mkdir -p ${baseBinaryDirPath}`;
17+
await $`solana program dump -um ${programId} ${baseBinaryPath}`;
18+
19+
// Test this program against the cloned program for conformance with Mollusk.
20+
let output = await $`mollusk run-test \
21+
--proto firedancer \
22+
${baseBinaryPath} ${programBinaryPath} \
23+
${molluskFixturesPath} ${programId}`;
24+
25+
// The last line of output should exactly match the following:
26+
// [DONE][TEST RESULT]: 0 failures
27+
if (!output.stdout.includes("[DONE][TEST RESULT]: 0 failures")) {
28+
throw new Error(`Error: mismatches detected.`);
29+
}

scripts/ci/fd-conformance.mjs

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)