Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI for thumb* targets #232

Merged
merged 6 commits into from
Feb 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,8 @@ mod c {
if llvm_target[0] == "thumbv6m" {
sources.remove(
&[
"aeabi_cdcmp",
"aeabi_cfcmp",
"aeabi_dcmp",
"aeabi_fcmp",
"clzdi2",
"clzsi2",
"comparesf2",
"divmodsi4",
"modsi3",
"switch16",
Expand Down
21 changes: 11 additions & 10 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ fi
# Test our implementation
case $1 in
thumb*)
for t in $(ls tests); do
run="xargo test --manifest-path testcrate/Cargo.toml --target $1"
for t in $(ls testcrate/tests); do
t=${t%.rs}

# TODO(#154) enable these tests when aeabi_*mul are implemented
case $t in
powi*f2)
continue
;;
esac

xargo test --test $t --target $1 --features 'mem gen-tests' --no-run
RUSTFLAGS="-C debug-assertions=no -C lto" \
CARGO_INCREMENTAL=0 \
$run --test $t --no-default-features --features 'mem c' --no-run
qemu-arm-static target/${1}/debug/$t-*
done

xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
for t in $(ls testcrate/tests); do
t=${t%.rs}
RUSTFLAGS="-C lto" \
CARGO_INCREMENTAL=0 \
$run --test $t --no-default-features --features 'mem c' --no-run --release
qemu-arm-static target/${1}/release/$t-*
done
;;
Expand Down
7 changes: 5 additions & 2 deletions src/int/sdiv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ intrinsics! {
a.div(b)
}

#[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))]
#[use_c_shim_if(all(target_arch = "arm",
not(target_os = "ios")),
not(thumbv6m))]
pub extern "C" fn __modsi3(a: i32, b: i32) -> i32 {
a.mod_(b)
}
Expand All @@ -87,7 +89,8 @@ intrinsics! {
a.mod_(b)
}

#[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))]
#[use_c_shim_if(all(target_arch = "arm",
not(target_os = "ios"), not(thumbv6m)))]
pub extern "C" fn __divmodsi4(a: i32, b: i32, rem: &mut i32) -> i32 {
a.divmod(b, rem, |a, b| __divsi3(a, b))
}
Expand Down
4 changes: 3 additions & 1 deletion src/int/udiv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ intrinsics! {
(q << 1) | carry
}

#[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))]
#[use_c_shim_if(all(target_arch = "arm",
not(target_os = "ios"),
not(thumbv6m)))]
/// Returns `n % d`
pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 {
let q = __udivsi3(n, d);
Expand Down
5 changes: 4 additions & 1 deletion testcrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rand = { version = "0.4", features = ["i128_support"] }
[dependencies.compiler_builtins]
path = ".."
default-features = false
features = ["mangled-names", "no-lang-items"]
features = ["no-lang-items"]

[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies]
test = { git = "https://github.com/japaric/utest" }
Expand All @@ -23,3 +23,6 @@ utest-macros = { git = "https://github.com/japaric/utest" }

[features]
c = ["compiler_builtins/c"]
mem = ["compiler_builtins/mem"]
mangled-names = ["compiler_builtins/mangled-names"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this perhaps be turned on by default? I was hoping to keep cargo test working in the testcrate directory "mostly working by default" if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean 'default = ["mangled-names"]' only ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

default = ["mangled-names"]
8 changes: 1 addition & 7 deletions testcrate/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
#![no_std]
1 change: 1 addition & 0 deletions testcrate/tests/aeabi_memclr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
target_os = "linux",
feature = "mem"))]
#![feature(compiler_builtins_lib)]
#![feature(lang_items)]
#![no_std]

extern crate compiler_builtins;
Expand Down
1 change: 1 addition & 0 deletions testcrate/tests/aeabi_memcpy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
target_os = "linux",
feature = "mem"))]
#![feature(compiler_builtins_lib)]
#![feature(lang_items)]
#![no_std]

extern crate compiler_builtins;
Expand Down
1 change: 1 addition & 0 deletions testcrate/tests/aeabi_memset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
target_os = "linux",
feature = "mem"))]
#![feature(compiler_builtins_lib)]
#![feature(lang_items)]
#![no_std]

extern crate compiler_builtins;
Expand Down
29 changes: 29 additions & 0 deletions testcrate/tests/generated.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
#![feature(compiler_builtins_lib)]
#![feature(i128_type)]
#![feature(lang_items, core_float, core_float_bits)]
#![allow(bad_style)]
#![allow(unused_imports)]
#![no_std]

use core::num::Float;

extern crate compiler_builtins;

#[cfg(all(target_arch = "arm",
not(any(target_env = "gnu", target_env = "musl")),
target_os = "linux",
test))]
extern crate utest_cortex_m_qemu;

#[cfg(all(target_arch = "arm",
not(any(target_env = "gnu", target_env = "musl")),
target_os = "linux",
test))]
#[macro_use]
extern crate utest_macros;

#[cfg(all(target_arch = "arm",
not(any(target_env = "gnu", target_env = "musl")),
target_os = "linux",
test))]
macro_rules! panic { // overrides `panic!`
($($tt:tt)*) => {
upanic!($($tt)*);
};
}

include!(concat!(env!("OUT_DIR"), "/generated.rs"));