Merge pull request #44 from paritytech/na-add-no-std-tests

Add `no std tests`
This commit is contained in:
Niklas Adolfsson 2018-08-01 23:06:12 +02:00 committed by GitHub
commit 020b5d855e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 1 deletions

View File

@ -1,2 +1,2 @@
[workspace]
members = ["uint", "fixed-hash", "ethereum-types", "tests", "ethbloom"]
members = ["uint", "fixed-hash", "ethereum-types", "tests", "ethbloom", "no-std-tests"]

12
no-std-tests/Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "no-std-tests"
version = "0.0.1"
authors = ["Parity Technologies <admin@parity.io>"]
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 }

View File

@ -0,0 +1 @@
nightly

27
no-std-tests/src/main.rs Normal file
View File

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