Skip to content

Commit

Permalink
ci: route mollusk fixtures into fd conformance
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Nov 25, 2024
1 parent 6e458b0 commit 32feda1
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions scripts/ci/fd-conformance.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ for (const fixture of skipFixtures) {

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

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

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

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

console.log('All tests passed.');
console.log('All Firedancer conformance tests passed.');

// Build the Agave target with the BPF version, this time without any
// conformance special-casing (just the `core-bpf` feature).
await $`CORE_BPF_PROGRAM_ID=${getProgramId('program')} \
CORE_BPF_TARGET=${getProgramSharedObjectPath('program')} \
FORCE_RECOMPILE=true \
cargo build --manifest-path ${solFuzzAgaveManifestPath} \
--lib --release --target x86_64-unknown-linux-gnu --features core-bpf`;
await $`mv ${solFuzzAgaveTargetPath} ${testTargetPathCoreBpf}`;

// Now run the conformance harness on just the BPF program with the fixtures
// generated by Mollusk in the program's `fuzz/blob` directory.
const molluskFixturesPath = path.join(workingDirectory, 'program', 'fuzz', 'blob');
const result = await $`source test_suite_env/bin/activate && \
solana-test-suite exec-fixtures \
-i ${molluskFixturesPath} \
-t ${testTargetPathCoreBpf}`;

// Assert conformance.
// There should be no "Failed tests:" section in the output.
if (/Failed tests:/.test(result.stdout.split('\n').slice(-2).join('\n'))) {
console.error("Error: Some Mollusk-generated fixture executions failed.");
process.exit(1);
} else {
console.log('All Mollusk-generated fixture executions passed.');
}

0 comments on commit 32feda1

Please sign in to comment.