Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C Serialization Tests for #17217 (backport #17294) #17297

Merged
merged 1 commit into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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