Add test to exercise more args then registers (#4661)
This commit is contained in:
parent
b78a13d42c
commit
bc44516eb4
|
@ -67,7 +67,7 @@ fn main() {
|
|||
.expect("Unable to create BPF install directory")
|
||||
.success());
|
||||
|
||||
let rust_programs = ["alloc", "dep_crate", "iter", "noop", "panic"];
|
||||
let rust_programs = ["alloc", "dep_crate", "iter", "many_args", "noop", "panic"];
|
||||
for program in rust_programs.iter() {
|
||||
println!(
|
||||
"cargo:warning=(not a warning) Building Rust-based BPF programs: solana_bpf_rust_{}",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/target/
|
||||
|
||||
Cargo.lock
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
# Note: This crate must be built using build.sh
|
||||
|
||||
[package]
|
||||
name = "solana-bpf-rust-many-args"
|
||||
version = "0.16.0"
|
||||
description = "Solana BPF many-args program written in Rust"
|
||||
authors = ["Solana Maintainers <maintainers@solana.com>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
solana-sdk-bpf-utils = { path = "../../../../sdk/bpf/rust-utils", version = "0.16.0" }
|
||||
solana-bpf-rust-many-args-dep = { path = "../many_args_dep", version = "0.16.0" }
|
||||
|
||||
[workspace]
|
||||
members = []
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
name = "solana_bpf_rust_many_args"
|
|
@ -0,0 +1,6 @@
|
|||
[dependencies.compiler_builtins]
|
||||
path = "../../../../sdk/bpf/rust-bpf-sysroot/src/compiler-builtins"
|
||||
features = ["c", "mem"]
|
||||
|
||||
[target.bpfel-unknown-unknown.dependencies]
|
||||
alloc = { path = "../../../../sdk/bpf/rust-bpf-sysroot/src/liballoc" }
|
|
@ -0,0 +1,22 @@
|
|||
//! @brief Example Rust-based BPF program tests loop iteration
|
||||
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
use solana_sdk_bpf_utils::log::*;
|
||||
|
||||
pub fn many_args(
|
||||
arg1: u64,
|
||||
arg2: u64,
|
||||
arg3: u64,
|
||||
arg4: u64,
|
||||
arg5: u64,
|
||||
arg6: u64,
|
||||
arg7: u64,
|
||||
arg8: u64,
|
||||
arg9: u64,
|
||||
) -> u64 {
|
||||
sol_log("same package");
|
||||
sol_log_64(arg1, arg2, arg3, arg4, arg5);
|
||||
sol_log_64(arg6, arg7, arg8, arg9, 0);
|
||||
arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
//! @brief Example Rust-based BPF program tests loop iteration
|
||||
|
||||
#![no_std]
|
||||
|
||||
mod helper;
|
||||
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
use solana_sdk_bpf_utils::log::*;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn entrypoint(_input: *mut u8) -> bool {
|
||||
sol_log("call same package");
|
||||
assert_eq!(crate::helper::many_args(1, 2, 3, 4, 5, 6, 7, 8, 9), 45);
|
||||
sol_log("call another package");
|
||||
assert_eq!(
|
||||
solana_bpf_rust_many_args_dep::many_args(1, 2, 3, 4, 5, 6, 7, 8, 9),
|
||||
45
|
||||
);
|
||||
|
||||
sol_log("Success");
|
||||
true
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
/target/
|
||||
|
||||
Cargo.lock
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
# Note: This crate must be built using build.sh
|
||||
|
||||
[package]
|
||||
name = "solana-bpf-rust-many-args-dep"
|
||||
version = "0.16.0"
|
||||
description = "Solana BPF many-args-dep program written in Rust"
|
||||
authors = ["Solana Maintainers <maintainers@solana.com>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
solana-sdk-bpf-utils = { path = "../../../../sdk/bpf/rust-utils", version = "0.16.0" }
|
||||
|
||||
[workspace]
|
||||
members = []
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//! @brief Solana Rust-based BPF program utility functions and types
|
||||
|
||||
#![no_std]
|
||||
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
use solana_sdk_bpf_utils::log::*;
|
||||
|
||||
pub fn many_args(
|
||||
arg1: u64,
|
||||
arg2: u64,
|
||||
arg3: u64,
|
||||
arg4: u64,
|
||||
arg5: u64,
|
||||
arg6: u64,
|
||||
arg7: u64,
|
||||
arg8: u64,
|
||||
arg9: u64,
|
||||
) -> u64 {
|
||||
sol_log("another package");
|
||||
sol_log_64(arg1, arg2, arg3, arg4, arg5);
|
||||
sol_log_64(arg6, arg7, arg8, arg9, 0);
|
||||
arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9
|
||||
}
|
|
@ -86,6 +86,7 @@ mod bpf {
|
|||
let programs = [
|
||||
("solana_bpf_rust_alloc", true),
|
||||
("solana_bpf_rust_iter", true),
|
||||
// ("solana_bpf_rust_many_args", true), // Issue #3099
|
||||
("solana_bpf_rust_noop", true),
|
||||
("solana_bpf_rust_dep_crate", true),
|
||||
("solana_bpf_rust_panic", false),
|
||||
|
|
Loading…
Reference in New Issue