From 0b05b2a845b6249d2903f899e1b2532b93452b71 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa <malbarbo@gmail.com> Date: Wed, 19 Apr 2017 10:59:04 -0300 Subject: [PATCH] Enable kvm in docker images if available --- ci/run-docker.sh | 4 ++++ ci/run.sh | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 1ac419a3..c14f34c5 100644 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -8,10 +8,14 @@ run() { # use -f so we can use ci/ as build context docker build -t libc -f ci/docker/$1/Dockerfile ci/ mkdir -p target + if [ -w /dev/kvm ]; then + kvm="--volume /dev/kvm:/dev/kvm" + fi docker run \ --user `id -u`:`id -g` \ --rm \ --volume $HOME/.cargo:/cargo \ + $kvm \ --env CARGO_HOME=/cargo \ --volume `rustc --print sysroot`:/rust:ro \ --volume `pwd`:/checkout:ro \ diff --git a/ci/run.sh b/ci/run.sh index 1b6e0fb1..f854eb6f 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -111,7 +111,11 @@ case "$TARGET" in # https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791 export SHELL=/bin/dash arch=$(echo $TARGET | cut -d- -f1) - emulator @$arch -no-window -no-accel & + accel="-no-accel" + if emulator -accel-check; then + accel="" + fi + emulator @$arch -no-window $accel & adb wait-for-device adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/local/tmp/libc-test adb shell /data/local/tmp/libc-test 2>&1 | tee /tmp/out -- GitLab