check rust programs (#4688)

This commit is contained in:
Jack May
2019-06-20 07:43:31 -07:00
committed by GitHub
parent f8523db51d
commit b430762a23
16 changed files with 46 additions and 18 deletions

View File

@ -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);
}

View File

@ -1,6 +1,7 @@
//! @brief Example Rust-based BPF program tests dependent crates
#![no_std]
#![allow(unused_attributes)]
extern crate solana_sdk_bpf_utils;

View File

@ -1,6 +1,7 @@
//! @brief Example Rust-based BPF program tests loop iteration
#![no_std]
#![allow(unused_attributes)]
extern crate solana_sdk_bpf_utils;

View File

@ -1,6 +1,7 @@
//! @brief Example Rust-based BPF program tests loop iteration
#![no_std]
#![allow(unused_attributes)]
mod helper;

View File

@ -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!();
}
{

View File

@ -1,6 +1,7 @@
//! @brief Example Rust-based BPF program that panics
#![no_std]
#![allow(unused_attributes)]
extern crate solana_sdk_bpf_utils;

View File

@ -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!();
}