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

Make `mach test-tidy --no-wpt` compatible with Python3 #25239

Merged
merged 3 commits into from Dec 11, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -3943,8 +3943,8 @@ def jitInfoInitializer(isTypedMethod):
depth=self.descriptor.interface.inheritanceDepth(),
opType=opType,
aliasSet=aliasSet,
returnType=reduce(CGMemberJITInfo.getSingleReturnType, returnTypes,
""),
returnType=functools.reduce(CGMemberJITInfo.getSingleReturnType, returnTypes,
""),
isInfallible=toStringBool(infallible),
isMovable=toStringBool(movable),
# FIXME(nox): https://github.com/servo/servo/issues/10991
@@ -4131,8 +4131,8 @@ def getJSReturnTypeTag(t):
if u.hasNullableType:
# Might be null or not
return "JSVAL_TYPE_UNKNOWN"
return reduce(CGMemberJITInfo.getSingleReturnType,
u.flatMemberTypes, "")
return functools.reduce(CGMemberJITInfo.getSingleReturnType,
u.flatMemberTypes, "")
if t.isDictionary():
return "JSVAL_TYPE_OBJECT"
if t.isDate():
@@ -4202,8 +4202,8 @@ def getJSArgType(t):
if t.isUnion():
u = t.unroll()
type = "JSJitInfo::Null as i32" if u.hasNullableType else ""
return reduce(CGMemberJITInfo.getSingleArgType,
u.flatMemberTypes, type)
return functools.reduce(CGMemberJITInfo.getSingleArgType,
u.flatMemberTypes, type)
if t.isDictionary():
return "JSJitInfo_ArgType::Object as i32"
if t.isDate():
@@ -5858,7 +5858,7 @@ def fmt(arguments):
def contains_unsafe_arg(arguments):
if not arguments or len(arguments) == 0:
return False
return reduce((lambda x, y: x or y[1] == '*mut JSContext'), arguments, False)
return functools.reduce((lambda x, y: x or y[1] == '*mut JSContext'), arguments, False)

methods = []
for name, arguments, rettype in members():
@@ -2,6 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

import functools
import os

from WebIDL import IDLExternalInterface, IDLSequenceType, IDLWrapperType, WebIDLError
@@ -15,7 +16,7 @@ class Configuration:
def __init__(self, filename, parseData):
# Read the configuration file.
glbl = {}
execfile(filename, glbl)
exec(compile(open(filename).read(), filename, 'exec'), glbl)
config = glbl['DOMInterfaces']

# Build descriptors for all the interfaces we have in the parse data.
@@ -62,7 +63,8 @@ def __init__(self, filename, parseData):
c.isCallback() and not c.isInterface()]

# Keep the descriptor list sorted for determinism.
self.descriptors.sort(lambda x, y: cmp(x.name, y.name))
cmp = lambda x, y: (x > y) - (x < y)
self.descriptors.sort(key=functools.cmp_to_key(lambda x, y: cmp(x.name, y.name)))

def getInterface(self, ifname):
return self.interfaces[ifname]
@@ -54,9 +54,9 @@ def print_line(value1, value2, key):
value1 = data1.get(key)
value2 = data2.get(key)
if value1 and not(value2):
print ("{}Test {}: missing from {}.{}".format(WARNING, key, args.file2, END))
print("{}Test {}: missing from {}.{}".format(WARNING, key, args.file2, END))
elif value2 and not(value1):
print ("{}Test {}: missing from {}.{}".format(WARNING, key, args.file1, END))
print("{}Test {}: missing from {}.{}".format(WARNING, key, args.file1, END))
elif value1 and value2:
total1 += value1
total2 += value2
@@ -69,7 +69,7 @@ def transform_report_for_test(report):
while remaining:
(name, value) = remaining.pop()
transformed[name] = '%s %s' % (value['amount'], value['unit'])
remaining += map(lambda (k, v): (name + '/' + k, v), list(value['children'].items()))
remaining += map(lambda k_v: (name + '/' + k_v[0], k_v[1]), list(value['children'].items()))
return transformed


