1a30095a1SRyan Prichard#!/usr/bin/env bash 2a30095a1SRyan Prichard 3a30095a1SRyan Prichard# Similar to libcxx/utils/ci/run-buildbot-container, but adds additional options 4a30095a1SRyan Prichard# needed for running Android tests. 5a30095a1SRyan Prichard 6a30095a1SRyan Prichardset -e 7a30095a1SRyan Prichard 8a30095a1SRyan PrichardMONOREPO_ROOT="$(git rev-parse --show-toplevel)" 9a30095a1SRyan Prichardif [[ ! -d "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android" ]]; then 10a30095a1SRyan Prichard echo "Was unable to find the root of the LLVM monorepo; are you running from within the monorepo?" 11a30095a1SRyan Prichard exit 1 12a30095a1SRyan Prichardfi 13a30095a1SRyan Prichard 14a30095a1SRyan PrichardDOCKER_OPTIONS=(-it) 15a30095a1SRyan PrichardDOCKER_OPTIONS+=(--volume "${MONOREPO_ROOT}:/llvm") 16a30095a1SRyan PrichardDOCKER_OPTIONS+=(--workdir "/llvm") 17a30095a1SRyan PrichardDOCKER_OPTIONS+=(--cap-add=SYS_PTRACE) 18a30095a1SRyan Prichard 19a30095a1SRyan Prichard# Mount this volume to allow the main image to share its copy of the Android 20a30095a1SRyan Prichard# platform tools with the emulator image, ensuring that the adb versions match. 21a30095a1SRyan Prichard# This argument will create a new volume if it doesn't already exist. 22a30095a1SRyan PrichardDOCKER_OPTIONS+=(--volume android-platform-tools:/mnt/android-platform-tools) 23a30095a1SRyan Prichard 24a30095a1SRyan Prichard# Pass through the Docker socket so that the buildbot can start a sibling 25a30095a1SRyan Prichard# container running an Android emulator. 26a30095a1SRyan Prichardif [ -S /var/run/docker.sock ]; then 27a30095a1SRyan Prichard DOCKER_OPTIONS+=(--volume /var/run/docker.sock:/var/run/docker.sock) 28a30095a1SRyan Prichardfi 29a30095a1SRyan Prichard 30*d0c8e268SRyan Pricharddocker run "${DOCKER_OPTIONS[@]}" ghcr.io/libcxx/android-buildkite-builder \ 31a30095a1SRyan Prichard bash -c 'git config --global --add safe.directory /llvm; (/opt/android/container-setup.sh && exec bash)' 32