Skip to content

Commit

Permalink
Test with the 'c' feature enabled on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jun 22, 2017
1 parent d63757c commit a137787
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japa
utest-macros = { git = "https://github.com/japaric/utest" }


[[example]]
name = "intrinsics"
required-features = ["c"]


[workspace]
4 changes: 3 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ environment:

install:
- git submodule update --init
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe --default-host x86_64-pc-windows-msvc --default-toolchain nightly -y
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- if "%TARGET%"=="i686-pc-windows-msvc" ( rustup target add %TARGET% )
Expand All @@ -18,4 +18,6 @@ test_script:
- cargo build --target %TARGET%
- cargo build --release --target %TARGET%
- cargo test --no-default-features --features gen-tests --target %TARGET%
- cargo test --no-default-features --features "gen-tests c" --target %TARGET%
- cargo test --no-default-features --features gen-tests --release --target %TARGET%
- cargo test --no-default-features --features "gen-tests c" --release --target %TARGET%
2 changes: 2 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ case $1 in
;;
*)
cargo test --no-default-features --features gen-tests --target $1
cargo test --no-default-features --features 'gen-tests c' --target $1
cargo test --no-default-features --features gen-tests --target $1 --release
cargo test --no-default-features --features 'gen-tests c' --target $1 --release
;;
esac

Expand Down
25 changes: 6 additions & 19 deletions examples/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
#![allow(unused_features)]
#![cfg_attr(thumb, no_main)]
#![deny(dead_code)]
#![feature(alloc_system)]
#![feature(asm)]
#![feature(compiler_builtins_lib)]
#![feature(core_float)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(start)]
#![feature(i128_type)]
#![no_std]

#[cfg(not(thumb))]
extern crate libc;
extern crate alloc_system;
extern crate compiler_builtins;

// NOTE cfg(not(thumbv6m)) means that the operation is not supported on ARMv6-M at all. Not even
Expand All @@ -27,7 +27,6 @@ extern crate compiler_builtins;
// convention for its intrinsics that's different from other architectures; that's why some function
// have an additional comment: the function name is the ARM name for the intrinsic and the comment
// in the non-ARM name for the intrinsic.
#[cfg(feature = "c")]
mod intrinsics {
use core::num::Float;

Expand Down Expand Up @@ -339,7 +338,6 @@ mod intrinsics {
}
}

#[cfg(feature = "c")]
fn run() {
use intrinsics::*;

Expand Down Expand Up @@ -404,33 +402,20 @@ fn run() {
bb(modti3(bb(2), bb(2)));
}

#[cfg(all(feature = "c", not(thumb)))]
#[cfg(not(thumb))]
#[start]
fn main(_: isize, _: *const *const u8) -> isize {
run();

0
}

#[cfg(all(not(feature = "c"), not(thumb)))]
#[start]
fn main(_: isize, _: *const *const u8) -> isize {
0
}

#[cfg(all(feature = "c", thumb))]
#[cfg(thumb)]
#[no_mangle]
pub fn _start() -> ! {
run();
loop {}
}

#[cfg(all(not(feature = "c"), thumb))]
#[no_mangle]
pub fn _start() -> ! {
loop {}
}

// ARM targets need these symbols
#[no_mangle]
pub fn __aeabi_unwind_cpp_pr0() {}
Expand All @@ -447,9 +432,11 @@ pub fn _Unwind_Resume() {}
#[cfg(not(test))]
#[lang = "eh_personality"]
#[no_mangle]
#[allow(private_no_mangle_fns)]
extern "C" fn eh_personality() {}

#[cfg(not(test))]
#[lang = "panic_fmt"]
#[no_mangle]
#[allow(private_no_mangle_fns)]
extern "C" fn panic_fmt() {}

0 comments on commit a137787

Please sign in to comment.