Skip to content
This repository was archived by the owner on Sep 19, 2019. It is now read-only.

Commit 020b5d8

Browse files
authored
Merge pull request #44 from paritytech/na-add-no-std-tests
Add `no std tests`
2 parents c81b0fc + 340c5e8 commit 020b5d8

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[workspace]
2-
members = ["uint", "fixed-hash", "ethereum-types", "tests", "ethbloom"]
2+
members = ["uint", "fixed-hash", "ethereum-types", "tests", "ethbloom", "no-std-tests"]

no-std-tests/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "no-std-tests"
3+
version = "0.0.1"
4+
authors = ["Parity Technologies <[email protected]>"]
5+
description = "Tests for no-std environments"
6+
license = "MIT"
7+
8+
[dependencies]
9+
libc = { version = "0.2", default-features = false }
10+
ethereum-types = { path = "../ethereum-types", default-features = false }
11+
ethbloom = { path = "../ethbloom", default-features = false }
12+
fixed-hash = { version = "0.2", default-features = false }

no-std-tests/rust-toolchain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nightly

no-std-tests/src/main.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#![feature(lang_items, start, panic_implementation)]
2+
#![no_std]
3+
4+
extern crate libc;
5+
extern crate ethereum_types;
6+
extern crate ethbloom;
7+
extern crate fixed_hash;
8+
9+
use ethereum_types::{Address, Public, Secret, Signature};
10+
11+
#[start]
12+
fn start(_argc: isize, _argv: *const *const u8) -> isize {
13+
0
14+
}
15+
16+
#[cfg(not(test))]
17+
#[lang = "eh_personality"]
18+
#[no_mangle]
19+
pub extern "C" fn rust_eh_personality() {}
20+
21+
#[cfg(not(test))]
22+
#[panic_implementation]
23+
fn panic(_info: &core::panic::PanicInfo) -> ! {
24+
unsafe {
25+
libc::abort();
26+
}
27+
}

0 commit comments

Comments
 (0)