diff --git a/core/src/test_validator.rs b/core/src/test_validator.rs index 3ddadf36c6..f75b4eabfe 100644 --- a/core/src/test_validator.rs +++ b/core/src/test_validator.rs @@ -49,6 +49,7 @@ pub struct TestValidatorGenesis { rpc_config: JsonRpcConfig, rpc_ports: Option<(u16, u16)>, // (JsonRpc, JsonRpcPubSub), None == random ports warp_slot: Option, + no_bpf_jit: bool, accounts: HashMap, programs: Vec, } @@ -84,6 +85,11 @@ impl TestValidatorGenesis { self } + pub fn bpf_jit(&mut self, bpf_jit: bool) -> &mut Self { + self.no_bpf_jit = !bpf_jit; + self + } + /// Add an account to the test environment pub fn add_account(&mut self, address: Pubkey, account: Account) -> &mut Self { self.accounts.insert(address, account); @@ -394,6 +400,7 @@ impl TestValidator { }), enforce_ulimit_nofile: false, warp_slot: config.warp_slot, + bpf_jit: !config.no_bpf_jit, ..ValidatorConfig::default() }; diff --git a/validator/src/bin/solana-test-validator.rs b/validator/src/bin/solana-test-validator.rs index 13f6674126..06d6bf487c 100644 --- a/validator/src/bin/solana-test-validator.rs +++ b/validator/src/bin/solana-test-validator.rs @@ -140,6 +140,12 @@ fn main() { If the ledger already exists then this parameter is silently ignored", ), ) + .arg( + Arg::with_name("no_bpf_jit") + .long("no-bpf-jit") + .takes_value(false) + .help("Disable the just-in-time compiler and instead use the interpreter for BPF"), + ) .arg( Arg::with_name("clone_account") .long("clone") @@ -203,6 +209,7 @@ fn main() { IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), FAUCET_PORT, )); + let bpf_jit = !matches.is_present("no_bpf_jit"); let mut programs = vec![]; if let Some(values) = matches.values_of("bpf_program") { @@ -376,6 +383,7 @@ fn main() { faucet_addr, ..JsonRpcConfig::default() }) + .bpf_jit(bpf_jit) .rpc_port(rpc_port) .add_programs_with_path(&programs);