Bug 1823989 - Fix android jsshell builds. r=jandem,firefox-build-system-reviewers,nalexander

Stop trying to use system zlib when building standalone SpiderMonkey for Android
targets and instead rely on the mozglue version. Additionally, use 'get_adb_path'
used by other geckoview tests to locate `adb` in a consistent way.

Also do some house-keeping in the documentation and log messages.

Differential Revision: https://phabricator.services.mozilla.com/D173466
This commit is contained in:
Ted Campbell 2023-03-28 00:44:41 +00:00
parent 5d946f3d90
commit 7400f52a60
4 changed files with 32 additions and 11 deletions

View file

@ -160,7 +160,7 @@ Building SpiderMonkey on Android
ac_add_options --target=aarch64-linux-android
- Then compile as usual with `mach compile` with this `MOZCONFIG` file.
- Then compile as usual with `mach build` with this `MOZCONFIG` file.
Running jit-tests on Android
----------------------------
@ -195,7 +195,7 @@ the host machine.
.. code::
adb push \
~/.mozbuild/android-ndk-r20/prebuilt/android-arm64/gdbserver/gdbserver \
~/.mozbuild/android-ndk-r23c/prebuilt/android-arm64/gdbserver/gdbserver \
/data/local/tmp/test_root/bin
- Make sure that the `ncurses5` library is installed on the host. On
@ -236,7 +236,7 @@ the host machine.
.. code::
~/.mozbuild/android-ndk-r20/prebuilt/linux-x86_64/bin/gdb /path/to/objdir-aarch64-linux-android/dist/bin/js
~/.mozbuild/android-ndk-r23c/prebuilt/linux-x86_64/bin/gdb /path/to/objdir-aarch64-linux-android/dist/bin/js
- Then connect remotely to the GDB server that's listening on the Android
device:

View file

@ -64,21 +64,38 @@ def init_device(options):
# the js binary to find the necessary libraries.
options.local_lib = posixpath.dirname(options.js_shell)
DEVICE = ADBDeviceFactory(
device=options.device_serial, test_root=options.remote_test_root
)
# Try to find 'adb' off the build environment to automatically use the
# .mozbuild version if possible. In test automation, we don't have
# mozbuild available so use the default 'adb' that automation provides.
try:
from mozbuild.base import MozbuildObject
from mozrunner.devices.android_device import get_adb_path
init_remote_dir(DEVICE, options.remote_test_root)
context = MozbuildObject.from_environment()
adb_path = get_adb_path(context)
except (ImportError):
adb_path = "adb"
DEVICE = ADBDeviceFactory(
adb=adb_path,
device=options.device_serial,
test_root=options.remote_test_root,
)
bin_dir = posixpath.join(options.remote_test_root, "bin")
tests_dir = posixpath.join(options.remote_test_root, "tests")
temp_dir = posixpath.join(options.remote_test_root, "tmp")
# Push js shell and libraries.
# Create directory structure on device
init_remote_dir(DEVICE, options.remote_test_root)
init_remote_dir(DEVICE, tests_dir)
init_remote_dir(DEVICE, bin_dir)
init_remote_dir(DEVICE, temp_dir)
# Push js shell and libraries.
push_libs(options, DEVICE, bin_dir)
push_progs(options, DEVICE, [options.js_shell], bin_dir)
# update options.js_shell to point to the js binary on the device
options.js_shell = os.path.join(bin_dir, "js")

View file

@ -111,6 +111,8 @@ def setup_device(prefix, options):
prefix[0] = posixpath.join(options.remote_test_root, "bin", "js")
tempdir = posixpath.join(options.remote_test_root, "tmp")
print("tasks_adb_remote.py : Transfering test files")
# Push tests & lib directories.
device.push(os.path.dirname(TEST_DIR), options.remote_test_root, timeout=600)
@ -180,7 +182,6 @@ def setup_script(device, prefix, tempdir, options, uniq_tag, tests):
timeout = int(options.timeout)
script_timeout = 0
try:
print("tasks_adb_remote.py : Create batch script")
tmpf = tempfile.NamedTemporaryFile(mode="w", delete=False)
tmpf.write(script_preamble(uniq_tag, prefix, options))
for i, test in enumerate(tests):
@ -247,7 +248,6 @@ def start_script(
adb_process, prefix, tempdir, uniq_tag, tests, options
):
yield test_output
print("tasks_adb_remote.py : Finished")
except ADBProcessError as e:
# After a device error, the device is typically in a
# state where all further tests will fail so there is no point in

View file

@ -976,7 +976,11 @@ check_prog(
@depends(js_standalone, target)
def system_zlib_default(js_standalone, target):
return js_standalone and target.kernel not in ("WINNT", "Darwin")
return (
js_standalone
and target.kernel not in ("WINNT", "Darwin")
and target.os != "Android"
)
option(