Bug 1608126 - Enable node for Android xpcshell tests and run node tests on Android; r=valentin

Fetch, configure, and run node for Android on the test host, just like Linux tests do.
Make the node/HTTP/2 environment variables available to the tests on the device, and
use adb port forwarding to connect sockets. Finally, enable tests skipped for node.

Differential Revision: https://phabricator.services.mozilla.com/D60204

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Geoff Brown 2020-01-20 18:06:37 +00:00
Родитель 2dea3bc808
Коммит 95d2b89c71
6 изменённых файлов: 29 добавлений и 28 удалений

Просмотреть файл

@ -242,10 +242,6 @@ skip-if = true # Bug 863738
# IDNA2008 depends on ICU, not available on android
skip-if = os == "android"
[test_immutable.js]
# This used to be hasNode, but that caused too many issues with tests being
# silently disabled, so now we explicitly call out the platforms not known
# to have node installed.
skip-if = os == "android"
run-sequentially = node server exceptions dont replay well
[test_localstreams.js]
[test_large_port.js]
@ -264,11 +260,7 @@ skip-if = os == "win"
[test_nojsredir.js]
[test_offline_status.js]
[test_origin.js]
# node server not runinng on android
skip-if = os == "android"
[test_anonymous-coalescing.js]
# node server not runinng on android
skip-if = os == "android"
[test_original_sent_received_head.js]
[test_parse_content_type.js]
[test_permmgr.js]
@ -313,16 +305,8 @@ skip-if = os == 'mac' && (verify || debug || os_version == '10.14') #Bug 1140656
fail-if = os == "android"
# http2 unit tests require us to have node available to run the spdy and http2 server
[test_http2.js]
# This used to be hasNode, but that caused too many issues with tests being
# silently disabled, so now we explicitly call out the platforms not known
# to have node installed.
skip-if = (os == "android") || verify
run-sequentially = node server exceptions dont replay well
[test_altsvc.js]
# This used to be hasNode, but that caused too many issues with tests being
# silently disabled, so now we explicitly call out the platforms not known
# to have node installed.
skip-if = os == "android"
run-sequentially = node server exceptions dont replay well
[test_speculative_connect.js]
[test_standardurl.js]
@ -414,8 +398,6 @@ skip-if = (verify && (os == 'linux')) || (os == "android" && processor == "x86_6
[test_uri_mutator.js]
[test_bug1411316_http1.js]
[test_header_Server_Timing.js]
# Test requires http/2, and http/2 server doesn't run on android.
skip-if = os == "android"
run-sequentially = node server exceptions dont replay well
[test_trr.js]
# http2-using tests require node available
@ -428,8 +410,6 @@ skip-if = os == "android" || appname == "thunderbird"
skip-if = os == "android" || (os == "mac" && debug) # CP service is disabled on Android, macosx1014/debug due to 1564534
run-sequentially = node server exceptions dont replay well
[test_esni_dns_fetch.js]
# http2-using tests require node available
skip-if = os == "android"
[test_network_connectivity_service.js]
[test_suspend_channel_on_authRetry.js]
[test_suspend_channel_on_examine_merged_response.js]
@ -445,7 +425,6 @@ skip-if = os == "android"
[test_disabled_ftp.js]
[test_cache_204_response.js]
[test_node_execute.js]
skip-if = os == "android" # node server doesn't run on android
[test_loadgroup_cancel.js]
[test_obs-fold.js]
[test_defaultURI.js]

Просмотреть файл

@ -84,4 +84,5 @@ xpcshell:
- win64-node
win.*32.*:
- win32-node
android-em-7.*: []
android-em-7.*:
- linux64-node

Просмотреть файл

@ -537,9 +537,7 @@ def set_defaults(config, tests):
# loopback-video is always true for Android, but false for other
# platform phyla
test['loopback-video'] = True
else:
# all non-android tests want to run the bits that require node
test['mozharness']['set-moz-node-path'] = True
test['mozharness']['set-moz-node-path'] = True
# software-gl-layers is only meaningful on linux unittests, where it defaults to True
if test['test-platform'].startswith('linux') and test['suite'] not in ['talos', 'raptor']:

Просмотреть файл

@ -6,6 +6,11 @@
import os
NODEJS_PATH = None
if 'MOZ_FETCHES_DIR' in os.environ:
NODEJS_PATH = os.path.join(os.environ["MOZ_FETCHES_DIR"], "node/bin/node")
def WebglSuite(name):
return {
"run_filename": "runtestsremote.py",
@ -53,6 +58,7 @@ config = {
# to the start of the run-tests step) specify screenshot_times. For example, to
# take 4 screenshots at one minute intervals you could specify:
# "screenshot_times": [60, 120, 180, 240],
"nodejs_path": NODEJS_PATH,
"suite_definitions": {
"mochitest-plain": {

Просмотреть файл

@ -411,6 +411,8 @@ class AndroidEmulatorTest(TestingMixin, BaseScript, MozbaseMixin, CodeCoverageMi
env['MOZ_UPLOAD_DIR'] = self.query_abs_dirs()['abs_blob_upload_dir']
env['MINIDUMP_SAVE_PATH'] = self.query_abs_dirs()['abs_blob_upload_dir']
env['RUST_BACKTRACE'] = 'full'
if self.config['nodejs_path']:
env['MOZ_NODE_PATH'] = self.config['nodejs_path']
summary = {}
for per_test_args in self.query_args(per_test_suite):

Просмотреть файл

@ -374,9 +374,6 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
raise Exception("failed to get ro.product.cpu.abi from device")
self.env["MOZ_ANDROID_CPU_ABI"] = abi
if self.options['setup']:
self.pushWrapper()
def setAppRoot(self):
# Determine the application root directory associated with the package
# name used by the APK.
@ -488,6 +485,17 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
self.device.push(self.xpcDir, self.remoteScriptsDir, timeout=600)
self.device.chmod(self.remoteScriptsDir, recursive=True, root=True)
def setupSocketConnections(self):
# make node host ports visible to device
if "MOZHTTP2_PORT" in self.env:
port = "tcp:{}".format(self.env["MOZHTTP2_PORT"])
self.device.create_socket_connection(ADBDevice.SOCKET_DIRECTON_REVERSE, port, port)
self.log.info("reversed MOZHTTP2_PORT connection for port " + port)
if "MOZNODE_EXEC_PORT" in self.env:
port = "tcp:{}".format(self.env["MOZNODE_EXEC_PORT"])
self.device.create_socket_connection(ADBDevice.SOCKET_DIRECTON_REVERSE, port, port)
self.log.info("reversed MOZNODE_EXEC_PORT connection for port " + port)
def buildTestList(self, test_tags=None, test_paths=None, verify=False):
xpcshell.XPCShellTests.buildTestList(
self, test_tags=test_tags, test_paths=test_paths, verify=verify)
@ -498,6 +506,13 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
abbrevTestDir = os.path.relpath(testdir, self.xpcDir)
remoteScriptDir = posixpath.join(self.remoteScriptsDir, abbrevTestDir)
self.pathMapping.append(PathMapping(testdir, remoteScriptDir))
# This is not related to building the test list, but since this is called late
# in the test suite run, this is a convenient place to finalize preparations;
# in particular, these operations cannot be executed much earlier because
# self.env may not be finalized.
self.setupSocketConnections()
if self.options['setup']:
self.pushWrapper()
def verifyRemoteOptions(parser, options):