Skip to content

Commit

Permalink
Add C Serialization Tests for #17217 (#17294) (#17297)
Browse files Browse the repository at this point in the history
(cherry picked from commit f15dd1b)

Co-authored-by: Jack May <jack@solana.com>
  • Loading branch information
mergify[bot] and jackcmay authored May 19, 2021
1 parent f80af6d commit c4e770e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,38 @@ fn test_program_bpf_disguised_as_bpf_loader() {
}
}

#[test]
#[cfg(feature = "bpf_c")]
fn test_program_bpf_c_dup() {
solana_logger::setup();

let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, id, entrypoint);

let account_address = Pubkey::new_unique();
let account =
AccountSharedData::new_data(42, &[1_u8, 2, 3], &solana_sdk::system_program::id()).unwrap();
bank.store_account(&account_address, &account);

let bank_client = BankClient::new(bank);

let program_id = load_bpf_program(&bank_client, &bpf_loader::id(), &mint_keypair, "ser");
let account_metas = vec![
AccountMeta::new_readonly(account_address, false),
AccountMeta::new_readonly(account_address, false),
];
let instruction = Instruction::new_with_bytes(program_id, &[4, 5, 6, 7], account_metas);
bank_client
.send_and_confirm_instruction(&mint_keypair, instruction)
.unwrap();
}

#[cfg(feature = "bpf_rust")]
#[test]
fn test_program_bpf_upgrade_via_cpi() {
Expand Down

0 comments on commit c4e770e

Please sign in to comment.