summaryrefslogtreecommitdiff
path: root/ci/run.sh
diff options
context:
space:
mode:
authorZac Berkowitz <zac.berkowitz@gmail.com>2017-02-25 02:16:30 +0000
committerBryant Mairs <bryant@mai.rs>2017-04-09 07:41:58 -0700
commit52963abcdddae0ee2684c33a1f451b8a3cf0406b (patch)
tree6df960fa8d710d519b038201c91c7bd7ec9d051e /ci/run.sh
parent44c0ecbc42bc8f5ea132aa07cc612139a2cd74b0 (diff)
downloadnix-52963abcdddae0ee2684c33a1f451b8a3cf0406b.zip
Removed old ci infrastructure.
Diffstat (limited to 'ci/run.sh')
-rwxr-xr-xci/run.sh137
1 files changed, 0 insertions, 137 deletions
diff --git a/ci/run.sh b/ci/run.sh
deleted file mode 100755
index 770f5aa7..00000000
--- a/ci/run.sh
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-
-# Builds and runs tests for a particular target passed as an argument to this
-# script.
-
-set -e
-
-# This should only be run in a docker container, so verify that
-if [ ! $(pidof $0) = "1" ]; then
- echo "run.sh should only be executed in a docker container"
- echo "and that does not appear to be the case. Maybe you meant"
- echo "to execute the tests via run-all.sh or run-docker.sh."
- echo ""
- echo "For more instructions, please refer to ci/README.md"
- exit 1
-fi
-
-BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
-MANIFEST_PATH="${BASE_DIR}/Cargo.toml"
-BUILD_DIR="."
-
-VERSION="$1"
-TARGET="$2"
-
-export DOCKER_ENVIRONMENT=1
-export RUST_TEST_THREADS=1
-export RUST_BACKTRACE=1
-
-#
-# Tell cargo what linker to use and whatever else is required
-#
-configure_cargo() {
- mkdir -p .cargo
- cp -b "${BASE_DIR}/ci/cargo-config" .cargo/config
-}
-
-#
-# We need to export CC for the tests to build properly (some C code is
-# compiled) to work. We already tell Cargo about the compiler in the
-# cargo config, so we just parse that info out of the cargo config
-#
-cc_for_target() {
- awk "/\[target\.${TARGET}\]/{getline; print}" .cargo/config |
- cut -d '=' -f2 | \
- tr -d '"' | tr -d ' '
-}
-
-cross_compile_tests() {
- case "$TARGET" in
- *-apple-ios)
- cargo test --no-run --manifest-path="${MANIFEST_PATH}" --target "$TARGET" -- \
- -C link-args=-mios-simulator-version-min=7.0
- ;;
-
- *)
- cargo test --no-run --verbose \
- --manifest-path="${MANIFEST_PATH}" \
- --target "$TARGET"
- ;;
- esac
-}
-
-# This is a hack as we cannot currently
-# ask cargo what test files it generated:
-# https://github.com/rust-lang/cargo/issues/1924
-find_binaries() {
- target_base_dir="${BUILD_DIR}/${TARGET}/debug"
-
- # find [[test]] sections and print the first line and
- # hack it to what we want from there. Also "nix" for
- # tests that are implicitly prsent
- for test_base in $( awk '/\[\[test\]\]/{getline; print}' "${MANIFEST_PATH}" | \
- cut -d '=' -f2 | \
- tr -d '"' | \
- tr '-' '_' | \
- tr -d ' '; echo "nix" ); do
- for path in ${target_base_dir}/${test_base}-* ; do
- echo "${path} "
- done
- done
-}
-
-test_binary() {
- binary=$1
-
- case "$TARGET" in
- arm-linux-gnueabi-gcc)
- qemu-arm -L /usr/arm-linux-gnueabihf "$binary"
- ;;
-
- arm-unknown-linux-gnueabihf)
- qemu-arm -L /usr/arm-linux-gnueabihf "$binary"
- ;;
-
- mips-unknown-linux-gnu)
- qemu-mips -L /usr/mips-linux-gnu "$binary"
- ;;
-
- aarch64-unknown-linux-gnu)
- qemu-aarch64 -L /usr/aarch64-linux-gnu "$binary"
- ;;
-
- *-rumprun-netbsd)
- rumprun-bake hw_virtio /tmp/nix-test.img "${binary}"
- qemu-system-x86_64 -nographic -vga none -m 64 \
- -kernel /tmp/nix-test.img 2>&1 | tee /tmp/out &
- sleep 5
- grep "^PASSED .* tests" /tmp/out
- ;;
-
- *)
- echo "Running binary: ${binary}"
- ${binary}
- ;;
- esac
-}
-
-echo "======================================================="
-echo "TESTING VERSION: ${VERSION}, TARGET: ${TARGET}"
-echo "======================================================="
-
-configure_cargo
-export CC="$(cc_for_target)"
-if [ "${CC}" = "" ]; then
- unset CC
-fi
-
-# select the proper version
-multirust override ${VERSION}
-
-# build the tests
-cross_compile_tests
-
-# and run the tests
-for bin in $(find_binaries); do
- test_binary "${bin}"
-done