diff --git a/Cargo.toml b/Cargo.toml index 505747d..d7120e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,2 @@ [workspace] -members = ["ethereum-types", "ethbloom"] \ No newline at end of file +members = ["ethereum-types", "ethbloom"] diff --git a/no-std-tests/Cargo.toml b/no-std-tests/Cargo.toml new file mode 100644 index 0000000..0b8dba8 --- /dev/null +++ b/no-std-tests/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "no-std-tests" +version = "0.0.1" +authors = ["Parity Technologies "] +description = "Tests for no-std environments" +license = "MIT" + +[dependencies] +libc = { version = "0.2", default-features = false } +ethereum-types = { path = "../ethereum-types", default-features = false } +ethbloom = { path = "../ethbloom", default-features = false } +fixed-hash = { version = "0.2", default-features = false } diff --git a/no-std-tests/rust-toolchain b/no-std-tests/rust-toolchain new file mode 100644 index 0000000..bf867e0 --- /dev/null +++ b/no-std-tests/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/no-std-tests/src/main.rs b/no-std-tests/src/main.rs new file mode 100644 index 0000000..c0be458 --- /dev/null +++ b/no-std-tests/src/main.rs @@ -0,0 +1,27 @@ +#![feature(lang_items, start, panic_implementation)] +#![no_std] + +extern crate libc; +extern crate ethereum_types; +extern crate ethbloom; +extern crate fixed_hash; + +use ethereum_types::{Address, Public, Secret, Signature}; + +#[start] +fn start(_argc: isize, _argv: *const *const u8) -> isize { + 0 +} + +#[cfg(not(test))] +#[lang = "eh_personality"] +#[no_mangle] +pub extern "C" fn rust_eh_personality() {} + +#[cfg(not(test))] +#[panic_implementation] +fn panic(_info: &core::panic::PanicInfo) -> ! { + unsafe { + libc::abort(); + } +}