Skip to content

Commit 925ae01

Browse files
committed
ci: route mollusk fixtures into fd conformance
1 parent d223083 commit 925ae01

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

scripts/ci/fd-conformance.mjs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ for (const fixture of skipFixtures) {
3333

3434
// Clone the SolFuzz-Agave harness.
3535
const solFuzzAgavePath = path.join(harnessPath, 'impl', 'solfuzz-agave');
36-
await $`git clone -b agave-v2.1.0 http://github.com/firedancer-io/solfuzz-agave.git ${solFuzzAgavePath}`;
36+
await $`git clone -b core-bpf-conformance http://github.com/buffalojoec/solfuzz-agave.git ${solFuzzAgavePath}`;
3737

3838
// Fetch protobuf files.
3939
await $`make -j -C ${solFuzzAgavePath} fetch_proto`
@@ -62,13 +62,14 @@ await $`cargo build --manifest-path ${solFuzzAgaveManifestPath} \
6262
--lib --release --target x86_64-unknown-linux-gnu`;
6363
await $`mv ${solFuzzAgaveTargetPath} ${testTargetPathBuiltin}`;
6464

65-
// Build the Agave target with the BPF version.
65+
// Build the Agave target with the BPF version and special-casing enabled for
66+
// conformance testing (`core-bpf-conformance` features).
6667
const testTargetPathCoreBpf = path.join(testTargetsDir, 'core_bpf.so');
6768
await $`CORE_BPF_PROGRAM_ID=${getProgramId('program')} \
6869
CORE_BPF_TARGET=${getProgramSharedObjectPath('program')} \
6970
FORCE_RECOMPILE=true \
7071
cargo build --manifest-path ${solFuzzAgaveManifestPath} \
71-
--lib --release --target x86_64-unknown-linux-gnu --features core-bpf`;
72+
--lib --release --target x86_64-unknown-linux-gnu --features core-bpf-conformance`;
7273
await $`mv ${solFuzzAgaveTargetPath} ${testTargetPathCoreBpf}`;
7374

7475
// Remove any test results if they exist.
@@ -87,4 +88,30 @@ if (fs.existsSync('test_results/failed_protobufs')) {
8788
}
8889
}
8990

90-
console.log('All tests passed.');
91+
console.log('All Firedancer conformance tests passed.');
92+
93+
// Build the Agave target with the BPF version, this time without any
94+
// conformance special-casing (just the `core-bpf` feature).
95+
await $`CORE_BPF_PROGRAM_ID=${getProgramId('program')} \
96+
CORE_BPF_TARGET=${getProgramSharedObjectPath('program')} \
97+
FORCE_RECOMPILE=true \
98+
cargo build --manifest-path ${solFuzzAgaveManifestPath} \
99+
--lib --release --target x86_64-unknown-linux-gnu --features core-bpf`;
100+
await $`mv ${solFuzzAgaveTargetPath} ${testTargetPathCoreBpf}`;
101+
102+
// Now run the conformance harness on just the BPF program with the fixtures
103+
// generated by Mollusk in the program's `fuzz/blob` directory.
104+
const molluskFixturesPath = path.join(workingDirectory, 'program', 'fuzz', 'blob');
105+
const result = await $`source test_suite_env/bin/activate && \
106+
solana-test-suite exec-fixtures \
107+
-i ${molluskFixturesPath} \
108+
-t ${testTargetPathCoreBpf}`;
109+
110+
// Assert conformance.
111+
// There should be no "Failed tests:" section in the output.
112+
if (/Failed tests:/.test(result.stdout.split('\n').slice(-2).join('\n'))) {
113+
console.error("Error: Some Mollusk-generated fixture executions failed.");
114+
process.exit(1);
115+
} else {
116+
console.log('All Mollusk-generated fixture executions passed.');
117+
}

0 commit comments

Comments
 (0)