Use KVM for Android emulator

This commit is contained in:
Alexandre Lissy 2020-02-25 14:11:20 +01:00
parent 84ac39769c
commit af45400461
3 changed files with 9 additions and 2 deletions

View File

@ -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:

View File

@ -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

View File

@ -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 &&