Skip to content

Commit cfecfa2

Browse files
committed
Auto merge of #232 - paoloteti:fix-thumb-ci, r=alexcrichton
Fix CI for thumb* targets Main fix is inside `utest` (implement Termination to avoid ICE) all the rest are minor fixes due to the new `testcrate`. Thumb6m needs some extra fixes: some undefined reference and a panic raised removing assembly implementation not in the list. Still allow failures on TravisCI and keep my `utest` fork for a while. Let's see if is stable.
2 parents 266ea07 + 9e99aa2 commit cfecfa2

File tree

10 files changed

+56
-26
lines changed

10 files changed

+56
-26
lines changed

build.rs

-5
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,8 @@ mod c {
423423
if llvm_target[0] == "thumbv6m" {
424424
sources.remove(
425425
&[
426-
"aeabi_cdcmp",
427-
"aeabi_cfcmp",
428-
"aeabi_dcmp",
429-
"aeabi_fcmp",
430426
"clzdi2",
431427
"clzsi2",
432-
"comparesf2",
433428
"divmodsi4",
434429
"modsi3",
435430
"switch16",

ci/run.sh

+11-10
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ fi
2424
# Test our implementation
2525
case $1 in
2626
thumb*)
27-
for t in $(ls tests); do
27+
run="xargo test --manifest-path testcrate/Cargo.toml --target $1"
28+
for t in $(ls testcrate/tests); do
2829
t=${t%.rs}
2930

30-
# TODO(#154) enable these tests when aeabi_*mul are implemented
31-
case $t in
32-
powi*f2)
33-
continue
34-
;;
35-
esac
36-
37-
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run
31+
RUSTFLAGS="-C debug-assertions=no -C lto" \
32+
CARGO_INCREMENTAL=0 \
33+
$run --test $t --no-default-features --features 'mem c' --no-run
3834
qemu-arm-static target/${1}/debug/$t-*
35+
done
3936

40-
xargo test --test $t --target $1 --features 'mem gen-tests' --no-run --release
37+
for t in $(ls testcrate/tests); do
38+
t=${t%.rs}
39+
RUSTFLAGS="-C lto" \
40+
CARGO_INCREMENTAL=0 \
41+
$run --test $t --no-default-features --features 'mem c' --no-run --release
4142
qemu-arm-static target/${1}/release/$t-*
4243
done
4344
;;

src/int/sdiv.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ intrinsics! {
7272
a.div(b)
7373
}
7474

75-
#[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))]
75+
#[use_c_shim_if(all(target_arch = "arm",
76+
not(target_os = "ios")),
77+
not(thumbv6m))]
7678
pub extern "C" fn __modsi3(a: i32, b: i32) -> i32 {
7779
a.mod_(b)
7880
}
@@ -87,7 +89,8 @@ intrinsics! {
8789
a.mod_(b)
8890
}
8991

90-
#[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))]
92+
#[use_c_shim_if(all(target_arch = "arm",
93+
not(target_os = "ios"), not(thumbv6m)))]
9194
pub extern "C" fn __divmodsi4(a: i32, b: i32, rem: &mut i32) -> i32 {
9295
a.divmod(b, rem, |a, b| __divsi3(a, b))
9396
}

src/int/udiv.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ intrinsics! {
209209
(q << 1) | carry
210210
}
211211

212-
#[use_c_shim_if(all(target_arch = "arm", not(target_os = "ios")))]
212+
#[use_c_shim_if(all(target_arch = "arm",
213+
not(target_os = "ios"),
214+
not(thumbv6m)))]
213215
/// Returns `n % d`
214216
pub extern "C" fn __umodsi3(n: u32, d: u32) -> u32 {
215217
let q = __udivsi3(n, d);

testcrate/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ rand = { version = "0.4", features = ["i128_support"] }
1414
[dependencies.compiler_builtins]
1515
path = ".."
1616
default-features = false
17-
features = ["mangled-names", "no-lang-items"]
17+
features = ["no-lang-items"]
1818

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

2424
[features]
2525
c = ["compiler_builtins/c"]
26+
mem = ["compiler_builtins/mem"]
27+
mangled-names = ["compiler_builtins/mangled-names"]
28+
default = ["mangled-names"]

testcrate/src/lib.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
#[cfg(test)]
2-
mod tests {
3-
#[test]
4-
fn it_works() {
5-
assert_eq!(2 + 2, 4);
6-
}
7-
}
1+
#![no_std]

testcrate/tests/aeabi_memclr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
target_os = "linux",
44
feature = "mem"))]
55
#![feature(compiler_builtins_lib)]
6+
#![feature(lang_items)]
67
#![no_std]
78

89
extern crate compiler_builtins;

testcrate/tests/aeabi_memcpy.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
target_os = "linux",
44
feature = "mem"))]
55
#![feature(compiler_builtins_lib)]
6+
#![feature(lang_items)]
67
#![no_std]
78

89
extern crate compiler_builtins;

testcrate/tests/aeabi_memset.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
target_os = "linux",
44
feature = "mem"))]
55
#![feature(compiler_builtins_lib)]
6+
#![feature(lang_items)]
67
#![no_std]
78

89
extern crate compiler_builtins;

testcrate/tests/generated.rs

+29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
1+
#![feature(compiler_builtins_lib)]
12
#![feature(i128_type)]
3+
#![feature(lang_items, core_float, core_float_bits)]
24
#![allow(bad_style)]
5+
#![allow(unused_imports)]
6+
#![no_std]
7+
8+
use core::num::Float;
39

410
extern crate compiler_builtins;
511

12+
#[cfg(all(target_arch = "arm",
13+
not(any(target_env = "gnu", target_env = "musl")),
14+
target_os = "linux",
15+
test))]
16+
extern crate utest_cortex_m_qemu;
17+
18+
#[cfg(all(target_arch = "arm",
19+
not(any(target_env = "gnu", target_env = "musl")),
20+
target_os = "linux",
21+
test))]
22+
#[macro_use]
23+
extern crate utest_macros;
24+
25+
#[cfg(all(target_arch = "arm",
26+
not(any(target_env = "gnu", target_env = "musl")),
27+
target_os = "linux",
28+
test))]
29+
macro_rules! panic { // overrides `panic!`
30+
($($tt:tt)*) => {
31+
upanic!($($tt)*);
32+
};
33+
}
34+
635
include!(concat!(env!("OUT_DIR"), "/generated.rs"));

0 commit comments

Comments
 (0)