Add rand dependency test (#12566)

* Add rand dependency test

* nudge
This commit is contained in:
Jack May 2020-09-29 17:25:51 -07:00 committed by GitHub
parent d158d45051
commit 777342a1ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 0 deletions

View File

@ -1896,6 +1896,15 @@ dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-rand"
version = "1.4.0"
dependencies = [
"getrandom",
"rand",
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-sanity"
version = "1.4.0"

View File

@ -52,6 +52,7 @@ members = [
"rust/panic",
"rust/param_passing",
"rust/param_passing_dep",
"rust/rand",
"rust/sanity",
"rust/sysval",
]

View File

@ -80,6 +80,7 @@ fn main() {
"noop",
"panic",
"param_passing",
"rand",
"sanity",
"sysval",
];

View File

@ -0,0 +1,28 @@
# Note: This crate must be built using do.sh
[package]
name = "solana-bpf-rust-rand"
version = "1.4.0"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
getrandom = { version = "0.1.14", features = ["dummy"] }
rand = "0.7"
solana-sdk = { path = "../../../../sdk/", version = "1.4.0", default-features = false }
[features]
program = ["solana-sdk/program"]
default = ["program", "solana-sdk/default"]
[lib]
name = "solana_bpf_rust_rand"
crate-type = ["cdylib"]
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []

View File

@ -0,0 +1,18 @@
//! @brief Example Rust-based BPF program that tests rand behavior
#![allow(unreachable_code)]
extern crate solana_sdk;
use solana_sdk::{
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, info, pubkey::Pubkey,
};
entrypoint!(process_instruction);
fn process_instruction(
_program_id: &Pubkey,
_accounts: &[AccountInfo],
_instruction_data: &[u8],
) -> ProgramResult {
info!("rand");
Ok(())
}

View File

@ -152,6 +152,7 @@ fn test_program_bpf_sanity() {
("solana_bpf_rust_noop", true),
("solana_bpf_rust_panic", false),
("solana_bpf_rust_param_passing", true),
("solana_bpf_rust_rand", true),
("solana_bpf_rust_sanity", true),
("solana_bpf_rust_sysval", true),
]);