Debian Codegraph @

libcxx/utils/ci/vendor/android/run-buildbot-container

raw
1 #!/usr/bin/env bash
2
3 # Similar to libcxx/utils/ci/run-buildbot-container, but adds additional options
4 # needed for running Android tests.
5
6 set -e
7
8 MONOREPO_ROOT="$(git rev-parse --show-toplevel)"
9 if [[ ! -d "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android" ]]; then
10 echo "Was unable to find the root of the LLVM monorepo; are you running from within the monorepo?"
11 exit 1
12 fi
13
14 DOCKER_OPTIONS=(-it)
15 DOCKER_OPTIONS+=(--volume "${MONOREPO_ROOT}:/llvm")
16 DOCKER_OPTIONS+=(--workdir "/llvm")
17 DOCKER_OPTIONS+=(--cap-add=SYS_PTRACE)
18
19 # Mount this volume to allow the main image to share its copy of the Android
20 # 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.
22 DOCKER_OPTIONS+=(--volume android-platform-tools:/mnt/android-platform-tools)
23
24 # Pass through the Docker socket so that the buildbot can start a sibling
25 # container running an Android emulator.
26 if [ -S /var/run/docker.sock ]; then
27 DOCKER_OPTIONS+=(--volume /var/run/docker.sock:/var/run/docker.sock)
28 fi
29
30 docker 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)'