Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / utils / ci / vendor / android / start-emulator.sh
blob2d6e272675ea003e175a713b6ec960e426280d33
1 #!/usr/bin/env bash
2 #===----------------------------------------------------------------------===##
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===----------------------------------------------------------------------===##
10 # Starts a new Docker container using a Docker image containing the Android
11 # Emulator and an OS image. Stops and removes the old container if it exists
12 # already.
14 set -e
16 THIS_DIR="$(cd "$(dirname "$0")" && pwd)"
17 . "${THIS_DIR}/emulator-functions.sh"
19 EMU_IMG="${1}"
20 if ! validate_emu_img "${EMU_IMG}"; then
21 echo "error: The first argument must be a valid emulator image." >&2
22 exit 1
25 "${THIS_DIR}/stop-emulator.sh"
27 # Start the container.
28 docker run --name libcxx-ci-android-emulator --detach --device /dev/kvm \
29 -eEMU_PARTITION_SIZE=8192 \
30 --volume android-platform-tools:/mnt/android-platform-tools \
31 $(docker_image_of_emu_img ${EMU_IMG})
32 ERR=0
33 docker exec libcxx-ci-android-emulator emulator-wait-for-ready.sh || ERR=${?}
34 echo "Emulator container initial logs:"
35 docker logs libcxx-ci-android-emulator
36 if [ ${ERR} != 0 ]; then
37 exit ${ERR}
40 # Make sure the device is accessible from outside the emulator container and
41 # advertise to the user that this script exists.
42 . "${THIS_DIR}/setup-env-for-emulator.sh"
43 adb wait-for-device