Skip to content

Commit

Permalink
Add a basic test crate for no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
Ogeon committed Aug 11, 2019
1 parent 4e28c57 commit 83e369a
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ script:
- cargo test -v --features strict
- bash ../scripts/test_features.sh

- if [ "$TRAVIS_RUST_VERSION" = "nightly" ]; then
cd ../no_std_test;
cargo build -v;
fi

- cd ..
- cargo doc
after_success:
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[workspace]
members = [
"palette",
"palette_derive"
"palette_derive",

# Test crates
"no_std_test"
]
13 changes: 13 additions & 0 deletions no_std_test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "no_std_test"
version = "0.0.0"
authors = ["Erik Hedvall <hello@erikhedvall.nu>"]
exclude = []
description = "Test crate for #[no_std]."
repository = "/~https://github.com/Ogeon/palette"
license = "MIT OR Apache-2.0"

[dependencies.palette]
path = "../palette"
default-features = false
features = ["named"]
1 change: 1 addition & 0 deletions no_std_test/LICENSE-APACHE
1 change: 1 addition & 0 deletions no_std_test/LICENSE-MIT
26 changes: 26 additions & 0 deletions no_std_test/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#![feature(lang_items, start, link_args)]
#![no_std]

// A bit of a hack to make the linking go through.
// This binary is not meant to be used, only to be compiled.
#![allow(unused_attributes)]
#![link_args="-nostdlib"]

extern crate palette;

use core::panic::PanicInfo;

#[start]
fn start(_argc: isize, _argv: *const *const u8) -> isize {
let _magenta = palette::Srgb::new(255u8, 0, 255);

0
}

#[lang = "eh_personality"]
extern fn eh_personality() {}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}

0 comments on commit 83e369a

Please sign in to comment.