From b1846b794b6940ab562de662e223f8b7c5303224 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 16:55:30 -0500 Subject: [PATCH 01/12] travis CI --- .travis.yml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ ci/env.sh | 23 +++++++++++++++++++ ci/install.sh | 31 ++++++++++++++++++++++++++ ci/script.sh | 48 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+) create mode 100644 .travis.yml create mode 100644 ci/env.sh create mode 100644 ci/install.sh create mode 100644 ci/script.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..63faac2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,61 @@ +language: generic + +matrix: + include: + - env: TARGET=aarch64-unknown-linux-gnu + os: linux + dist: trusty + sudo: required + addons: + apt: + packages: + - binfmt-support + - qemu-user-static + - env: TARGET=arm-unknown-linux-gnueabi + os: linux + sudo: required + addons: + apt: + packages: + - binfmt-support + - gcc-arm-linux-gnueabi + - libc6-armel-cross + - qemu-user-static + - env: TARGET=arm-unknown-linux-gnueabihf + os: linux + sudo: required + addons: + apt: + packages: &armhf + - binfmt-support + - gcc-arm-linux-gnueabihf + - libc6-armhf-cross + - qemu-user-static + - env: TARGET=armv7-unknown-linux-gnueabihf + os: linux + sudo: required + addons: + apt: + packages: *armhf + - env: TARGET=i686-apple-darwin + os: osx + - env: TARGET=i686-unknown-linux-gnu + os: linux + addons: + apt: + packages: + - gcc-multilib + - env: TARGET=x86_64-apple-darwin + os: osx + - env: TARGET=x86_64-unknown-linux-gnu + os: linux + +install: + - bash ci/install.sh + +script: + - bash ci/script.sh + +notifications: + email: + on_success: never diff --git a/ci/env.sh b/ci/env.sh new file mode 100644 index 0000000..ad76689 --- /dev/null +++ b/ci/env.sh @@ -0,0 +1,23 @@ +case $TRAVIS_OS_NAME in + linux) + export HOST=x86_64-unknown-linux-gnu + ;; + osx) + export HOST=x86_64-apple-darwin + ;; +esac + +case $TARGET in + aarch64-unknown-linux-gnu) + export PREFIX=aarch64-linux-gnu- + export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu + ;; + arm*-unknown-linux-gnueabi) + export PREFIX=arm-linux-gnueabi- + export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi + ;; + arm*-unknown-linux-gnueabihf) + export PREFIX=arm-linux-gnueabihf- + export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf + ;; +esac diff --git a/ci/install.sh b/ci/install.sh new file mode 100644 index 0000000..a66c5d0 --- /dev/null +++ b/ci/install.sh @@ -0,0 +1,31 @@ +set -ex + +. $(dirname $0)/env.sh + +build() { + cargo build --target $TARGET + cargo build --target $TARGET --release +} + +run_tests() { + if [[ $QEMU_LD_PREFIX ]]; then + export RUST_TEST_THREADS=1 + fi + + cargo test --target $TARGET + cargo test --target $TARGET --release +} + +inspect() { + ${PREFIX}nm -g --defined-only target/**/debug/*.rlib + ${PREFIX}objdump target/**/debug/*.rlib + ${PREFIX}objdump target/**/release/*.rlib +} + +main() { + build + run_tests + inspect +} + +main diff --git a/ci/script.sh b/ci/script.sh new file mode 100644 index 0000000..c2fcdb8 --- /dev/null +++ b/ci/script.sh @@ -0,0 +1,48 @@ +set -ex + +. $(dirname $0)/env.sh + +install_c_toolchain() { + case $TARGET in + aarch64-unknown-linux-gnu) + sudo apt-get install -y --no-install-recommends \ + gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross + ;; + *) + ;; + esac +} + +install_rust() { + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly + + rustc -V + cargo -V +} + +add_rustup_target() { + if [[ $TARGET != $HOST ]]; then + rustup target add $TARGET + fi +} + +configure_cargo() { + if [[ $PREFIX ]]; then + ${PREFIX}gcc -v + + mkdir -p .cargo + cat >>.cargo/config < Date: Sun, 7 Aug 2016 16:58:44 -0500 Subject: [PATCH 02/12] set $PATH --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 63faac2..364e4d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,9 @@ matrix: - env: TARGET=x86_64-unknown-linux-gnu os: linux +before_install: + - export PATH="$PATH:$HOME/.cargo/bin" + install: - bash ci/install.sh From 4a0e2305ad42ab4af2db8e3c3b0dbe30760194fa Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 16:59:54 -0500 Subject: [PATCH 03/12] only test on master --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 364e4d9..27a1413 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,6 +59,10 @@ install: script: - bash ci/script.sh +branches: + only: + - master + notifications: email: on_success: never From a1334edbcda0b8cde28af800b7b046530d6215bb Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:03:44 -0500 Subject: [PATCH 04/12] swap install.sh and script.sh --- ci/install.sh | 49 +++++++++++++++++++++++++++++++++---------------- ci/script.sh | 49 ++++++++++++++++--------------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/ci/install.sh b/ci/install.sh index a66c5d0..c2fcdb8 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -2,30 +2,47 @@ set -ex . $(dirname $0)/env.sh -build() { - cargo build --target $TARGET - cargo build --target $TARGET --release +install_c_toolchain() { + case $TARGET in + aarch64-unknown-linux-gnu) + sudo apt-get install -y --no-install-recommends \ + gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross + ;; + *) + ;; + esac } -run_tests() { - if [[ $QEMU_LD_PREFIX ]]; then - export RUST_TEST_THREADS=1 +install_rust() { + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly + + rustc -V + cargo -V +} + +add_rustup_target() { + if [[ $TARGET != $HOST ]]; then + rustup target add $TARGET fi - - cargo test --target $TARGET - cargo test --target $TARGET --release } -inspect() { - ${PREFIX}nm -g --defined-only target/**/debug/*.rlib - ${PREFIX}objdump target/**/debug/*.rlib - ${PREFIX}objdump target/**/release/*.rlib +configure_cargo() { + if [[ $PREFIX ]]; then + ${PREFIX}gcc -v + + mkdir -p .cargo + cat >>.cargo/config <>.cargo/config < Date: Sun, 7 Aug 2016 17:07:12 -0500 Subject: [PATCH 05/12] install libc6-dev for ARM targets --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 27a1413..d8ff366 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,7 @@ matrix: - binfmt-support - gcc-arm-linux-gnueabi - libc6-armel-cross + - libc6-dev-armel-cross - qemu-user-static - env: TARGET=arm-unknown-linux-gnueabihf os: linux @@ -30,6 +31,7 @@ matrix: - binfmt-support - gcc-arm-linux-gnueabihf - libc6-armhf-cross + - libc6-dev-armhf-cross - qemu-user-static - env: TARGET=armv7-unknown-linux-gnueabihf os: linux From 1c98c8238a03385f4e42818050f65acce21796d7 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:07:58 -0500 Subject: [PATCH 06/12] fix objdump commands --- ci/script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index a66c5d0..5952f7e 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -18,8 +18,8 @@ run_tests() { inspect() { ${PREFIX}nm -g --defined-only target/**/debug/*.rlib - ${PREFIX}objdump target/**/debug/*.rlib - ${PREFIX}objdump target/**/release/*.rlib + ${PREFIX}objdump -Cd target/**/debug/*.rlib + ${PREFIX}objdump -Cd target/**/release/*.rlib } main() { From ca57e9fb64dad0460bf6dce98bcef0f603c1bb15 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:10:36 -0500 Subject: [PATCH 07/12] use container-based infrastructure --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d8ff366..c09c3bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: generic +sudo: false matrix: include: From a16950e580fa38b6277d6feb8821cab6ef9a9b78 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:13:29 -0500 Subject: [PATCH 08/12] ignore objdump exit code --- ci/script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/script.sh b/ci/script.sh index 5952f7e..01f6ff5 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -18,8 +18,10 @@ run_tests() { inspect() { ${PREFIX}nm -g --defined-only target/**/debug/*.rlib + set +e ${PREFIX}objdump -Cd target/**/debug/*.rlib ${PREFIX}objdump -Cd target/**/release/*.rlib + set -e } main() { From 994c5a2a015107069ec8bbf27ba3ff7479f9760f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:18:37 -0500 Subject: [PATCH 09/12] nm: drop --defined-only flag it doesn't work on macOS --- ci/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/script.sh b/ci/script.sh index 01f6ff5..c3e1a65 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -17,7 +17,7 @@ run_tests() { } inspect() { - ${PREFIX}nm -g --defined-only target/**/debug/*.rlib + ${PREFIX}nm -g target/**/debug/*.rlib set +e ${PREFIX}objdump -Cd target/**/debug/*.rlib ${PREFIX}objdump -Cd target/**/release/*.rlib From fda97847bb23982083bd6b0373e06d8977609a5a Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:23:30 -0500 Subject: [PATCH 10/12] macOS: install binutils --- ci/install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ci/install.sh b/ci/install.sh index c2fcdb8..595a985 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -13,6 +13,16 @@ install_c_toolchain() { esac } +install_binutils() { + case $TRAVIS_OS_NAME in + osx) + brew install binutils + ;; + *) + ;; + esac +} + install_rust() { curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly From c7c04f8c4878752cf90062c1baf41190944c4caa Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:29:31 -0500 Subject: [PATCH 11/12] macOS: use gnu binutils --- ci/env.sh | 4 ++++ ci/script.sh | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ci/env.sh b/ci/env.sh index ad76689..92f0c3e 100644 --- a/ci/env.sh +++ b/ci/env.sh @@ -1,9 +1,13 @@ case $TRAVIS_OS_NAME in linux) export HOST=x86_64-unknown-linux-gnu + export NM=nm + export OBJDUMP=objdump ;; osx) export HOST=x86_64-apple-darwin + export NM=gnm + export OBJDUMP=gobjdump ;; esac diff --git a/ci/script.sh b/ci/script.sh index c3e1a65..c1748fc 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -17,10 +17,10 @@ run_tests() { } inspect() { - ${PREFIX}nm -g target/**/debug/*.rlib + $PREFIX$NM -g --defined-only target/**/debug/*.rlib set +e - ${PREFIX}objdump -Cd target/**/debug/*.rlib - ${PREFIX}objdump -Cd target/**/release/*.rlib + $PREFIX$OBJDUMP -Cd target/**/debug/*.rlib + $PREFIX$OBJDUMP -Cd target/**/release/*.rlib set -e } From 0cc46677192847cb92bb41037462f96d54a659ff Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Aug 2016 17:32:53 -0500 Subject: [PATCH 12/12] macOS: actually install binutils --- ci/install.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ci/install.sh b/ci/install.sh index 595a985..3d11092 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -2,21 +2,21 @@ set -ex . $(dirname $0)/env.sh -install_c_toolchain() { - case $TARGET in - aarch64-unknown-linux-gnu) - sudo apt-get install -y --no-install-recommends \ - gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross +install_binutils() { + case $TRAVIS_OS_NAME in + osx) + brew install binutils ;; *) ;; esac } -install_binutils() { - case $TRAVIS_OS_NAME in - osx) - brew install binutils +install_c_toolchain() { + case $TARGET in + aarch64-unknown-linux-gnu) + sudo apt-get install -y --no-install-recommends \ + gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross ;; *) ;; @@ -49,6 +49,7 @@ EOF } main() { + install_binutils install_c_toolchain install_rust add_rustup_target