Unverified Commit 57c68540 authored by Sharjeel Khan's avatar Sharjeel Khan Committed by GitHub
Browse files

Update Android CI and Emulator image to API 23 (#194936)

As seen in https://github.com/android/ndk/issues/2188, NDK will raise
minimum supported version to API 23 (Android 6.0) in r31. We need to
bump the API level for the x86 emulator image so we can use it for the
CI. It required generating a new ABI list for API 23 and removing the
old API 21 and making some changes to adb_run.py to filter out warnings
and get permissions for the adb run folder.
parent edfb913a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
{'is_defined': False, 'name': '__cxa_atexit@LIBC', 'type': 'FUNC'}
{'is_defined': False, 'name': '__cxa_finalize@LIBC', 'type': 'FUNC'}
{'is_defined': False, 'name': '__cxa_thread_atexit_impl@LIBC', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNKSt10bad_typeid4whatEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNKSt11logic_error4whatEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNKSt12bad_any_cast4whatEv', 'type': 'FUNC'}
+1 −0
Original line number Diff line number Diff line
{'is_defined': False, 'name': '__cxa_atexit@LIBC', 'type': 'FUNC'}
{'is_defined': False, 'name': '__cxa_finalize@LIBC', 'type': 'FUNC'}
{'is_defined': False, 'name': '__cxa_thread_atexit_impl@LIBC', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNKSt10bad_typeid4whatEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNKSt11logic_error4whatEv', 'type': 'FUNC'}
{'is_defined': True, 'name': '_ZNKSt12bad_any_cast4whatEv', 'type': 'FUNC'}
+28 −5
Original line number Diff line number Diff line
@@ -63,6 +63,16 @@ def sync_test_dir(local_dir: str, remote_dir: str) -> None:
        if not os.path.islink(local_file) and os.path.isfile(local_file):
            run_adb_sync_command(["adb", "push", "--sync", local_file,
                                  remote_file])
            # Some libc++ tests create temporary files in the working directory,
            # which might be owned by root. In Android M (API 23), the
            # directories are owned by root so they are not writable by the
            # shell user. Make them writable before running the tests as the shell
            # user.
            run_adb_sync_command(["adb", "shell", "chmod", "777", REMOTE_BASE_DIR])
            run_adb_sync_command(
                ["adb", "shell", "chmod", "777", os.path.dirname(remote_dir)]
            )
            run_adb_sync_command(["adb", "shell", "chmod", "777", remote_dir])
            return

    assert os.path.basename(local_dir) == os.path.basename(remote_dir)
@@ -70,6 +80,13 @@ def sync_test_dir(local_dir: str, remote_dir: str) -> None:
    run_adb_sync_command(["adb", "push", "--sync", local_dir,
                          os.path.dirname(remote_dir)])

    # Some libc++ tests create temporary files in the working directory, which might be
    # owned by root. In Android M (API 23), the directories are owned by root so they are
    # not writable by the shell user. Make them writable before running the tests as the
    # shell user.
    run_adb_sync_command(["adb", "shell", "chmod", "777", REMOTE_BASE_DIR])
    run_adb_sync_command(["adb", "shell", "chmod", "777", os.path.dirname(remote_dir)])
    run_adb_sync_command(["adb", "shell", "chmod", "777", remote_dir])

def build_env_arg(env_args: List[str], prepend_path_args: List[Tuple[str, str]]) -> str:
    components = []
@@ -115,10 +132,6 @@ def run_command(args: argparse.Namespace) -> int:
        # and always run as root. Non-debug builds typically lack `su` and only
        # run as the shell user.
        #
        # Some libc++ tests create temporary files in the working directory,
        # which might be owned by root. Before switching to shell, make the
        # cwd writable (and readable+executable) to every user.
        #
        # N.B.:
        #  - Avoid "id -u" because it wasn't supported until Android M.
        #  - The `env` and `which` commands were also added in Android M.
@@ -204,7 +217,17 @@ def run_command(args: argparse.Namespace) -> int:
                             f"  output: {output}\n")
            return 1

        sys.stderr.write(match.group(1))
        # Android M (API 23) will print a warning for DT_FLAGS_1=0x8000001
        # because they were not set until 2016 which is Android O.
        stderr_content = match.group(1)
        stderr_content = re.sub(
            r"^WARNING: linker: .*unsupported flags DT_FLAGS_1=.*\n?",
            "",
            stderr_content,
            flags=re.MULTILINE,
        )

        sys.stderr.write(stderr_content)
        sys.stdout.write(match.group(2))
        return int(match.group(3))

+2 −2
Original line number Diff line number Diff line
@@ -153,8 +153,8 @@ steps:

- group: ':android: Android'
  steps:
  - label: Android 5.0, x86 NDK
    command: libcxx/utils/ci/run-buildbot android-ndk-21-def-x86
  - label: Android 6.0, x86 NDK
    command: libcxx/utils/ci/run-buildbot android-ndk-23-def-x86
    env:
      CC: /opt/android/clang/clang-current/bin/clang
      CXX: /opt/android/clang/clang-current/bin/clang++
+1 −1
Original line number Diff line number Diff line
@@ -24,5 +24,5 @@ build_image() {

cd "${THIS_DIR}"

build_image 21-def-x86
build_image 23-def-x86
build_image 33-goog-x86_64
Loading