* Add BPF test program instruction monitoring (#11984)
(cherry picked from commit fab2d44abd
)
* fix conflicts
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
@ -35,7 +35,7 @@ fn rerun_if_changed(files: &[&str], directories: &[&str], excludes: &[&str]) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let bpf_c = !env::var("CARGO_FEATURE_BPF_C").is_err();
|
||||
let bpf_c = env::var("CARGO_FEATURE_BPF_C").is_ok();
|
||||
if bpf_c {
|
||||
let install_dir =
|
||||
"OUT_DIR=../target/".to_string() + &env::var("PROFILE").unwrap() + &"/bpf".to_string();
|
||||
@ -52,7 +52,7 @@ fn main() {
|
||||
rerun_if_changed(&["c/makefile"], &["c/src", "../../sdk"], &["/target/"]);
|
||||
}
|
||||
|
||||
let bpf_rust = !env::var("CARGO_FEATURE_BPF_RUST").is_err();
|
||||
let bpf_rust = env::var("CARGO_FEATURE_BPF_RUST").is_ok();
|
||||
if bpf_rust {
|
||||
let install_dir =
|
||||
"target/".to_string() + &env::var("PROFILE").unwrap() + &"/bpf".to_string();
|
||||
@ -100,7 +100,7 @@ fn main() {
|
||||
.arg(&src)
|
||||
.arg(&install_dir)
|
||||
.status()
|
||||
.expect(&format!("Failed to cp {} to {}", src, install_dir))
|
||||
.unwrap_or_else(|_| panic!("Failed to cp {} to {}", src, install_dir))
|
||||
.success());
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ use solana_sdk::{
|
||||
instruction::{AccountMeta, CompiledInstruction, Instruction, InstructionError},
|
||||
message::Message,
|
||||
pubkey::Pubkey,
|
||||
signature::Keypair,
|
||||
signature::Signer,
|
||||
signature::{Keypair, Signer},
|
||||
sysvar::{clock, fees, rent, rewards, slot_hashes, stake_history},
|
||||
transaction::TransactionError,
|
||||
};
|
||||
@ -84,7 +83,7 @@ fn run_program(
|
||||
)
|
||||
.unwrap();
|
||||
let mut parameter_bytes = serialize_parameters(
|
||||
&bpf_loader::id(),
|
||||
&loader_id,
|
||||
program_id,
|
||||
parameter_accounts,
|
||||
&instruction_data,
|
||||
@ -95,7 +94,7 @@ fn run_program(
|
||||
vm.execute_program(parameter_bytes.as_mut_slice(), &[], &[heap_region.clone()])
|
||||
.unwrap()
|
||||
);
|
||||
deserialize_parameters(&bpf_loader::id(), parameter_accounts, ¶meter_bytes).unwrap();
|
||||
deserialize_parameters(&loader_id, parameter_accounts, ¶meter_bytes).unwrap();
|
||||
Ok(vm.get_total_instruction_count())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user