Skip to content

Commit

Permalink
Run tests on AArch64 using Debian multiarch and QEMU
Browse files Browse the repository at this point in the history
  • Loading branch information
saleemrashid authored and emilio committed Feb 8, 2021
1 parent 704c02b commit b1c4178
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
target:
- debian: null
cross: null
rust: null
llvm_version: ["3.9", "4.0", "5.0", "9.0"]
main_tests: [1]
release_build: [0, 1]
no_default_features: [0, 1]
# FIXME: There are no pre-built static libclang libraries, so the
Expand Down Expand Up @@ -121,6 +126,17 @@ jobs:
feature_extra_asserts: 1
feature_testing_only_docs: 1

- os: ubuntu-latest
target:
debian: arm64
cross: aarch64-linux-gnu
rust: aarch64-unknown-linux-gnu
llvm_version: "9.0"
main_tests: 0
release_build: 0
feature_extra_asserts: 0
feature_testing_only_docs: 0

# Ensure stuff works on macos too
- os: macos-latest
llvm_version: "9.0"
Expand All @@ -131,17 +147,36 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install multiarch packages
if: matrix.target.debian
run: |
sudo apt-get install binfmt-support qemu-user-static gcc-${{matrix.target.cross}} g++-${{matrix.target.cross}}
source /etc/lsb-release
sudo tee /etc/apt/sources.list <<EOF >/dev/null
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME main
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME-updates main
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME-backports main
deb [arch=${{matrix.target.debian}}] http://ports.ubuntu.com/ubuntu-ports/ $DISTRIB_CODENAME-security main
EOF
sudo dpkg --add-architecture ${{matrix.target.debian}}
sudo apt-get update
sudo apt-get install libc6:${{matrix.target.debian}} libstdc++6:${{matrix.target.debian}}
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{matrix.target.rust}}
override: true

- name: Run all the tests
env:
GITHUB_ACTIONS_OS: ${{matrix.os}}
RUST_CROSS_COMPILER: ${{matrix.target.cross}}
RUST_TARGET: ${{matrix.target.rust}}
LLVM_VERSION: ${{matrix.llvm_version}}
BINDGEN_MAIN_TESTS: ${{matrix.main_tests}}
BINDGEN_RELEASE_BUILD: ${{matrix.release_build}}
BINDGEN_FEATURE_RUNTIME: ${{matrix.feature_runtime}}
BINDGEN_FEATURE_EXTRA_ASSERTS: ${{matrix.feature_extra_asserts}}
Expand Down
13 changes: 11 additions & 2 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ set_rustfmt_env

get_cargo_args() {
local args=""
if [ ! -z "$RUST_TARGET" ]; then
args+=" --target $RUST_TARGET"
fi
if [ "$BINDGEN_RELEASE_BUILD" == "1" ]; then
args+=" --release"
fi
Expand All @@ -116,13 +119,19 @@ get_cargo_args() {
echo $args
}

if [ ! -z "$RUST_CROSS_COMPILER" ]; then
export RUSTFLAGS="-C linker=${RUST_CROSS_COMPILER}-gcc"
fi

CARGO_ARGS=`get_cargo_args`

# Ensure we build without warnings
cargo rustc --lib $CARGO_ARGS -- -Dwarnings

# Run the tests
cargo test $CARGO_ARGS
if [ "$BINDGEN_MAIN_TESTS" == "1" ]; then
# Run the tests
cargo test $CARGO_ARGS
fi

assert_no_diff

Expand Down

0 comments on commit b1c4178

Please sign in to comment.