From 23ab70b3cb5e75dc76444cf564322ca48e4f18f1 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Sun, 13 Sep 2015 23:38:27 -0700
Subject: [PATCH] Add CI for ARM linux

---
 .travis.yml      |  3 +++
 ci/cargo-config  |  3 +++
 ci/run-travis.sh | 12 ++++++++++--
 ci/run.sh        |  2 ++
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 1c01adeb..8cb864c4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,9 @@ matrix:
     - os: linux
       env: TARGET=x86_64-unknown-linux-musl
       rust: nightly-2015-09-08
+    - os: linux
+      env: TARGET=arm-unknown-linux-gnueabihf
+      rust: nightly-2015-09-08
 addons:
   apt:
     packages:
diff --git a/ci/cargo-config b/ci/cargo-config
index f1d42a30..40b79f06 100644
--- a/ci/cargo-config
+++ b/ci/cargo-config
@@ -1,2 +1,5 @@
 [target.arm-linux-androideabi]
 linker = "arm-linux-androideabi-gcc"
+
+[target.arm-unknown-linux-gnueabihf]
+linker = "arm-linux-gnueabihf-gcc-4.7"
diff --git a/ci/run-travis.sh b/ci/run-travis.sh
index a7d382f5..5fa07866 100644
--- a/ci/run-travis.sh
+++ b/ci/run-travis.sh
@@ -11,14 +11,22 @@ export HOST=$ARCH-$OS
 # clang has better error messages and implements alignof more broadly
 export CC=clang
 
+EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/2015-09-08
+
 if [ "$TARGET" = "arm-linux-androideabi" ]; then
   # Pull a pre-built docker image for testing android, then run tests entirely
   # within that image.
   docker pull alexcrichton/rust-libc-test
   docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test sh ci/run.sh $TARGET
 elif [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then
-  curl -s https://people.mozilla.org/~acrichton/libc-test/2015-09-08/x86_64-unknown-linux-musl.tar.gz | \
-    tar xzf - -C $HOME/rust/lib/rustlib
+  curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
+  sh ci/run.sh $TARGET
+elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then
+  curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
+  sudo apt-get install gcc-4.7-arm-linux-gnueabihf
+  mkdir .cargo
+  cp ci/cargo-config .cargo/config
+  export CC=arm-linux-gnueabihf-gcc-4.7
   sh ci/run.sh $TARGET
 else
   # Download and install the relevant target locally, then run tests
diff --git a/ci/run.sh b/ci/run.sh
index 3f1f3bfb..9e3e9703 100644
--- a/ci/run.sh
+++ b/ci/run.sh
@@ -10,6 +10,8 @@ if [ "$TARGET" = "arm-linux-androideabi" ]; then
     adb wait-for-device
     adb push /root/target/$TARGET/debug/all-* /data/test
     adb shell /data/test
+elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then
+    qemu-arm -L /usr/arm-linux-gnueabi /root/target/$TARGET/debug/all-*
 else
     cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
 fi
-- 
GitLab