mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-02 03:49:37 +00:00
Backed out 10 changesets (bug 1696531) for causing mochitest failures in TypeError: cannot use a string pattern on a bytes-like object. CLOSED TREE
Backed out changeset abc85e3c21b0 (bug 1696531) Backed out changeset 82445e26060e (bug 1696531) Backed out changeset 97771570e425 (bug 1696531) Backed out changeset c3f229148f6c (bug 1696531) Backed out changeset 9557ff3065bc (bug 1696531) Backed out changeset 98d17a5f6886 (bug 1696531) Backed out changeset b0eee4af2caf (bug 1696531) Backed out changeset 544be24f74be (bug 1696531) Backed out changeset ddcc795bf838 (bug 1696531) Backed out changeset e5e76f56ceb9 (bug 1696531)
This commit is contained in:
parent
e90ae55216
commit
6ceb5f92a7
@ -10,14 +10,14 @@ A fake ADB binary
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import socketserver
|
||||
import SocketServer
|
||||
import sys
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
PORT = 5037
|
||||
|
||||
|
||||
class ADBRequestHandler(socketserver.BaseRequestHandler):
|
||||
class ADBRequestHandler(SocketServer.BaseRequestHandler):
|
||||
def sendData(self, data):
|
||||
header = "OKAY%04x" % len(data)
|
||||
all_data = header + data
|
||||
@ -28,12 +28,12 @@ class ADBRequestHandler(socketserver.BaseRequestHandler):
|
||||
# client is on heavy load (e.g. MOZ_CHAOSMODE) we can't send the whole
|
||||
# data at once.
|
||||
while sent_length < total_length:
|
||||
sent = self.request.send(all_data[sent_length:].encode("utf-8", "replace"))
|
||||
sent = self.request.send(all_data[sent_length:])
|
||||
sent_length = sent_length + sent
|
||||
|
||||
def handle(self):
|
||||
while True:
|
||||
data = self.request.recv(4096).decode("utf-8", "replace")
|
||||
data = self.request.recv(4096)
|
||||
if "host:kill" in data:
|
||||
self.sendData("")
|
||||
# Implicitly close all open sockets by exiting the program.
|
||||
@ -50,11 +50,11 @@ class ADBRequestHandler(socketserver.BaseRequestHandler):
|
||||
break
|
||||
|
||||
|
||||
class ADBServer(socketserver.TCPServer):
|
||||
class ADBServer(SocketServer.TCPServer):
|
||||
def __init__(self, server_address):
|
||||
# Create a socketserver with bind_and_activate 'False' to set
|
||||
# Create a SocketServer with bind_and_activate 'False' to set
|
||||
# allow_reuse_address before binding.
|
||||
socketserver.TCPServer.__init__(
|
||||
SocketServer.TCPServer.__init__(
|
||||
self, server_address, ADBRequestHandler, bind_and_activate=False
|
||||
)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python3
|
||||
#! /usr/bin/env python
|
||||
#
|
||||
# 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
|
||||
@ -11,7 +11,6 @@ from __future__ import absolute_import, print_function, division
|
||||
import argparse
|
||||
import collections
|
||||
import gzip
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
@ -20,7 +19,6 @@ import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
from bisect import bisect_right
|
||||
from functools import cmp_to_key
|
||||
|
||||
# The DMD output version this script handles.
|
||||
outputVersion = 5
|
||||
@ -52,10 +50,6 @@ allocatorFns = [
|
||||
]
|
||||
|
||||
|
||||
def cmp(a, b):
|
||||
return (a > b) - (a < b)
|
||||
|
||||
|
||||
class Record(object):
|
||||
"""A record is an aggregation of heap blocks that have identical stack
|
||||
traces. It can also be used to represent the difference between two
|
||||
@ -286,7 +280,7 @@ def fixStackTraces(inputFilename, isZipped, opener):
|
||||
# get that now in order to move |tmpFile| at the end.
|
||||
tmpFilename = tmpFile.name
|
||||
if isZipped:
|
||||
tmpFile = gzip.GzipFile(filename="", fileobj=tmpFile, mode="wb")
|
||||
tmpFile = gzip.GzipFile(filename="", fileobj=tmpFile)
|
||||
|
||||
with opener(inputFilename, "rb") as inputFile:
|
||||
for line in inputFile:
|
||||
@ -361,7 +355,7 @@ def getDigestFromFile(args, inputFile):
|
||||
# Trim the number of frames.
|
||||
for traceKey, frameKeys in traceTable.items():
|
||||
if len(frameKeys) > args.max_frames:
|
||||
del frameKeys[args.max_frames :]
|
||||
traceTable[traceKey] = frameKeys[: args.max_frames]
|
||||
|
||||
def buildTraceDescription(traceTable, frameTable, traceKey):
|
||||
frameKeys = traceTable[traceKey]
|
||||
@ -450,7 +444,7 @@ def getDigestFromFile(args, inputFile):
|
||||
return recordKeyPartCache[traceKey]
|
||||
|
||||
recordKeyPart = str(
|
||||
list(map(lambda frameKey: frameTable[frameKey], traceTable[traceKey]))
|
||||
map(lambda frameKey: frameTable[frameKey], traceTable[traceKey])
|
||||
)
|
||||
recordKeyPartCache[traceKey] = recordKeyPart
|
||||
return recordKeyPart
|
||||
@ -506,7 +500,7 @@ def getDigestFromFile(args, inputFile):
|
||||
def f(k):
|
||||
return buildTraceDescription(traceTable, frameTable, k)
|
||||
|
||||
record.reportedAtDescs = list(map(f, reportedAtTraceKeys))
|
||||
record.reportedAtDescs = map(f, reportedAtTraceKeys)
|
||||
record.usableSizes[usableSize] += num
|
||||
|
||||
# All the processed data for a single DMD file is called a "digest".
|
||||
@ -612,9 +606,7 @@ def printDigest(args, digest):
|
||||
out(separator)
|
||||
numRecords = len(records)
|
||||
cmpRecords = sortByChoices[args.sort_by]
|
||||
sortedRecords = sorted(
|
||||
records.values(), key=cmp_to_key(cmpRecords), reverse=True
|
||||
)
|
||||
sortedRecords = sorted(records.values(), cmp=cmpRecords, reverse=True)
|
||||
kindBlocks = 0
|
||||
kindUsableSize = 0
|
||||
maxRecord = 1000
|
||||
@ -821,7 +813,7 @@ def prettyPrintDmdJson(out, j):
|
||||
|
||||
out.write(' "traceTable": {')
|
||||
first = True
|
||||
for k, l in j["traceTable"].items():
|
||||
for k, l in j["traceTable"].iteritems():
|
||||
out.write("" if first else ",")
|
||||
out.write('\n "{0}": {1}'.format(k, json.dumps(l)))
|
||||
first = False
|
||||
@ -829,7 +821,7 @@ def prettyPrintDmdJson(out, j):
|
||||
|
||||
out.write(' "frameTable": {')
|
||||
first = True
|
||||
for k, v in j["frameTable"].items():
|
||||
for k, v in j["frameTable"].iteritems():
|
||||
out.write("" if first else ",")
|
||||
out.write('\n "{0}": {1}'.format(k, json.dumps(v)))
|
||||
first = False
|
||||
@ -991,8 +983,8 @@ def clampBlockList(args, inputFileName, isZipped, opener):
|
||||
tmpFile = tempfile.NamedTemporaryFile(delete=False)
|
||||
tmpFilename = tmpFile.name
|
||||
if isZipped:
|
||||
tmpFile = gzip.GzipFile(filename="", fileobj=tmpFile, mode="wb")
|
||||
prettyPrintDmdJson(io.TextIOWrapper(tmpFile, encoding="utf-8"), j)
|
||||
tmpFile = gzip.GzipFile(filename="", fileobj=tmpFile)
|
||||
prettyPrintDmdJson(tmpFile, j)
|
||||
tmpFile.close()
|
||||
shutil.move(tmpFilename, inputFileName)
|
||||
|
||||
|
@ -54,17 +54,7 @@ Live {
|
||||
}
|
||||
|
||||
Live {
|
||||
-2 blocks in heap block record 5 of 6
|
||||
0 bytes (0 requested / 0 slop)
|
||||
Individual block sizes: 8,192 x 2; -4,096 x 4
|
||||
-0.00% of the heap (100.00% cumulative)
|
||||
Allocated at {
|
||||
#01: B (B.cpp:99)
|
||||
}
|
||||
}
|
||||
|
||||
Live {
|
||||
0 blocks in heap block record 6 of 6
|
||||
0 blocks in heap block record 5 of 6
|
||||
0 bytes (0 requested / 0 slop)
|
||||
Individual block sizes: 20,480; -16,384; -8,192; 4,096
|
||||
-0.00% of the heap (100.00% cumulative)
|
||||
@ -73,6 +63,16 @@ Live {
|
||||
}
|
||||
}
|
||||
|
||||
Live {
|
||||
-2 blocks in heap block record 6 of 6
|
||||
0 bytes (0 requested / 0 slop)
|
||||
Individual block sizes: 8,192 x 2; -4,096 x 4
|
||||
-0.00% of the heap (100.00% cumulative)
|
||||
Allocated at {
|
||||
#01: B (B.cpp:99)
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
Summary {
|
||||
|
Binary file not shown.
@ -217,7 +217,7 @@ function test_name_too_long() {
|
||||
// Try creating a socket in a directory that doesn't exist.
|
||||
function test_no_directory() {
|
||||
let socketName = do_get_tempdir();
|
||||
socketName.append("missing");
|
||||
socketName.append("directory-that-does-not-exist");
|
||||
socketName.append("socket");
|
||||
|
||||
do_check_throws_nsIException(
|
||||
|
@ -12,7 +12,6 @@ job-defaults:
|
||||
by-test-platform:
|
||||
android-em-7.*: geckoview-androidTest.apk
|
||||
default: null
|
||||
python-3: true
|
||||
mozharness:
|
||||
script:
|
||||
by-test-platform:
|
||||
|
@ -15,7 +15,6 @@ import random
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
@ -320,19 +319,7 @@ class XPCShellTestThread(Thread):
|
||||
popen_func = psutil.Popen
|
||||
else:
|
||||
popen_func = Popen
|
||||
|
||||
cleanup_hack = None
|
||||
if mozinfo.isWin and sys.version_info < (3, 7, 5):
|
||||
# Hack to work around https://bugs.python.org/issue37380
|
||||
cleanup_hack = subprocess._cleanup
|
||||
|
||||
try:
|
||||
if cleanup_hack:
|
||||
subprocess._cleanup = lambda: None
|
||||
proc = popen_func(cmd, stdout=stdout, stderr=stderr, env=env, cwd=cwd)
|
||||
finally:
|
||||
if cleanup_hack:
|
||||
subprocess._cleanup = cleanup_hack
|
||||
proc = popen_func(cmd, stdout=stdout, stderr=stderr, env=env, cwd=cwd)
|
||||
return proc
|
||||
|
||||
def checkForCrashes(self, dump_directory, symbols_path, test_name=None):
|
||||
@ -664,10 +651,7 @@ class XPCShellTestThread(Thread):
|
||||
def fix_text_output(self, line):
|
||||
line = cleanup_encoding(line)
|
||||
if self.stack_fixer_function is not None:
|
||||
line = self.stack_fixer_function(line)
|
||||
|
||||
if isinstance(line, bytes):
|
||||
line = line.decode("utf-8")
|
||||
return self.stack_fixer_function(line)
|
||||
return line
|
||||
|
||||
def log_line(self, line):
|
||||
|
@ -4,7 +4,7 @@
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
#
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import mozinfo
|
||||
import os
|
||||
@ -138,7 +138,7 @@ add_test(function test_loop () {
|
||||
});
|
||||
"""
|
||||
|
||||
PASSING_TEST_UNICODE = b"""
|
||||
PASSING_TEST_UNICODE = """
|
||||
function run_test () { run_next_test(); }
|
||||
|
||||
add_test(function test_unicode_print () {
|
||||
@ -483,7 +483,7 @@ class XPCShellTestsTests(unittest.TestCase):
|
||||
os.environ.pop("MOZ_OBJDIR", None)
|
||||
self.build_obj = MozbuildObject.from_environment()
|
||||
|
||||
objdir = self.build_obj.topobjdir
|
||||
objdir = self.build_obj.topobjdir.encode("utf-8")
|
||||
self.testing_modules = os.path.join(objdir, "_tests", "modules")
|
||||
|
||||
if mozinfo.isMac:
|
||||
@ -518,13 +518,13 @@ class XPCShellTestsTests(unittest.TestCase):
|
||||
shutil.rmtree(self.tempdir)
|
||||
self.x.shutdownNode()
|
||||
|
||||
def writeFile(self, name, contents, mode="w"):
|
||||
def writeFile(self, name, contents):
|
||||
"""
|
||||
Write |contents| to a file named |name| in the temp directory,
|
||||
and return the full path to the file.
|
||||
"""
|
||||
fullpath = os.path.join(self.tempdir, name)
|
||||
with open(fullpath, mode) as f:
|
||||
with open(fullpath, "w") as f:
|
||||
f.write(contents)
|
||||
return fullpath
|
||||
|
||||
@ -895,7 +895,7 @@ add_test({
|
||||
"""
|
||||
Check that passing unicode characters through an assertion method works.
|
||||
"""
|
||||
self.writeFile("test_unicode_assert.js", PASSING_TEST_UNICODE, mode="wb")
|
||||
self.writeFile("test_unicode_assert.js", PASSING_TEST_UNICODE)
|
||||
self.writeManifest(["test_unicode_assert.js"])
|
||||
|
||||
self.assertTestResult(True, verbose=True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python2
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import signal
|
||||
@ -6,18 +7,15 @@ import struct
|
||||
import sys
|
||||
|
||||
|
||||
def output(line, stream=sys.stdout, print_only=False):
|
||||
if isinstance(line, str):
|
||||
line = line.encode("utf-8", "surrogateescape")
|
||||
if not print_only:
|
||||
stream.buffer.write(struct.pack("@I", len(line)))
|
||||
stream.buffer.write(line)
|
||||
stream.flush()
|
||||
def output(line):
|
||||
sys.stdout.write(struct.pack("@I", len(line)))
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def echo_loop():
|
||||
while True:
|
||||
line = sys.stdin.buffer.readline()
|
||||
line = sys.stdin.readline()
|
||||
if not line:
|
||||
break
|
||||
|
||||
@ -55,5 +53,5 @@ elif cmd == "ignore_sigterm":
|
||||
|
||||
time.sleep(3600)
|
||||
elif cmd == "print":
|
||||
output(sys.argv[2], stream=sys.stdout, print_only=True)
|
||||
output(sys.argv[3], stream=sys.stderr, print_only=True)
|
||||
sys.stdout.write(sys.argv[2])
|
||||
sys.stderr.write(sys.argv[3])
|
||||
|
@ -693,7 +693,6 @@ add_task(async function test_subprocess_environment() {
|
||||
Object.assign(environment, {
|
||||
PATH: env.get("PATH"),
|
||||
PATHEXT: env.get("PATHEXT"),
|
||||
SYSTEMROOT: env.get("SYSTEMROOT"),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,5 @@ support-files =
|
||||
data_test_script.py
|
||||
|
||||
[test_subprocess.js]
|
||||
skip-if = verify
|
||||
[test_subprocess_getEnvironment.js]
|
||||
[test_subprocess_pathSearch.js]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/python
|
||||
# vim:sw=4:ts=4:et:
|
||||
# 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
|
||||
@ -15,6 +15,8 @@ import platform
|
||||
import re
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
# Matches lines produced by MozFormatCodeAddress(), e.g.
|
||||
# `#01: ???[tests/example +0x43a0]`.
|
||||
line_re = re.compile("#\d+: .+\[.+ \+0x[0-9A-Fa-f]+\]")
|
||||
@ -74,8 +76,9 @@ def fixSymbols(
|
||||
line, jsonMode=False, slowWarning=False, breakpadSymsDir=None, hide_errors=False
|
||||
):
|
||||
|
||||
line_str = line.decode("utf-8") if isinstance(line, bytes) else line
|
||||
if line_re.search(line_str) is None:
|
||||
line = six.ensure_str(line)
|
||||
result = line_re.search(line)
|
||||
if result is None:
|
||||
return line
|
||||
|
||||
if not fix_stacks:
|
||||
@ -85,17 +88,14 @@ def fixSymbols(
|
||||
# to `fix-stacks` it will wait until it receives a newline, causing this
|
||||
# script to hang. So we add a newline if one is missing and then remove it
|
||||
# from the output.
|
||||
is_missing_newline = not line_str.endswith("\n")
|
||||
is_missing_newline = not line.endswith("\n")
|
||||
if is_missing_newline:
|
||||
line_str = line_str + "\n"
|
||||
fix_stacks.stdin.write(line_str)
|
||||
line = line + "\n"
|
||||
fix_stacks.stdin.write(line)
|
||||
fix_stacks.stdin.flush()
|
||||
out = fix_stacks.stdout.readline()
|
||||
if is_missing_newline:
|
||||
out = out[:-1]
|
||||
|
||||
if not isinstance(out, bytes):
|
||||
out = out.encode("utf-8")
|
||||
return out
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user