Remove bloat due to test symbols (#5965)
This commit is contained in:
3
sdk/bpf/rust/test/.gitignore
vendored
Normal file
3
sdk/bpf/rust/test/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/target/
|
||||
/farf/
|
||||
Cargo.lock
|
12
sdk/bpf/rust/test/Cargo.toml
Normal file
12
sdk/bpf/rust/test/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "solana-sdk-bpf-test"
|
||||
version = "0.19.0-pre0"
|
||||
description = "Solana BPF SDK test utilities"
|
||||
authors = ["Solana Maintainers <maintainers@solana.com>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[workspace]
|
||||
members = []
|
@ -11,3 +11,15 @@ pub unsafe fn sol_log_(message: *const u8, length: u64) {
|
||||
pub fn sol_log_64_(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64) {
|
||||
std::println!("{} {} {} {} {}", arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
|
||||
#[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);
|
||||
}
|
||||
};
|
||||
}
|
@ -25,7 +25,6 @@ pub mod timing;
|
||||
pub mod account_info;
|
||||
pub mod entrypoint;
|
||||
pub mod log;
|
||||
pub mod program_test;
|
||||
|
||||
// Modules not usable by on-chain programs
|
||||
#[cfg(not(feature = "program"))]
|
||||
|
@ -27,26 +27,35 @@ macro_rules! info {
|
||||
/// Prints a string to stdout
|
||||
///
|
||||
/// @param message - Message to print
|
||||
#[cfg(feature = "program")]
|
||||
pub fn sol_log(message: &str) {
|
||||
unsafe {
|
||||
sol_log_(message.as_ptr(), message.len() as u64);
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "program")]
|
||||
extern "C" {
|
||||
fn sol_log_(message: *const u8, length: u64);
|
||||
}
|
||||
#[cfg(not(feature = "program"))]
|
||||
pub fn sol_log(_message: &str) {}
|
||||
|
||||
/// Prints 64 bit values represented as hexadecimal to stdout
|
||||
///
|
||||
/// @param argx - integer arguments to print
|
||||
|
||||
#[cfg(feature = "program")]
|
||||
pub fn sol_log_64(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64) {
|
||||
unsafe {
|
||||
sol_log_64_(arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "program")]
|
||||
extern "C" {
|
||||
fn sol_log_64_(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64);
|
||||
}
|
||||
#[cfg(not(feature = "program"))]
|
||||
pub fn sol_log_64(_arg1: u64, _arg2: u64, _arg3: u64, _arg4: u64, _arg5: u64) {}
|
||||
|
||||
/// Prints the hexadecimal representation of a slice
|
||||
///
|
||||
@ -65,7 +74,7 @@ pub fn sol_log_slice(slice: &[u8]) {
|
||||
#[allow(dead_code)]
|
||||
pub fn sol_log_params(accounts: &[AccountInfo], data: &[u8]) {
|
||||
for (i, account) in accounts.iter().enumerate() {
|
||||
sol_log("SolKeyedAccount");
|
||||
sol_log("AccountInfo");
|
||||
sol_log_64(0, 0, 0, 0, i as u64);
|
||||
sol_log("- Is signer");
|
||||
sol_log_64(0, 0, 0, 0, account.is_signer as u64);
|
||||
|
Reference in New Issue
Block a user