Skip to content

CI: test ARM Cortex targets #35

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

Merged
merged 7 commits into from
Aug 13, 2016
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
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ sudo: false

matrix:
include:
- env: TARGET=thumbv6m-none-eabi
os: linux
dist: trusty
sudo: required
- env: TARGET=thumbv7m-none-eabi
os: linux
dist: trusty
sudo: required
- env: TARGET=thumbv7em-none-eabi
os: linux
dist: trusty
sudo: required
- env: TARGET=i586-unknown-linux-gnu
os: linux
services: docker
Expand Down Expand Up @@ -84,6 +96,16 @@ matrix:
os: osx
- env: TARGET=x86_64-unknown-linux-gnu
os: linux
allow_failures:
# Issue #2. Flaky test
- env: TARGET=arm-unknown-linux-gnueabi
os: linux
# Issue #2. Flaky test
- env: TARGET=arm-unknown-linux-gnueabihf
os: linux
# Issue #2. Flaky test
- env: TARGET=armv7-unknown-linux-gnueabihf
os: linux

before_install:
- export PATH="$PATH:$HOME/.cargo/bin"
Expand Down
12 changes: 8 additions & 4 deletions ci/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ case $TARGET in
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
;;
armv7-unknown-linux-gnueabihf)
# See #2
export DONT_RUN_TESTS=y
export PREFIX=arm-linux-gnueabihf-
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
;;
Expand Down Expand Up @@ -65,13 +63,19 @@ case $TARGET in
export QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu
;;
powerpc64le-unknown-linux-gnu)
# See #2
export DONT_RUN_TESTS=y
if [[ -z $DOCKER ]]; then
export DOCKER=y
fi
export PREFIX=powerpc64le-linux-gnu-
export QEMU=qemu-ppc64le
export QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu
# Issue #2. QEMU doesn't work
export RUN_TESTS=n
;;
thumbv*-none-eabi)
export CARGO=xargo
export PREFIX=arm-none-eabi-
# Bare metal targets. No `std` or `test` crates for these targets.
export RUN_TESTS=n
;;
esac
19 changes: 17 additions & 2 deletions ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ install_binutils() {
osx)
brew install binutils
;;
*)
esac

case $TARGET in
thumbv*-none-eabi)
sudo apt-get install -y --no-install-recommends \
gcc-arm-none-eabi
;;
esac
}
Expand Down Expand Up @@ -74,11 +79,20 @@ install_rust() {
}

add_rustup_target() {
if [[ $TARGET != $HOST ]]; then
if [[ $TARGET != $HOST && ${CARGO:-cargo} == "cargo" ]]; then
rustup target add $TARGET
fi
}

install_xargo() {
if [[ $CARGO == "xargo" ]]; then
sudo apt-get install -y --no-install-recommends \
libssh2-1
curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
bash -s -- --from japaric/xargo --at $HOME/.cargo/bin
fi
}

configure_cargo() {
if [[ $PREFIX ]]; then
${PREFIX}gcc -v
Expand All @@ -99,6 +113,7 @@ main() {
install_c_toolchain
install_rust
add_rustup_target
install_xargo
configure_cargo
fi
}
Expand Down
12 changes: 6 additions & 6 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ set -ex
. $(dirname $0)/env.sh

build() {
cargo build --target $TARGET
cargo build --target $TARGET --release
${CARGO:-cargo} build --target $TARGET
${CARGO:-cargo} build --target $TARGET --release
}

run_tests() {
Expand All @@ -14,14 +14,14 @@ run_tests() {

if [[ $QEMU ]]; then
cargo test --target $TARGET --no-run
if [[ -z $DONT_RUN_TESTS ]]; then
if [[ ${RUN_TESTS:-y} == "y" ]]; then
$QEMU target/**/debug/rustc_builtins-*
fi
cargo test --target $TARGET --release --no-run
if [[ -z $DONT_RUN_TESTS ]]; then
if [[ ${RUN_TESTS:-y} == "y" ]]; then
$QEMU target/**/release/rustc_builtins-*
fi
elif [[ -z $DONT_RUN_TESTS ]]; then
elif [[ ${RUN_TESTS:-y} == "y" ]]; then
cargo test --target $TARGET
cargo test --target $TARGET --release
fi
Expand Down Expand Up @@ -50,8 +50,8 @@ main() {
bash ci/script.sh'
else
build
run_tests
inspect
run_tests
fi
}

Expand Down
10 changes: 10 additions & 0 deletions thumbv6m-none-eabi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"arch": "arm",
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
"features": "+strict-align",
"llvm-target": "thumbv6m-none-eabi",
"max-atomic-width": 0,
"os": "none",
"target-endian": "little",
"target-pointer-width": "32"
Copy link
Member

Choose a reason for hiding this comment

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

You need to add these for thumbv6m (not needed for thumbv7m):

    "features": "+strict-align",
    "max-atomic-width": 0,

}
8 changes: 8 additions & 0 deletions thumbv7em-none-eabi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arch": "arm",
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
"llvm-target": "thumbv7em-none-eabi",
"os": "none",
"target-endian": "little",
"target-pointer-width": "32"
}
8 changes: 8 additions & 0 deletions thumbv7m-none-eabi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arch": "arm",
"data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
"llvm-target": "thumbv7m-none-eabi",
"os": "none",
"target-endian": "little",
"target-pointer-width": "32"
}