summaryrefslogtreecommitdiff
path: root/libc/ci/run.sh
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2018-12-10 21:00:27 -0800
committerDaniel Mueller <deso@posteo.net>2018-12-10 21:00:27 -0800
commite2604a756aaddcd5919ee2f1b9cc0055d200f846 (patch)
tree1ea1b9900db20d3aadbddbce18882d0c957247d7 /libc/ci/run.sh
parent5875df6c958743cf86c75b2cb5fc2efe5ca0de43 (diff)
downloadnitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.gz
nitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.bz2
Update libc crate to 0.2.45
This change updates the libc crate to version 0.2.45. Import subrepo libc/:libc at f5636fc618f8e16968b3178196d73c94ad9f7b05
Diffstat (limited to 'libc/ci/run.sh')
-rwxr-xr-xlibc/ci/run.sh69
1 files changed, 43 insertions, 26 deletions
diff --git a/libc/ci/run.sh b/libc/ci/run.sh
index 02dd35a..81ebd61 100755
--- a/libc/ci/run.sh
+++ b/libc/ci/run.sh
@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env sh
# Builds and runs tests for a particular target passed as an argument to this
# script.
set -ex
-TARGET=$1
+TARGET="${1}"
# If we're going to run tests inside of a qemu image, then we don't need any of
# the scripts below. Instead, download the image, prepare a filesystem which has
@@ -15,45 +15,53 @@ TARGET=$1
# script from the second which we place inside.
if [ "$QEMU" != "" ]; then
tmpdir=/tmp/qemu-img-creation
- mkdir -p $tmpdir
+ mkdir -p "${tmpdir}"
if [ -z "${QEMU#*.gz}" ]; then
# image is .gz : download and uncompress it
- qemufile=$(echo ${QEMU%.gz} | sed 's/\//__/g')
- if [ ! -f $tmpdir/$qemufile ]; then
- curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \
- gunzip -d > $tmpdir/$qemufile
+ qemufile="$(echo "${QEMU%.gz}" | sed 's/\//__/g')"
+ if [ ! -f "${tmpdir}/${qemufile}" ]; then
+ curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \
+ gunzip -d > "${tmpdir}/${qemufile}"
+ fi
+ elif [ -z "${QEMU#*.xz}" ]; then
+ # image is .xz : download and uncompress it
+ qemufile="$(echo "${QEMU%.xz}" | sed 's/\//__/g')"
+ if [ ! -f "${tmpdir}/${qemufile}" ]; then
+ curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \
+ unxz > "${tmpdir}/${qemufile}"
fi
else
# plain qcow2 image: just download it
- qemufile=$(echo ${QEMU} | sed 's/\//__/g')
- if [ ! -f $tmpdir/$qemufile ]; then
- curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU \
- > $tmpdir/$qemufile
+ qemufile="$(echo "${QEMU}" | sed 's/\//__/g')"
+ if [ ! -f "${tmpdir}/${qemufile}" ]; then
+ curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" \
+ > "${tmpdir}/${qemufile}"
fi
fi
# Create a mount a fresh new filesystem image that we'll later pass to QEMU.
# This will have a `run.sh` script will which use the artifacts inside to run
# on the host.
- rm -f $tmpdir/libc-test.img
- mkdir $tmpdir/mount
+ rm -f "${tmpdir}/libc-test.img"
+ mkdir "${tmpdir}/mount"
# Do the standard rigamarole of cross-compiling an executable and then the
# script to run just executes the binary.
cargo build \
--manifest-path libc-test/Cargo.toml \
- --target $TARGET \
+ --target "${TARGET}" \
--test main
- rm $CARGO_TARGET_DIR/$TARGET/debug/main-*.d
- cp $CARGO_TARGET_DIR/$TARGET/debug/main-* $tmpdir/mount/libc-test
- echo 'exec $1/libc-test' > $tmpdir/mount/run.sh
+ rm "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-*.d
+ cp "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-* "${tmpdir}"/mount/libc-test
+ # shellcheck disable=SC2016
+ echo 'exec $1/libc-test' > "${tmpdir}/mount/run.sh"
- du -sh $tmpdir/mount
+ du -sh "${tmpdir}/mount"
genext2fs \
- --root $tmpdir/mount \
+ --root "${tmpdir}/mount" \
--size-in-blocks 100000 \
- $tmpdir/libc-test.img
+ "${tmpdir}/libc-test.img"
# Pass -snapshot to prevent tampering with the disk images, this helps when
# running this script in development. The two drives are then passed next,
@@ -63,20 +71,29 @@ if [ "$QEMU" != "" ]; then
qemu-system-x86_64 \
-m 1024 \
-snapshot \
- -drive if=virtio,file=$tmpdir/$qemufile \
- -drive if=virtio,file=$tmpdir/libc-test.img \
+ -drive if=virtio,file="${tmpdir}/${qemufile}" \
+ -drive if=virtio,file="${tmpdir}/libc-test.img" \
-net nic,model=virtio \
-net user \
-nographic \
- -vga none 2>&1 | tee $CARGO_TARGET_DIR/out.log
- exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
+ -vga none 2>&1 | tee "${CARGO_TARGET_DIR}/out.log"
+ exec grep "^PASSED .* tests" "${CARGO_TARGET_DIR}/out.log"
fi
-# FIXME: x86_64-unknown-linux-gnux32 fail to compile wihout --release
+# FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release
# See https://github.com/rust-lang/rust/issues/45417
opt=
if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
opt="--release"
fi
-exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET
+# Building with --no-default-features is currently broken on rumprun because we
+# need cfg(target_vendor), which is currently unstable.
+if [ "$TARGET" != "x86_64-rumprun-netbsd" ]; then
+ cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target "${TARGET}"
+fi
+# Test the #[repr(align(x))] feature if this is building on Rust >= 1.25
+if [ "$(rustc --version | sed -E 's/^rustc 1\.([0-9]*)\..*/\1/')" -ge 25 ]; then
+ cargo test $opt --features align --manifest-path libc-test/Cargo.toml --target "${TARGET}"
+fi
+exec cargo test $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}"