32 lines · plain
1#!/usr/bin/env bash2 3# Similar to libcxx/utils/ci/run-buildbot-container, but adds additional options4# needed for running Android tests.5 6set -e7 8MONOREPO_ROOT="$(git rev-parse --show-toplevel)"9if [[ ! -d "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android" ]]; then10 echo "Was unable to find the root of the LLVM monorepo; are you running from within the monorepo?"11 exit 112fi13 14DOCKER_OPTIONS=(-it)15DOCKER_OPTIONS+=(--volume "${MONOREPO_ROOT}:/llvm")16DOCKER_OPTIONS+=(--workdir "/llvm")17DOCKER_OPTIONS+=(--cap-add=SYS_PTRACE)18 19# Mount this volume to allow the main image to share its copy of the Android20# platform tools with the emulator image, ensuring that the adb versions match.21# This argument will create a new volume if it doesn't already exist.22DOCKER_OPTIONS+=(--volume android-platform-tools:/mnt/android-platform-tools)23 24# Pass through the Docker socket so that the buildbot can start a sibling25# container running an Android emulator.26if [ -S /var/run/docker.sock ]; then27 DOCKER_OPTIONS+=(--volume /var/run/docker.sock:/var/run/docker.sock)28fi29 30docker run "${DOCKER_OPTIONS[@]}" ghcr.io/llvm/libcxx-android-builder \31 bash -c 'git config --global --add safe.directory /llvm; (/opt/android/container-setup.sh && exec bash)'32