зеркало из https://github.com/mozilla/gecko-dev.git
Back out 57ee0ba35de6 (bug 858622) for Windows jit-test failures
CLOSED TREE
This commit is contained in:
Родитель
ea17e1018d
Коммит
de7568deba
|
@ -3,7 +3,7 @@
|
|||
# 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/.
|
||||
|
||||
import os, posixpath, shlex, subprocess, sys, traceback
|
||||
import os, shlex, subprocess, sys, traceback
|
||||
|
||||
def add_libdir_to_path():
|
||||
from os.path import dirname, exists, join, realpath
|
||||
|
@ -74,23 +74,6 @@ def main(argv):
|
|||
help='Run tests with all IonMonkey option combinations (ignores --jitflags)')
|
||||
op.add_option('-j', '--worker-count', dest='max_jobs', type=int, default=max_jobs_default,
|
||||
help='Number of tests to run in parallel (default %default)')
|
||||
op.add_option('--remote', action='store_true',
|
||||
help='Run tests on a remote device')
|
||||
op.add_option('--deviceIP', action='store',
|
||||
type='string', dest='device_ip',
|
||||
help='IP address of remote device to test')
|
||||
op.add_option('--devicePort', action='store',
|
||||
type=int, dest='device_port', default=20701,
|
||||
help='port of remote device to test')
|
||||
op.add_option('--deviceTransport', action='store',
|
||||
type='string', dest='device_transport', default='sut',
|
||||
help='The transport to use to communicate with device: [adb|sut]; default=sut')
|
||||
op.add_option('--remoteTestRoot', dest='remote_test_root', action='store',
|
||||
type='string', default='/data/local/tests',
|
||||
help='The remote directory to use as test root (eg. /data/local/tests)')
|
||||
op.add_option('--localLib', dest='local_lib', action='store',
|
||||
type='string',
|
||||
help='The location of libraries to push -- preferably stripped')
|
||||
|
||||
options, args = op.parse_args(argv)
|
||||
if len(args) < 1:
|
||||
|
@ -188,11 +171,7 @@ def main(argv):
|
|||
job_list.append(new_test)
|
||||
|
||||
prefix = [os.path.abspath(args[0])] + shlex.split(options.shell_args)
|
||||
prolog = os.path.join(jittests.LIB_DIR, 'prolog.js')
|
||||
if options.remote:
|
||||
prolog = posixpath.join(options.remote_test_root, 'jit-tests/lib/prolog.js')
|
||||
|
||||
prefix += ['-f', prolog]
|
||||
prefix += ['-f', os.path.join(jittests.LIB_DIR, 'prolog.js')]
|
||||
if options.debug:
|
||||
if len(job_list) > 1:
|
||||
print 'Multiple tests match command line arguments, debugger can only run one'
|
||||
|
@ -207,9 +186,7 @@ def main(argv):
|
|||
|
||||
try:
|
||||
ok = None
|
||||
if options.remote:
|
||||
ok = jittests.run_tests_remote(job_list, prefix, options)
|
||||
elif options.max_jobs > 1 and jittests.HAVE_MULTIPROCESSING:
|
||||
if options.max_jobs > 1 and jittests.HAVE_MULTIPROCESSING:
|
||||
ok = jittests.run_tests_parallel(job_list, prefix, options)
|
||||
else:
|
||||
ok = jittests.run_tests(job_list, prefix, options)
|
||||
|
|
|
@ -7,12 +7,11 @@
|
|||
# jit_test.py -- Python harness for JavaScript trace tests.
|
||||
|
||||
from __future__ import print_function
|
||||
import os, posixpath, sys, tempfile, traceback, time
|
||||
import os, sys, tempfile, traceback, time
|
||||
import subprocess
|
||||
from subprocess import Popen, PIPE
|
||||
from threading import Thread
|
||||
import signal
|
||||
import StringIO
|
||||
|
||||
try:
|
||||
from multiprocessing import Process, Manager, cpu_count
|
||||
|
@ -153,19 +152,15 @@ class Test:
|
|||
|
||||
return test
|
||||
|
||||
def command(self, prefix, libdir, remote_prefix=None):
|
||||
path = self.path
|
||||
if remote_prefix:
|
||||
path = self.path.replace(TEST_DIR, remote_prefix)
|
||||
|
||||
scriptdir_var = os.path.dirname(path);
|
||||
def command(self, prefix):
|
||||
scriptdir_var = os.path.dirname(self.path);
|
||||
if not scriptdir_var.endswith('/'):
|
||||
scriptdir_var += '/'
|
||||
expr = ('const platform="%s"; const libdir="%s"; const scriptdir="%s"'
|
||||
% (sys.platform, libdir, scriptdir_var))
|
||||
expr = ("const platform=%r; const libdir=%r; const scriptdir=%r"
|
||||
% (sys.platform, LIB_DIR, scriptdir_var))
|
||||
# We may have specified '-a' or '-d' twice: once via --jitflags, once
|
||||
# via the "|jit-test|" line. Remove dups because they are toggles.
|
||||
cmd = prefix + list(set(self.jitflags)) + ['-e', expr, '-f', path]
|
||||
cmd = prefix + list(set(self.jitflags)) + ['-e', expr, '-f', self.path]
|
||||
if self.valgrind:
|
||||
cmd = self.VALGRIND_CMD + cmd
|
||||
return cmd
|
||||
|
@ -273,7 +268,7 @@ def run_cmd_avoid_stdio(cmdline, env, timeout):
|
|||
return read_and_unlink(stdoutPath), read_and_unlink(stderrPath), code
|
||||
|
||||
def run_test(test, prefix, options):
|
||||
cmd = test.command(prefix, LIB_DIR)
|
||||
cmd = test.command(prefix)
|
||||
if options.show_cmd:
|
||||
print(subprocess.list2cmdline(cmd))
|
||||
|
||||
|
@ -289,26 +284,6 @@ def run_test(test, prefix, options):
|
|||
out, err, code, timed_out = run(cmd, env, options.timeout)
|
||||
return TestOutput(test, cmd, out, err, code, None, timed_out)
|
||||
|
||||
def run_test_remote(test, device, prefix, options):
|
||||
cmd = test.command(prefix, posixpath.join(options.remote_test_root, 'lib/'), posixpath.join(options.remote_test_root, 'tests'))
|
||||
if options.show_cmd:
|
||||
print(subprocess.list2cmdline(cmd))
|
||||
|
||||
env = {}
|
||||
if test.tz_pacific:
|
||||
env['TZ'] = 'PST8PDT'
|
||||
|
||||
env['LD_LIBRARY_PATH'] = options.remote_test_root
|
||||
|
||||
buf = StringIO.StringIO()
|
||||
returncode = device.shell(cmd, buf, env=env, cwd=options.remote_test_root,
|
||||
timeout=int(options.timeout))
|
||||
|
||||
out = buf.getvalue()
|
||||
# We can't distinguish between stdout and stderr so we pass
|
||||
# the same buffer to both.
|
||||
return TestOutput(test, cmd, out, out, returncode, None, False)
|
||||
|
||||
def check_output(out, err, rc, test):
|
||||
if test.expect_error:
|
||||
# The shell exits with code 3 on uncaught exceptions.
|
||||
|
@ -566,58 +541,6 @@ def run_tests(tests, prefix, options):
|
|||
ok = process_test_results(gen, len(tests), options)
|
||||
return ok
|
||||
|
||||
def get_remote_results(tests, device, prefix, options):
|
||||
for test in tests:
|
||||
yield run_test_remote(test, device, prefix, options)
|
||||
|
||||
def push_libs(options, device):
|
||||
# This saves considerable time in pushing unnecessary libraries
|
||||
# to the device but needs to be updated if the dependencies change.
|
||||
required_libs = ['libnss3.so', 'libmozglue.so']
|
||||
|
||||
for file in os.listdir(options.local_lib):
|
||||
if file in required_libs:
|
||||
remote_file = posixpath.join(options.remote_test_root, file)
|
||||
device.pushFile(os.path.join(options.local_lib, file), remote_file)
|
||||
|
||||
def push_progs(options, device, progs):
|
||||
for local_file in progs:
|
||||
remote_file = posixpath.join(options.remote_test_root, os.path.basename(local_file))
|
||||
device.pushFile(local_file, remote_file)
|
||||
|
||||
def run_tests_remote(tests, prefix, options):
|
||||
# Setup device with everything needed to run our tests.
|
||||
from mozdevice import devicemanager, devicemanagerADB, devicemanagerSUT
|
||||
|
||||
if options.device_transport == 'adb':
|
||||
if options.device_ip:
|
||||
dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.devicePort, packageName=None, deviceRoot=options.remoteTestRoot)
|
||||
else:
|
||||
dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root)
|
||||
else:
|
||||
dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root)
|
||||
if options.device_ip == None:
|
||||
print('Error: you must provide a device IP to connect to via the --device option')
|
||||
sys.exit(1)
|
||||
|
||||
# Update the test root to point to our test directory.
|
||||
options.remote_test_root = posixpath.join(options.remote_test_root, 'jit-tests')
|
||||
|
||||
# Push js shell and libraries.
|
||||
if dm.dirExists(options.remote_test_root):
|
||||
dm.removeDir(options.remote_test_root)
|
||||
dm.mkDir(options.remote_test_root)
|
||||
push_libs(options, dm)
|
||||
push_progs(options, dm, [prefix[0]])
|
||||
dm.chmodDir(options.remote_test_root)
|
||||
dm.pushDir(os.path.dirname(TEST_DIR), options.remote_test_root)
|
||||
prefix[0] = os.path.join(options.remote_test_root, 'js')
|
||||
|
||||
# Run all tests.
|
||||
gen = get_remote_results(tests, dm, prefix, options)
|
||||
ok = process_test_results(gen, len(tests), options)
|
||||
return ok
|
||||
|
||||
def parse_jitflags(options):
|
||||
jitflags = [ [ '-' + flag for flag in flags ]
|
||||
for flags in options.jitflags.split(',') ]
|
||||
|
|
Загрузка…
Ссылка в новой задаче