Pull program stubs into SDK (#10704)
This commit is contained in:
3
sdk/bpf/rust/test/.gitignore
vendored
3
sdk/bpf/rust/test/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
/target/
|
||||
/farf/
|
||||
Cargo.lock
|
@ -1,15 +0,0 @@
|
||||
[package]
|
||||
name = "solana-sdk-bpf-test"
|
||||
version = "1.3.0"
|
||||
description = "Solana BPF SDK test utilities"
|
||||
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[workspace]
|
||||
members = []
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
@ -1,32 +0,0 @@
|
||||
//! @brief Stubs for syscalls when building tests for x86
|
||||
|
||||
#[no_mangle]
|
||||
/// # Safety
|
||||
pub unsafe fn sol_log_(message: *const u8, length: u64) {
|
||||
let slice = std::slice::from_raw_parts(message, length as usize);
|
||||
let string = std::str::from_utf8(&slice).unwrap();
|
||||
std::println!("{}", string);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn sol_log_64_(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64) {
|
||||
std::println!("{} {} {} {} {}", arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn sol_invoke_signed_rust() {
|
||||
std::println!("sol_invoke_signed_rust()");
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! stubs {
|
||||
() => {
|
||||
#[test]
|
||||
fn pull_in_externs() {
|
||||
use $crate::*;
|
||||
unsafe { sol_log_("sol_log_".as_ptr(), 8) };
|
||||
sol_log_64_(1, 2, 3, 4, 5);
|
||||
sol_invoke_signed_rust();
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user