check rust programs (#4688)
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
//! @brief Example Rust-based BPF program that test dynamic memory allocation
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
@ -52,7 +53,7 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> bool {
|
||||
for i in 0..ITERS {
|
||||
assert_eq!(*ptr.add(i as usize), i as u8);
|
||||
}
|
||||
sol_log_64(0x3, 0, 0, 0, *ptr.add(42) as u64);
|
||||
sol_log_64(0x3, 0, 0, 0, u64::from(*ptr.add(42)));
|
||||
assert_eq!(*ptr.add(42), 42);
|
||||
alloc::alloc::dealloc(ptr, layout);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! @brief Example Rust-based BPF program tests dependent crates
|
||||
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! @brief Example Rust-based BPF program tests loop iteration
|
||||
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! @brief Example Rust-based BPF program tests loop iteration
|
||||
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
mod helper;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! @brief Example Rust-based BPF program that prints out the parameters passed to it
|
||||
|
||||
#![no_std]
|
||||
#![allow(unreachable_code)]
|
||||
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
@ -37,7 +38,7 @@ fn process_instruction(
|
||||
{
|
||||
// Test - arch config
|
||||
#[cfg(not(target_arch = "bpf"))]
|
||||
assert!(false);
|
||||
panic!();
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! @brief Example Rust-based BPF program that panics
|
||||
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
|
@ -21,7 +21,7 @@ fn process_instruction(
|
||||
let tick_height = LittleEndian::read_u64(k.data);
|
||||
assert_eq!(10u64, tick_height);
|
||||
sol_log("Success");
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
panic!();
|
||||
}
|
||||
|
Reference in New Issue
Block a user