@@ -205,6 +205,7 @@ def linux_tidy_unit():
.with_treeherder("Linux x64", "Tidy+Unit")
.with_script("""
./mach test-tidy --no-progress --all
python3 ./mach test-tidy --no-progress --all --no-wpt
python3 ./mach build --dev
python3 ./mach test-unit
python3 ./mach package --dev
@@ -635,7 +635,7 @@ def build(self, release=False, dev=False, jobs=None, params=None, media_stack=No
opts = ["-Ztimings=info"] + opts

if very_verbose:
print (["Calling", "cargo", "build"] + opts)
print(["Calling", "cargo", "build"] + opts)
for key in env:
print((key, env[key]))

@@ -627,7 +627,7 @@ def vs_dirs(self):
def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit=False, uwp=False, features=None):
"""Return an extended environment dictionary."""
env = os.environ.copy()
if sys.platform == "win32" and type(env['PATH']) == unicode:
if sys.platform == "win32" and type(env['PATH']) == six.text_type:
# On win32, the virtualenv's activate_this.py script sometimes ends up
# turning os.environ['PATH'] into a unicode string. This doesn't work
# for passing env vars in to a process, so we force it back to ascii.
@@ -700,20 +700,20 @@ def compare_dromaeo(self, params):
width_col4 = max([len(str(x)) for x in result['Difference(%)']])

for p, q, r, s in zip(['Test'], ['First Run'], ['Second Run'], ['Difference(%)']):
print ("\033[1m" + "{}|{}|{}|{}".format(p.ljust(width_col1), q.ljust(width_col2), r.ljust(width_col3),
s.ljust(width_col4)) + "\033[0m" + "\n" + "--------------------------------------------------"
+ "-------------------------------------------------------------------------")
print("\033[1m" + "{}|{}|{}|{}".format(p.ljust(width_col1), q.ljust(width_col2), r.ljust(width_col3),
s.ljust(width_col4)) + "\033[0m" + "\n" + "--------------------------------------------------"
+ "-------------------------------------------------------------------------")

for a1, b1, c1, d1 in zip(result['Test'], result['Prev_Time'], result['Cur_Time'], result['Difference(%)']):
if d1 > 0:
print ("\033[91m" + "{}|{}|{}|{}".format(a1.ljust(width_col1),
str(b1).ljust(width_col2), str(c1).ljust(width_col3), str(d1).ljust(width_col4)) + "\033[0m")
print("\033[91m" + "{}|{}|{}|{}".format(a1.ljust(width_col1),
str(b1).ljust(width_col2), str(c1).ljust(width_col3), str(d1).ljust(width_col4)) + "\033[0m")
elif d1 < 0:
print ("\033[92m" + "{}|{}|{}|{}".format(a1.ljust(width_col1),
str(b1).ljust(width_col2), str(c1).ljust(width_col3), str(d1).ljust(width_col4)) + "\033[0m")
print("\033[92m" + "{}|{}|{}|{}".format(a1.ljust(width_col1),
str(b1).ljust(width_col2), str(c1).ljust(width_col3), str(d1).ljust(width_col4)) + "\033[0m")
else:
print ("{}|{}|{}|{}".format(a1.ljust(width_col1), str(b1).ljust(width_col2),
str(c1).ljust(width_col3), str(d1).ljust(width_col4)))
print("{}|{}|{}|{}".format(a1.ljust(width_col1), str(b1).ljust(width_col2),
str(c1).ljust(width_col3), str(d1).ljust(width_col4)))

def jquery_test_runner(self, cmd, release, dev):
self.ensure_bootstrapped()
@@ -776,7 +776,7 @@ def set_software_rendering_env(self, use_release):
def setup_clangfmt(env):
cmd = "clang-format.exe" if sys.platform == "win32" else "clang-format"
try:
version = check_output([cmd, "--version"], env=env).rstrip()
version = check_output([cmd, "--version"], env=env, universal_newlines=True).rstrip()
print(version)
if not version.startswith("clang-format version {}.".format(CLANGFMT_VERSION)):
print("clang-format: wrong version (v{} required). Skipping CPP formatting.".format(CLANGFMT_VERSION))
@@ -785,7 +785,7 @@ def setup_clangfmt(env):
print("clang-format not installed. Skipping CPP formatting.")
return False, None, None
gitcmd = ['git', 'ls-files']
gitfiles = check_output(gitcmd + CLANGFMT_CPP_DIRS).splitlines()
gitfiles = check_output(gitcmd + CLANGFMT_CPP_DIRS, universal_newlines=True).splitlines()
filtered = [line for line in gitfiles if line.endswith(".h") or line.endswith(".cpp")]
return True, cmd, filtered

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