Skip to content

Commit 784a6e7

Browse files
committed
Quick test nostd build
Signed-off-by: Tom Kaitchuck <tom.kaitchuck@emc.com>
1 parent 58cc385 commit 784a6e7

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

test-block/Cargo.toml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "test-block"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[profile.release]
7+
panic = 'abort'
8+
9+
[profile.test]
10+
panic = 'abort'
11+
12+
[profile.dev]
13+
panic = 'abort'
14+
15+
[dependencies]
16+
ahash = { path = "../", default-features = false }
17+
spin = "0.9.8"
18+
talc = "4.4.1"
19+
panic-abort = "0.3.2"

test-block/src/main.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#![no_std]
2+
#![feature(start)]
3+
4+
use ahash::RandomState;
5+
6+
use talc::*;
7+
8+
extern crate alloc;
9+
extern crate panic_abort;
10+
11+
static mut ARENA: [u8; 1024*1024] = [0; 1024*1024];
12+
13+
#[global_allocator]
14+
static ALLOCATOR: Talck<spin::Mutex<()>, ClaimOnOom> = Talc::new(unsafe {
15+
// if we're in a hosted environment, the Rust runtime may allocate before
16+
// main() is called, so we need to initialize the arena automatically
17+
ClaimOnOom::new(Span::from_const_array(core::ptr::addr_of!(ARENA)))
18+
}).lock();
19+
20+
21+
#[start]
22+
fn start(_argc: isize, _argv: *const *const u8) -> isize {
23+
// let state = RandomState::with_seeds(1, 2, 3, 4);
24+
//let mut sum: u64 = 0;
25+
// let mut payload: [u8; 8196] = [0; 8196];
26+
// for i in 0..1024 {
27+
// payload.fill(i as u8);
28+
// sum = sum.wrapping_add(state.hash_one(&payload));
29+
// }
30+
0 as isize
31+
}

0 commit comments

Comments
 (0)