Enable kvm in docker images if available

This commit is contained in:
Marco A L Barbosa 2017-04-19 10:59:04 -03:00
parent 05a2d19735
commit 0b05b2a845
2 changed files with 9 additions and 1 deletions

View File

@ -8,10 +8,14 @@ run() {
# use -f so we can use ci/ as build context # use -f so we can use ci/ as build context
docker build -t libc -f ci/docker/$1/Dockerfile ci/ docker build -t libc -f ci/docker/$1/Dockerfile ci/
mkdir -p target mkdir -p target
if [ -w /dev/kvm ]; then
kvm="--volume /dev/kvm:/dev/kvm"
fi
docker run \ docker run \
--user `id -u`:`id -g` \ --user `id -u`:`id -g` \
--rm \ --rm \
--volume $HOME/.cargo:/cargo \ --volume $HOME/.cargo:/cargo \
$kvm \
--env CARGO_HOME=/cargo \ --env CARGO_HOME=/cargo \
--volume `rustc --print sysroot`:/rust:ro \ --volume `rustc --print sysroot`:/rust:ro \
--volume `pwd`:/checkout:ro \ --volume `pwd`:/checkout:ro \

View File

@ -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 # 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 export SHELL=/bin/dash
arch=$(echo $TARGET | cut -d- -f1) 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 wait-for-device
adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/local/tmp/libc-test 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 adb shell /data/local/tmp/libc-test 2>&1 | tee /tmp/out