0

It is important in development of anything (including Solana programs) to be able to track code coverage.

Is there a way to get the coverage for BPF/SBF-based tests?

1 Answer 1

1

It's not perfect, but if you can run your tests with solana-program-test https://docs.rs/solana-program-test/latest/solana_program_test/ and use prefer_bpf(false), then the tests will run all in Rust, so you can do coverage reports, ie:

#[test]
fn my_test() {
    let mut program_test = solana_program_test::ProgramTest::default();
    program_test.prefer_bpf(false);
    program_test.add_program(
        "my-program",
        my_program_id,
        solana_program_test::processor!(my_programs_process_instruction),
    );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.