Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mach bootstrap-android and test-android-startup commands #21094

Merged
merged 30 commits into from Jul 2, 2018
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b9d5f11
Add `./mach bootstrap-android`
SimonSapin Jun 21, 2018
510cf1a
boostrap: set executable bits when extracting zip files
SimonSapin Jun 21, 2018
56df7f4
Install complete Android SDK (as much as on Buildbot CI)
SimonSapin Jun 21, 2018
244a332
Use more recent Android tools
SimonSapin Jun 25, 2018
1ee54ab
Create and Android virtual device
SimonSapin Jun 25, 2018
8889742
mach bootstrap-android: configure and show how to start an emulator
SimonSapin Jun 25, 2018
fe24816
mach run --android: show PID
SimonSapin Jun 25, 2018
4cbf3de
mach {package,install} --android: add --emulator and --usb
SimonSapin Jun 25, 2018
eab971c
Android cross-compiled command line hello world
SimonSapin Jun 25, 2018
90ba22b
egl-configs: link to EGL and generate bindings
SimonSapin Jun 25, 2018
89f6c6d
egl-configs: get the number of configs
SimonSapin Jun 25, 2018
7e7316e
egl-configs: print all config attributes
SimonSapin Jun 25, 2018
1f8d04b
egl-configs: print hex too
SimonSapin Jun 25, 2018
6e68705
cargo run into Android/adb: configurable target device
SimonSapin Jun 25, 2018
484eee8
Tidy
SimonSapin Jun 25, 2018
3c992af
Remove debugging println from a year ago
SimonSapin Jun 26, 2018
7d7f202
Fix copy/paste mistake
SimonSapin Jun 26, 2018
b7a8b81
egl-configs: add i686 support
SimonSapin Jun 26, 2018
f4d740f
Typo fixes
SimonSapin Jun 27, 2018
e54ad77
Do not prompt for Android emulator hardware profile
SimonSapin Jun 28, 2018
0e2e9cb
Create emulator images for both ARM and x86
SimonSapin Jun 28, 2018
aa1c3ce
bootstrap-android: use predictable paths for SDK and NDK
SimonSapin Jun 28, 2018
65122b1
bootstrap-android: always run sdkmanager
SimonSapin Jun 28, 2018
fc77db4
Use the bootstraped Android toolchains by default
SimonSapin Jun 28, 2018
b6b9fe0
Add "./mach android-emulator"
SimonSapin Jun 28, 2018
9e544c2
Remove the egl-configs diagnostic program
SimonSapin Jun 29, 2018
8293b29
bootstrap-android: check SHA1 hashes of downloaded archives
SimonSapin Jun 29, 2018
bee3fd0
mach android-emulator: avoid mach error messages for Python exceptions
SimonSapin Jun 29, 2018
eecbe83
Add ./mach test-android-startup
SimonSapin Jun 29, 2018
c0d1b8e
Android: increase emulator disk size, for debug builds
SimonSapin Jul 2, 2018
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Tidy

  • Loading branch information
SimonSapin committed Jul 2, 2018
commit 484eee86248e7eab71fe78dab2c1419a42e61271
@@ -72,7 +72,6 @@ def bootstrap_android(self, update=False):
system_image = "google_apis;armeabi-v7a"
avd_name = "servo-armv7"

This comment has been minimized.

@paulrouget

paulrouget Jun 28, 2018

Contributor

Is it worth also creating the x86 emulator?

This comment has been minimized.

@SimonSapin

SimonSapin Jun 28, 2018

Author Member

Done.



toolchains = path.join(self.context.topdir, "android-toolchains")
if not path.isdir(toolchains):
os.makedirs(toolchains)
@@ -153,6 +153,7 @@ def download_file(desc, src, dst):
download(desc, src, fd)
os.rename(tmp_path, dst)


# https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries
# In particular, we want the executable bit for executable files.
class ZipFileWithUnixPermissions(zipfile.ZipFile):
@@ -169,6 +170,7 @@ def extract(self, member, path=None, pwd=None):
os.chmod(extracted, mode)
return extracted


def extract(src, dst, movedir=None, remove=True):
assert src.endswith(".zip")
ZipFileWithUnixPermissions(src).extractall(dst)
@@ -183,6 +185,7 @@ def extract(src, dst, movedir=None, remove=True):
if remove:
os.remove(src)


def check_hash(filename, expected, algorithm):

This comment has been minimized.

@paulrouget

paulrouget Jun 28, 2018

Contributor

I don't think this is used anywhere.

hasher = hashlib.new(algorithm)
with open(filename, "rb") as f:
@@ -58,6 +58,7 @@ files = [
"./resources/hsts_preload.json",
"./tests/wpt/metadata/MANIFEST.json",
"./support/android/openssl.sh",
"./support/android/egl-configs/Cargo.lock",
# Upstream code from Khronos/WebGL uses tabs for indentation
"./tests/wpt/mozilla/tests/webgl",
# Ignore those files since the issues reported are on purpose
@@ -1,6 +1,7 @@
[package]
name = "egl-configs"
version = "0.1.0"
license = "MPL-2.0"

[build-dependencies]
gl_generator = "0.9"
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

extern crate gl_generator;

use gl_generator::{Registry, Api, Profile, Fallbacks};
@@ -1,6 +1,16 @@
#!/bin/sh
#!/usr/bin/env bash

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

set -o errexit
set -o nounset
set -o pipefail

NDK=../../../android-toolchains/android-ndk-r12b-linux-x86_64/android-ndk-r12b
BIN="${NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/"

"${NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc" \
"${BIN}/arm-linux-androideabi-gcc" \
--sysroot "${NDK}/platforms/android-18/arch-arm" \
"$@"
"${@}"
@@ -1,22 +1,30 @@
#!/bin/sh
#!/usr/bin/env bash

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

set -o errexit
set -o nounset
set -o pipefail

# Any
#target=""
target=""

# Specific device
#target="-s something"

# Emulator
target="-e"
#target="-e"

# USB
#target="-d"

path="$1"
base="$(basename $1)"
remote_path="/data/local/tmp/$base"
path="${1}"

This comment has been minimized.

@paulrouget

paulrouget Jun 28, 2018

Contributor

Can you add a short readme in this directory to summarize what this is about.

This comment has been minimized.

@SimonSapin

SimonSapin Jun 29, 2018

Author Member

Per IRC discussion, I’ve removed all of egl-config now that it has served its purpose.

#21094 (comment) explains what this was about.

base="$(basename ${1})"
remote_path="/data/local/tmp/${base}"
shift

adb $target "wait-for-device"
adb $target push "$path" "$remote_path" >&2
adb $target shell "$remote_path" "$@"
adb ${target} "wait-for-device"
adb ${target} push "${path}" "${remote_path}" >&2
adb ${target} shell "${remote_path}" "${@}"
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#![allow(non_camel_case_types)]

use std::os::raw::*;
@@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use ffi::*;
use ffi::types::*;
use std::ptr::null_mut;
@@ -11,8 +15,8 @@ fn main() {
}

macro_rules! check {
($name: ident ( $($arg: expr),* )) => {
check($name( $($arg),* ), stringify!($name))
($name: ident($($arg: expr),*)) => {
check($name($($arg),*), stringify!($name))
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.