From 919939451f36d9341fcd8acdf1042b1b7bb3b12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Marie?= <semarie@users.noreply.github.com> Date: Thu, 8 Sep 2016 06:36:05 +0200 Subject: [PATCH] extend QEMU image management - allow QEMU name to have subdirectory inside (replace `/` by `__` in the filename) - add a new code path for plain qcow2 image (for efficient bandwidth usage, the qcow2 is expected to use compressed qcow2 format) - move freebsd image to explicitly download the gzipped QEMU --- ci/docker/x86_64-unknown-freebsd/Dockerfile | 2 +- ci/run.sh | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ci/docker/x86_64-unknown-freebsd/Dockerfile b/ci/docker/x86_64-unknown-freebsd/Dockerfile index bffcaa0c..23135e8d 100644 --- a/ci/docker/x86_64-unknown-freebsd/Dockerfile +++ b/ci/docker/x86_64-unknown-freebsd/Dockerfile @@ -8,6 +8,6 @@ RUN apt-get install -y --no-install-recommends \ ENTRYPOINT ["sh"] ENV PATH=$PATH:/rust/bin \ - QEMU=freebsd.qcow2 \ + QEMU=freebsd.qcow2.gz \ CAN_CROSS=1 \ CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc diff --git a/ci/run.sh b/ci/run.sh index 4e04dddd..a4e71177 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -16,9 +16,21 @@ TARGET=$1 if [ "$QEMU" != "" ]; then tmpdir=/tmp/qemu-img-creation mkdir -p $tmpdir - if [ ! -f $tmpdir/$QEMU ]; then - curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU.gz | \ - gunzip -d > $tmpdir/$QEMU + + 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://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU | \ + gunzip -d > $tmpdir/$qemufile + fi + else + # plain qcow2 image: just download it + qemufile=$(echo ${QEMU} | sed 's/\//__/g') + if [ ! -f $tmpdir/$qemufile ]; then + curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU \ + > $tmpdir/$qemufile + fi fi # Create a mount a fresh new filesystem image that we'll later pass to QEMU. @@ -80,7 +92,7 @@ if [ "$QEMU" != "" ]; then $program \ -m 1024 \ -snapshot \ - -drive if=virtio,file=$tmpdir/$QEMU \ + -drive if=virtio,file=$tmpdir/$qemufile \ -drive if=virtio,file=$tmpdir/libc-test.img \ -net nic,model=virtio \ -net user \ -- GitLab