summaryrefslogtreecommitdiffstats
path: root/library/backtrace/ci
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /library/backtrace/ci
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/backtrace/ci')
-rwxr-xr-xlibrary/backtrace/ci/android-ndk.sh23
-rwxr-xr-xlibrary/backtrace/ci/android-sdk.sh65
-rwxr-xr-xlibrary/backtrace/ci/debuglink-docker.sh29
-rwxr-xr-xlibrary/backtrace/ci/debuglink.sh75
-rw-r--r--library/backtrace/ci/docker/aarch64-linux-android/Dockerfile18
-rw-r--r--library/backtrace/ci/docker/aarch64-unknown-linux-gnu/Dockerfile11
-rw-r--r--library/backtrace/ci/docker/arm-linux-androideabi/Dockerfile18
-rw-r--r--library/backtrace/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile10
-rw-r--r--library/backtrace/ci/docker/armv7-linux-androideabi/Dockerfile18
-rw-r--r--library/backtrace/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile10
-rw-r--r--library/backtrace/ci/docker/i586-unknown-linux-gnu/Dockerfile5
-rw-r--r--library/backtrace/ci/docker/i686-linux-android/Dockerfile18
-rw-r--r--library/backtrace/ci/docker/i686-unknown-linux-gnu/Dockerfile5
-rw-r--r--library/backtrace/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile16
-rw-r--r--library/backtrace/ci/docker/s390x-unknown-linux-gnu/Dockerfile17
-rw-r--r--library/backtrace/ci/docker/x86_64-linux-android/Dockerfile18
-rw-r--r--library/backtrace/ci/docker/x86_64-pc-windows-gnu/Dockerfile10
-rw-r--r--library/backtrace/ci/docker/x86_64-unknown-linux-gnu/Dockerfile6
-rw-r--r--library/backtrace/ci/docker/x86_64-unknown-linux-musl/Dockerfile6
-rwxr-xr-xlibrary/backtrace/ci/run-docker.sh33
-rwxr-xr-xlibrary/backtrace/ci/run.sh6
-rw-r--r--library/backtrace/ci/runtest-android.rs50
22 files changed, 467 insertions, 0 deletions
diff --git a/library/backtrace/ci/android-ndk.sh b/library/backtrace/ci/android-ndk.sh
new file mode 100755
index 000000000..b5df62b6f
--- /dev/null
+++ b/library/backtrace/ci/android-ndk.sh
@@ -0,0 +1,23 @@
+set -ex
+
+ANDROID_ARCH=$1
+ANDROID_SDK_VERSION=4333796
+
+mkdir /tmp/android
+cd /tmp/android
+
+curl -o android-sdk.zip \
+ "https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip"
+unzip -q android-sdk.zip
+
+yes | ./tools/bin/sdkmanager --licenses > /dev/null
+./tools/bin/sdkmanager ndk-bundle > /dev/null
+
+./ndk-bundle/build/tools/make_standalone_toolchain.py \
+ --arch $ANDROID_ARCH \
+ --stl=libc++ \
+ --api 21 \
+ --install-dir /android-toolchain
+
+cd /tmp
+rm -rf android
diff --git a/library/backtrace/ci/android-sdk.sh b/library/backtrace/ci/android-sdk.sh
new file mode 100755
index 000000000..7fde9a97f
--- /dev/null
+++ b/library/backtrace/ci/android-sdk.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/env sh
+
+set -ex
+
+# Prep the SDK and emulator
+#
+# Note that the update process requires that we accept a bunch of licenses, and
+# we can't just pipe `yes` into it for some reason, so we take the same strategy
+# located in https://github.com/appunite/docker by just wrapping it in a script
+# which apparently magically accepts the licenses.
+
+SDK=4333796
+mkdir sdk
+curl --retry 20 https://dl.google.com/android/repository/sdk-tools-linux-${SDK}.zip -O
+unzip -q -d sdk sdk-tools-linux-${SDK}.zip
+
+case "$1" in
+ arm | armv7)
+ api=24
+ image="system-images;android-${api};google_apis;armeabi-v7a"
+ ;;
+ aarch64)
+ api=24
+ image="system-images;android-${api};google_apis;arm64-v8a"
+ ;;
+ i686)
+ api=28
+ image="system-images;android-${api};default;x86"
+ ;;
+ x86_64)
+ api=28
+ image="system-images;android-${api};default;x86_64"
+ ;;
+ *)
+ echo "invalid arch: $1"
+ exit 1
+ ;;
+esac;
+
+# Try to fix warning about missing file.
+# See https://askubuntu.com/a/1078784
+mkdir -p /root/.android/
+echo '### User Sources for Android SDK Manager' >> /root/.android/repositories.cfg
+echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg
+
+# Print all available packages
+# yes | ./sdk/tools/bin/sdkmanager --list --verbose
+
+# --no_https avoids
+# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
+#
+# | grep -v = || true removes the progress bar output from the sdkmanager
+# which produces an insane amount of output.
+yes | ./sdk/tools/bin/sdkmanager --licenses --no_https | grep -v = || true
+yes | ./sdk/tools/bin/sdkmanager --no_https \
+ "emulator" \
+ "platform-tools" \
+ "platforms;android-${api}" \
+ "${image}" | grep -v = || true
+
+echo "no" |
+ ./sdk/tools/bin/avdmanager create avd \
+ --name "${1}" \
+ --package "${image}" | grep -v = || true
+
diff --git a/library/backtrace/ci/debuglink-docker.sh b/library/backtrace/ci/debuglink-docker.sh
new file mode 100755
index 000000000..acb19e98b
--- /dev/null
+++ b/library/backtrace/ci/debuglink-docker.sh
@@ -0,0 +1,29 @@
+# Small script to run debuglink tests inside a docker image.
+# Creates a writable mount on /usr/lib/debug.
+
+set -ex
+
+run() {
+ cargo generate-lockfile --manifest-path crates/debuglink/Cargo.toml
+ mkdir -p target crates/debuglink/target debug
+ docker build -t backtrace -f ci/docker/$1/Dockerfile ci
+ docker run \
+ --user `id -u`:`id -g` \
+ --rm \
+ --init \
+ --volume $(dirname $(dirname `which cargo`)):/cargo \
+ --env CARGO_HOME=/cargo \
+ --volume `rustc --print sysroot`:/rust:ro \
+ --env TARGET=$1 \
+ --volume `pwd`:/checkout:ro \
+ --volume `pwd`/target:/checkout/crates/debuglink/target \
+ --workdir /checkout \
+ --volume `pwd`/debug:/usr/lib/debug \
+ --privileged \
+ --env RUSTFLAGS \
+ backtrace \
+ bash \
+ -c 'PATH=$PATH:/rust/bin exec ci/debuglink.sh'
+}
+
+run x86_64-unknown-linux-gnu
diff --git a/library/backtrace/ci/debuglink.sh b/library/backtrace/ci/debuglink.sh
new file mode 100755
index 000000000..b2da2013d
--- /dev/null
+++ b/library/backtrace/ci/debuglink.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+# Debuglink tests.
+# We build crates/debuglink and then move its debuginfo around
+# and test that it can still find the debuginfo.
+
+set -ex
+
+cratedir=`pwd`/crates/debuglink
+exefile=crates/debuglink/target/debug/debuglink
+
+# Baseline; no separate debug
+cargo build --manifest-path crates/debuglink/Cargo.toml
+$exefile $cratedir
+
+# Separate debug in same dir
+debugfile1=`dirname $exefile`/debuglink.debug
+objcopy --only-keep-debug $exefile $debugfile1
+strip -g $exefile
+(cd `dirname $exefile` && objcopy --add-gnu-debuglink=debuglink.debug debuglink)
+$exefile $cratedir
+
+# Separate debug in .debug subdir
+debugfile2=`dirname $exefile`/.debug/debuglink.debug
+mkdir -p `dirname $debugfile2`
+mv $debugfile1 $debugfile2
+$exefile $cratedir
+
+# Separate debug in /usr/lib/debug subdir
+debugfile3="/usr/lib/debug/$cratedir/target/debug/debuglink.debug"
+mkdir -p `dirname $debugfile3`
+mv $debugfile2 $debugfile3
+$exefile $cratedir
+
+# Separate debug in /usr/lib/debug/.build-id subdir
+id=`readelf -n $exefile | grep '^ Build ID: [0-9a-f]' | cut -b 15-`
+idfile="/usr/lib/debug/.build-id/${id:0:2}/${id:2}.debug"
+mkdir -p `dirname $idfile`
+mv $debugfile3 $idfile
+$exefile $cratedir
+
+# Replace idfile with a symlink (this is the usual arrangement)
+mv $idfile $debugfile3
+ln -s $debugfile3 $idfile
+$exefile $cratedir
+
+# Supplementary object file using relative path
+dwzfile="/usr/lib/debug/.dwz/debuglink.debug"
+mkdir -p `dirname $dwzfile`
+cp $debugfile3 $debugfile3.copy
+dwz -m $dwzfile -rh $debugfile3 $debugfile3.copy
+rm $debugfile3.copy
+$exefile $cratedir
+
+# Supplementary object file using build ID
+dwzid=`readelf -n $dwzfile | grep '^ Build ID: [0-9a-f]' | cut -b 15-`
+dwzidfile="/usr/lib/debug/.build-id/${dwzid:0:2}/${dwzid:2}.debug"
+mkdir -p `dirname $dwzidfile`
+mv $dwzfile $dwzidfile
+$exefile $cratedir
+mv $dwzidfile $dwzfile
+
+# Missing debug should fail
+mv $debugfile3 $debugfile3.tmp
+! $exefile $cratedir
+mv $debugfile3.tmp $debugfile3
+
+# Missing dwz should fail
+mv $dwzfile $dwzfile.tmp
+! $exefile $cratedir
+mv $dwzfile.tmp $dwzfile
+
+# Cleanup
+rm $idfile $debugfile3 $dwzfile
+echo Success
diff --git a/library/backtrace/ci/docker/aarch64-linux-android/Dockerfile b/library/backtrace/ci/docker/aarch64-linux-android/Dockerfile
new file mode 100644
index 000000000..c5655ed5e
--- /dev/null
+++ b/library/backtrace/ci/docker/aarch64-linux-android/Dockerfile
@@ -0,0 +1,18 @@
+FROM ubuntu:20.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl \
+ ca-certificates \
+ unzip \
+ openjdk-8-jre \
+ python \
+ gcc \
+ libc6-dev
+
+COPY android-ndk.sh /
+RUN /android-ndk.sh arm64
+ENV PATH=$PATH:/android-toolchain/bin
+
+# TODO: run tests in an emulator eventually
+ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
+ CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=echo
diff --git a/library/backtrace/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/library/backtrace/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
new file mode 100644
index 000000000..871b353c0
--- /dev/null
+++ b/library/backtrace/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ ca-certificates \
+ libc6-dev \
+ gcc-aarch64-linux-gnu \
+ libc6-dev-arm64-cross \
+ qemu-user
+
+ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu"
diff --git a/library/backtrace/ci/docker/arm-linux-androideabi/Dockerfile b/library/backtrace/ci/docker/arm-linux-androideabi/Dockerfile
new file mode 100644
index 000000000..446a64cc0
--- /dev/null
+++ b/library/backtrace/ci/docker/arm-linux-androideabi/Dockerfile
@@ -0,0 +1,18 @@
+FROM ubuntu:20.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl \
+ ca-certificates \
+ unzip \
+ openjdk-8-jre \
+ python \
+ gcc \
+ libc6-dev
+
+COPY android-ndk.sh /
+RUN /android-ndk.sh arm
+ENV PATH=$PATH:/android-toolchain/bin
+
+# TODO: run tests in an emulator eventually
+ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
+ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=echo
diff --git a/library/backtrace/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/library/backtrace/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
new file mode 100644
index 000000000..24665972c
--- /dev/null
+++ b/library/backtrace/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
@@ -0,0 +1,10 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ ca-certificates \
+ libc6-dev \
+ gcc-arm-linux-gnueabihf \
+ libc6-dev-armhf-cross \
+ qemu-user
+ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
+ CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf"
diff --git a/library/backtrace/ci/docker/armv7-linux-androideabi/Dockerfile b/library/backtrace/ci/docker/armv7-linux-androideabi/Dockerfile
new file mode 100644
index 000000000..539bbc494
--- /dev/null
+++ b/library/backtrace/ci/docker/armv7-linux-androideabi/Dockerfile
@@ -0,0 +1,18 @@
+FROM ubuntu:20.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl \
+ ca-certificates \
+ unzip \
+ openjdk-8-jre \
+ python \
+ gcc \
+ libc6-dev
+
+COPY android-ndk.sh /
+RUN /android-ndk.sh arm
+ENV PATH=$PATH:/android-toolchain/bin
+
+# TODO: run tests in an emulator eventually
+ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
+ CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_RUNNER=echo
diff --git a/library/backtrace/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile b/library/backtrace/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile
new file mode 100644
index 000000000..6f7d0fd36
--- /dev/null
+++ b/library/backtrace/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile
@@ -0,0 +1,10 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ ca-certificates \
+ libc6-dev \
+ gcc-arm-linux-gnueabihf \
+ libc6-dev-armhf-cross \
+ qemu-user
+ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
+ CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf"
diff --git a/library/backtrace/ci/docker/i586-unknown-linux-gnu/Dockerfile b/library/backtrace/ci/docker/i586-unknown-linux-gnu/Dockerfile
new file mode 100644
index 000000000..316a233e3
--- /dev/null
+++ b/library/backtrace/ci/docker/i586-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,5 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc-multilib \
+ libc6-dev \
+ ca-certificates
diff --git a/library/backtrace/ci/docker/i686-linux-android/Dockerfile b/library/backtrace/ci/docker/i686-linux-android/Dockerfile
new file mode 100644
index 000000000..83ccb2948
--- /dev/null
+++ b/library/backtrace/ci/docker/i686-linux-android/Dockerfile
@@ -0,0 +1,18 @@
+FROM ubuntu:20.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl \
+ ca-certificates \
+ unzip \
+ openjdk-8-jre \
+ python \
+ gcc \
+ libc6-dev
+
+COPY android-ndk.sh /
+RUN /android-ndk.sh x86
+ENV PATH=$PATH:/android-toolchain/bin
+
+# TODO: run tests in an emulator eventually
+ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
+ CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=echo
diff --git a/library/backtrace/ci/docker/i686-unknown-linux-gnu/Dockerfile b/library/backtrace/ci/docker/i686-unknown-linux-gnu/Dockerfile
new file mode 100644
index 000000000..316a233e3
--- /dev/null
+++ b/library/backtrace/ci/docker/i686-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,5 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc-multilib \
+ libc6-dev \
+ ca-certificates
diff --git a/library/backtrace/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/library/backtrace/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
new file mode 100644
index 000000000..7ca5a64bf
--- /dev/null
+++ b/library/backtrace/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,16 @@
+FROM ubuntu:20.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ ca-certificates \
+ libc6-dev \
+ gcc-powerpc64-linux-gnu \
+ libc6-dev-ppc64-cross \
+ qemu-user \
+ qemu-system-ppc
+
+ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
+ # TODO: should actually run these tests
+ #CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \
+ CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER=echo \
+ CC=powerpc64-linux-gnu-gcc
diff --git a/library/backtrace/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/library/backtrace/ci/docker/s390x-unknown-linux-gnu/Dockerfile
new file mode 100644
index 000000000..7c19dcbb4
--- /dev/null
+++ b/library/backtrace/ci/docker/s390x-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,17 @@
+FROM ubuntu:20.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ ca-certificates \
+ libc6-dev \
+ gcc-s390x-linux-gnu \
+ libc6-dev-s390x-cross \
+ qemu-user \
+ # There seems to be a bug in processing mixed-architecture
+ # ld.so.cache files that causes crashes in some cases. Work
+ # around this by simply deleting the cache for now.
+ && rm /etc/ld.so.cache
+
+ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
+ CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \
+ CC=s390x-linux-gnu-gcc
diff --git a/library/backtrace/ci/docker/x86_64-linux-android/Dockerfile b/library/backtrace/ci/docker/x86_64-linux-android/Dockerfile
new file mode 100644
index 000000000..88a22ce6c
--- /dev/null
+++ b/library/backtrace/ci/docker/x86_64-linux-android/Dockerfile
@@ -0,0 +1,18 @@
+FROM ubuntu:20.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl \
+ ca-certificates \
+ unzip \
+ openjdk-8-jre \
+ python \
+ gcc \
+ libc6-dev
+
+COPY android-ndk.sh /
+RUN /android-ndk.sh x86_64
+ENV PATH=$PATH:/android-toolchain/bin
+
+# TODO: run tests in an emulator eventually
+ENV CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
+ CARGO_TARGET_X86_64_LINUX_ANDROID_RUNNER=echo
diff --git a/library/backtrace/ci/docker/x86_64-pc-windows-gnu/Dockerfile b/library/backtrace/ci/docker/x86_64-pc-windows-gnu/Dockerfile
new file mode 100644
index 000000000..a8e859e67
--- /dev/null
+++ b/library/backtrace/ci/docker/x86_64-pc-windows-gnu/Dockerfile
@@ -0,0 +1,10 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ libc6-dev \
+ ca-certificates \
+ gcc-mingw-w64-x86-64
+
+# No need to run tests, we're just testing that it compiles
+ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER=echo \
+ CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc
diff --git a/library/backtrace/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/library/backtrace/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
new file mode 100644
index 000000000..551ab1378
--- /dev/null
+++ b/library/backtrace/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,6 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ libc6-dev \
+ ca-certificates \
+ dwz
diff --git a/library/backtrace/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/library/backtrace/ci/docker/x86_64-unknown-linux-musl/Dockerfile
new file mode 100644
index 000000000..e77e41f5b
--- /dev/null
+++ b/library/backtrace/ci/docker/x86_64-unknown-linux-musl/Dockerfile
@@ -0,0 +1,6 @@
+FROM ubuntu:20.04
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc \
+ libc6-dev \
+ ca-certificates \
+ musl-tools
diff --git a/library/backtrace/ci/run-docker.sh b/library/backtrace/ci/run-docker.sh
new file mode 100755
index 000000000..8aa6d84a4
--- /dev/null
+++ b/library/backtrace/ci/run-docker.sh
@@ -0,0 +1,33 @@
+# Small script to run tests for a target (or all targets) inside all the
+# respective docker images.
+
+set -ex
+
+run() {
+ docker build -t backtrace -f ci/docker/$1/Dockerfile ci
+ mkdir -p target
+ docker run \
+ --user `id -u`:`id -g` \
+ --rm \
+ --init \
+ --volume $(dirname $(dirname `which cargo`)):/cargo \
+ --env CARGO_HOME=/cargo \
+ --volume `rustc --print sysroot`:/rust:ro \
+ --env TARGET=$1 \
+ --volume `pwd`:/checkout:ro \
+ --volume `pwd`/target:/checkout/target \
+ --workdir /checkout \
+ --privileged \
+ --env RUSTFLAGS \
+ backtrace \
+ bash \
+ -c 'PATH=$PATH:/rust/bin exec ci/run.sh'
+}
+
+if [ -z "$1" ]; then
+ for d in `ls ci/docker/`; do
+ run $d
+ done
+else
+ run $1
+fi
diff --git a/library/backtrace/ci/run.sh b/library/backtrace/ci/run.sh
new file mode 100755
index 000000000..166b387e4
--- /dev/null
+++ b/library/backtrace/ci/run.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -ex
+
+cargo test --target $TARGET
+cargo build --target $TARGET --manifest-path crates/as-if-std/Cargo.toml
diff --git a/library/backtrace/ci/runtest-android.rs b/library/backtrace/ci/runtest-android.rs
new file mode 100644
index 000000000..dc70121dc
--- /dev/null
+++ b/library/backtrace/ci/runtest-android.rs
@@ -0,0 +1,50 @@
+use std::env;
+use std::process::Command;
+use std::path::{Path, PathBuf};
+
+fn main() {
+ let args = env::args_os()
+ .skip(1)
+ .filter(|arg| arg != "--quiet")
+ .collect::<Vec<_>>();
+ assert_eq!(args.len(), 1);
+ let test = PathBuf::from(&args[0]);
+ let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap());
+
+ println!("waiting for device to come online...");
+ let status = Command::new("adb")
+ .arg("wait-for-device")
+ .status()
+ .expect("failed to run: adb wait-for-device");
+ assert!(status.success());
+
+ println!("pushing executable...");
+ let status = Command::new("adb")
+ .arg("push")
+ .arg(&test)
+ .arg(&dst)
+ .status()
+ .expect("failed to run: adb pushr");
+ assert!(status.success());
+
+ println!("executing tests...");
+ let output = Command::new("adb")
+ .arg("shell")
+ .arg(&dst)
+ .output()
+ .expect("failed to run: adb shell");
+ assert!(status.success());
+
+ println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
+ output.status,
+ String::from_utf8_lossy(&output.stdout),
+ String::from_utf8_lossy(&output.stderr));
+
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ stdout.lines().find(|l|
+ (l.starts_with("PASSED ") && l.contains(" tests")) ||
+ l.starts_with("test result: ok")
+ ).unwrap_or_else(|| {
+ panic!("failed to find successful test run");
+ });
+}