diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-07-13 14:17:33 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-07-24 16:24:52 -0700 |
| commit | 8ef3f69ffb03f8b5c83c44a6300bdfc8f73f6296 (patch) | |
| tree | 657b27713b42c8daee9e8cf62df8ad9be4b7720f /src/ci/docker/scripts | |
| parent | b80e946101dd49dd1864b6229f9430c55036c7ce (diff) | |
| download | rust-8ef3f69ffb03f8b5c83c44a6300bdfc8f73f6296.tar.gz rust-8ef3f69ffb03f8b5c83c44a6300bdfc8f73f6296.zip | |
Add a disabled builder for aarch64 emulated tests
This commit adds a disabled builder which will run all tests for the standard library for aarch64 in a QEMU instance. Once we get enough capacity to run this on Travis this can be used to boost our platform coverage of AArch64
Diffstat (limited to 'src/ci/docker/scripts')
| -rw-r--r-- | src/ci/docker/scripts/qemu-bare-bones-addentropy.c | 43 | ||||
| -rw-r--r-- | src/ci/docker/scripts/qemu-bare-bones-rcS | 28 |
2 files changed, 71 insertions, 0 deletions
diff --git a/src/ci/docker/scripts/qemu-bare-bones-addentropy.c b/src/ci/docker/scripts/qemu-bare-bones-addentropy.c new file mode 100644 index 00000000000..8975739e3c0 --- /dev/null +++ b/src/ci/docker/scripts/qemu-bare-bones-addentropy.c @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#include <assert.h> +#include <stdint.h> +#include <sys/ioctl.h> +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <linux/random.h> + +#define N 2048 + +struct entropy { + int ent_count; + int size; + unsigned char data[N]; +}; + +int main() { + struct entropy buf; + ssize_t n; + + int random_fd = open("/dev/random", O_RDWR); + assert(random_fd >= 0); + + while ((n = read(0, &buf.data, N)) > 0) { + buf.ent_count = n * 8; + buf.size = n; + if (ioctl(random_fd, RNDADDENTROPY, &buf) != 0) { + perror("failed to add entropy"); + } + } + + return 0; +} diff --git a/src/ci/docker/scripts/qemu-bare-bones-rcS b/src/ci/docker/scripts/qemu-bare-bones-rcS new file mode 100644 index 00000000000..3c29bedc13c --- /dev/null +++ b/src/ci/docker/scripts/qemu-bare-bones-rcS @@ -0,0 +1,28 @@ +#!/bin/sh +mount -t proc none /proc +mount -t sysfs none /sys +/sbin/mdev -s + +# fill up our entropy pool, if we don't do this then anything with a hash map +# will likely block forever as the kernel is pretty unlikely to have enough +# entropy. +/addentropy < /addentropy +cat /dev/urandom | head -n 2048 | /addentropy + +# Set up IP that qemu expects. This confgures eth0 with the public IP that QEMU +# will communicate to as well as the loopback 127.0.0.1 address. +ifconfig eth0 10.0.2.15 +ifconfig lo up + +# Configure DNS resolution of 'localhost' to work +echo 'hosts: files dns' >> /ubuntu/etc/nsswitch.conf +echo '127.0.0.1 localhost' >> /ubuntu/etc/hosts + +# prepare the chroot +mount -t proc proc /ubuntu/proc/ +mount --rbind /sys /ubuntu/sys/ +mount --rbind /dev /ubuntu/dev/ + +# Execute our `testd` inside the ubuntu chroot +cp /testd /ubuntu/testd +chroot /ubuntu /testd & |
