Skip to content

Commit 9199394

Browse files
committed
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
1 parent 958a3d0 commit 9199394

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

ci/docker/x86_64-unknown-freebsd/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ RUN apt-get install -y --no-install-recommends \
88
ENTRYPOINT ["sh"]
99

1010
ENV PATH=$PATH:/rust/bin \
11-
QEMU=freebsd.qcow2 \
11+
QEMU=freebsd.qcow2.gz \
1212
CAN_CROSS=1 \
1313
CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc

ci/run.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,21 @@ TARGET=$1
1616
if [ "$QEMU" != "" ]; then
1717
tmpdir=/tmp/qemu-img-creation
1818
mkdir -p $tmpdir
19-
if [ ! -f $tmpdir/$QEMU ]; then
20-
curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU.gz | \
21-
gunzip -d > $tmpdir/$QEMU
19+
20+
if [ -z "${QEMU#*.gz}" ]; then
21+
# image is .gz : download and uncompress it
22+
qemufile=$(echo ${QEMU%.gz} | sed 's/\//__/g')
23+
if [ ! -f $tmpdir/$qemufile ]; then
24+
curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU | \
25+
gunzip -d > $tmpdir/$qemufile
26+
fi
27+
else
28+
# plain qcow2 image: just download it
29+
qemufile=$(echo ${QEMU} | sed 's/\//__/g')
30+
if [ ! -f $tmpdir/$qemufile ]; then
31+
curl https://people.mozilla.org/~acrichton/libc-test/qemu/$QEMU \
32+
> $tmpdir/$qemufile
33+
fi
2234
fi
2335

2436
# Create a mount a fresh new filesystem image that we'll later pass to QEMU.
@@ -80,7 +92,7 @@ if [ "$QEMU" != "" ]; then
8092
$program \
8193
-m 1024 \
8294
-snapshot \
83-
-drive if=virtio,file=$tmpdir/$QEMU \
95+
-drive if=virtio,file=$tmpdir/$qemufile \
8496
-drive if=virtio,file=$tmpdir/libc-test.img \
8597
-net nic,model=virtio \
8698
-net user \

0 commit comments

Comments
 (0)