From af454004615818f41c2ad9f6d1ac106f034dffea Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Tue, 25 Feb 2020 14:11:20 +0100 Subject: [PATCH] Use KVM for Android emulator --- .taskcluster.yml | 1 + taskcluster/tc-android-utils.sh | 2 +- taskcluster/test-android-opt-base.tyml | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.taskcluster.yml b/.taskcluster.yml index 63e4d04a..89e4ebbe 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -27,6 +27,7 @@ tasks: "index:insert-task:project.deepspeech.*", "queue:scheduler-id:taskcluster-github", "generic-worker:cache:deepspeech-macos-pyenv", + "docker-worker:capability:device:kvm" ] payload: diff --git a/taskcluster/tc-android-utils.sh b/taskcluster/tc-android-utils.sh index 4deffd5a..a71edfb3 100755 --- a/taskcluster/tc-android-utils.sh +++ b/taskcluster/tc-android-utils.sh @@ -145,7 +145,7 @@ android_start_emulator() # > emulator: INFO: QtLogger.cpp:68: Warning: could not connect to display ((null):0, (null)) # -accel on is needed otherwise it is too slow, but it will require KVM support exposed pushd ${ANDROID_SDK_HOME} - xvfb-run ./tools/emulator -verbose -avd "${_flavor}-ds-pixel-${_api_level}" -no-skin -no-audio -no-window -no-boot-anim -accel off & + xvfb-run ./tools/emulator -verbose -avd "${_flavor}-ds-pixel-${_api_level}" -no-skin -no-audio -no-window -no-boot-anim -accel on & emulator_rc=$? export ANDROID_DEVICE_EMULATOR=$! popd diff --git a/taskcluster/test-android-opt-base.tyml b/taskcluster/test-android-opt-base.tyml index dda7e963..b0be5330 100644 --- a/taskcluster/test-android-opt-base.tyml +++ b/taskcluster/test-android-opt-base.tyml @@ -12,6 +12,8 @@ then: created: { $fromNow: '0 sec' } deadline: { $fromNow: '1 day' } expires: { $fromNow: '7 days' } + scopes: + - "docker-worker:capability:device:kvm" extra: github: @@ -21,6 +23,10 @@ then: maxRunTime: { $eval: to_int(build.maxRunTime) } image: "ubuntu:18.04" + capabilities: + devices: + kvm: true + env: $let: training: { $eval: as_slugid(build.test_model_task) } @@ -41,7 +47,7 @@ then: in: > apt-get -qq update && apt-get -qq -y install git gnupg pixz sox sudo wget unzip software-properties-common xvfb && add-apt-repository --yes ppa:openjdk-r/ppa && apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq -y --force-yes install openjdk-8-jdk && java -version && update-ca-certificates -f && - ${extraSystemSetup} && + ${extraSystemSetup} && chmod 777 /dev/kvm && adduser --system --home ${system.homedir.linux} ${system.username} && cd ${system.homedir.linux} && echo -e "#!/bin/bash\nset -xe\n env && id && mkdir ~/DeepSpeech/ && git clone --quiet ${event.head.repo.url} ~/DeepSpeech/ds/ && cd ~/DeepSpeech/ds && git checkout --quiet ${event.head.sha} && mkdir -p ${system.homedir.linux}/ds-swig/bin/ && wget -O - ${system.swig.cache.linux_amd64} | tar -C ${system.homedir.linux}/ds-swig/ -xzf - && wget -O - ${build.cache.url} | tar -C ${system.homedir.linux} -xzf - && if [ ! -z "${build.gradle_cache.url}" ]; then wget -O - ${build.gradle_cache.url} | tar -C ${system.homedir.linux}/ -xzf - ; fi;" > /tmp/clone.sh && chmod +x /tmp/clone.sh &&