bug 1463425 - Fix flake8/pep8 issue by hand in build/ r=gps
MozReview-Commit-ID: AZdcEWyVV6e
This commit is contained in:
@@ -107,7 +107,7 @@ def delete(path):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
def generate(output, tpp_txt):
|
def generate(output, tpp_txt):
|
||||||
"""
|
"""
|
||||||
This file generates a ThirdPartyPaths.cpp file from the ThirdPartyPaths.txt
|
This file generates a ThirdPartyPaths.cpp file from the ThirdPartyPaths.txt
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
@@ -129,20 +128,20 @@ static int LLVM_ATTRIBUTE_UNUSED MozillaModuleAnchorDestination =
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
print """\
|
print("""\
|
||||||
Usage: import_mozilla_checks.py <mozilla-clang-plugin-path> <clang-tidy-path>
|
Usage: import_mozilla_checks.py <mozilla-clang-plugin-path> <clang-tidy-path>
|
||||||
Imports the Mozilla static analysis checks into a clang-tidy source tree.
|
Imports the Mozilla static analysis checks into a clang-tidy source tree.
|
||||||
"""
|
""")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
mozilla_path = sys.argv[1]
|
mozilla_path = sys.argv[1]
|
||||||
if not os.path.isdir(mozilla_path):
|
if not os.path.isdir(mozilla_path):
|
||||||
print "Invalid path to mozilla clang plugin"
|
print("Invalid path to mozilla clang plugin")
|
||||||
|
|
||||||
clang_tidy_path = sys.argv[2]
|
clang_tidy_path = sys.argv[2]
|
||||||
if not os.path.isdir(mozilla_path):
|
if not os.path.isdir(mozilla_path):
|
||||||
print "Invalid path to clang-tidy source directory"
|
print("Invalid path to clang-tidy source directory")
|
||||||
|
|
||||||
do_import(mozilla_path, clang_tidy_path)
|
do_import(mozilla_path, clang_tidy_path)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# 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/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
# originally from https://hg.mozilla.org/build/tools/file/4ab9c1a4e05b/scripts/release/compare-mozconfigs.py
|
# originally from https://hg.mozilla.org/build/tools/file/4ab9c1a4e05b/scripts/release/compare-mozconfigs.py # NOQA: E501
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
@@ -28,14 +28,17 @@ PLATFORMS = (
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ConfigError(Exception):
|
class ConfigError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def readConfig(configfile):
|
def readConfig(configfile):
|
||||||
c = {}
|
c = {}
|
||||||
execfile(configfile, c)
|
execfile(configfile, c)
|
||||||
return c['whitelist']
|
return c['whitelist']
|
||||||
|
|
||||||
|
|
||||||
def verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair, platform,
|
def verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair, platform,
|
||||||
mozconfigWhitelist):
|
mozconfigWhitelist):
|
||||||
"""Compares mozconfig to nightly_mozconfig and compare to an optional
|
"""Compares mozconfig to nightly_mozconfig and compare to an optional
|
||||||
@@ -55,7 +58,8 @@ def verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair, platform,
|
|||||||
success = True
|
success = True
|
||||||
|
|
||||||
diff_instance = difflib.Differ()
|
diff_instance = difflib.Differ()
|
||||||
diff_result = diff_instance.compare(mozconfig_lines, nightly_mozconfig_lines)
|
diff_result = diff_instance.compare(
|
||||||
|
mozconfig_lines, nightly_mozconfig_lines)
|
||||||
diff_list = list(diff_result)
|
diff_list = list(diff_result)
|
||||||
|
|
||||||
for line in diff_list:
|
for line in diff_list:
|
||||||
@@ -98,6 +102,7 @@ def verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair, platform,
|
|||||||
success = False
|
success = False
|
||||||
return success
|
return success
|
||||||
|
|
||||||
|
|
||||||
def get_mozconfig(path):
|
def get_mozconfig(path):
|
||||||
"""Consumes a path and returns a list of lines from the mozconfig file."""
|
"""Consumes a path and returns a list of lines from the mozconfig file."""
|
||||||
with open(path, 'rb') as fh:
|
with open(path, 'rb') as fh:
|
||||||
@@ -114,7 +119,6 @@ def compare(topsrcdir):
|
|||||||
def normalize_lines(lines):
|
def normalize_lines(lines):
|
||||||
return {l.strip() for l in lines}
|
return {l.strip() for l in lines}
|
||||||
|
|
||||||
|
|
||||||
for platform in PLATFORMS:
|
for platform in PLATFORMS:
|
||||||
log.info('Comparing platform %s' % platform)
|
log.info('Comparing platform %s' % platform)
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ class RemoteAutomation(Automation):
|
|||||||
Automation.__init__(self)
|
Automation.__init__(self)
|
||||||
|
|
||||||
# Set up what we need for the remote environment
|
# Set up what we need for the remote environment
|
||||||
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False, lsanPath=None, ubsanPath=None):
|
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False,
|
||||||
|
lsanPath=None, ubsanPath=None):
|
||||||
# Because we are running remote, we don't want to mimic the local env
|
# Because we are running remote, we don't want to mimic the local env
|
||||||
# so no copying of os.environ
|
# so no copying of os.environ
|
||||||
if env is None:
|
if env is None:
|
||||||
@@ -66,14 +67,15 @@ class RemoteAutomation(Automation):
|
|||||||
# Set WebRTC logging in case it is not set yet.
|
# Set WebRTC logging in case it is not set yet.
|
||||||
# On Android, environment variables cannot contain ',' so the
|
# On Android, environment variables cannot contain ',' so the
|
||||||
# standard WebRTC setting for NSPR_LOG_MODULES is not available.
|
# standard WebRTC setting for NSPR_LOG_MODULES is not available.
|
||||||
# env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5')
|
# env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5') # NOQA: E501
|
||||||
env.setdefault('R_LOG_LEVEL', '6')
|
env.setdefault('R_LOG_LEVEL', '6')
|
||||||
env.setdefault('R_LOG_DESTINATION', 'stderr')
|
env.setdefault('R_LOG_DESTINATION', 'stderr')
|
||||||
env.setdefault('R_LOG_VERBOSE', '1')
|
env.setdefault('R_LOG_VERBOSE', '1')
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath, outputHandler=None):
|
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo,
|
||||||
|
symbolsPath, outputHandler=None):
|
||||||
""" Wait for tests to finish.
|
""" Wait for tests to finish.
|
||||||
If maxTime seconds elapse or no output is detected for timeout
|
If maxTime seconds elapse or no output is detected for timeout
|
||||||
seconds, kill the process and fail the test.
|
seconds, kill the process and fail the test.
|
||||||
@@ -85,19 +87,20 @@ class RemoteAutomation(Automation):
|
|||||||
|
|
||||||
topActivity = self._device.get_top_activity(timeout=60)
|
topActivity = self._device.get_top_activity(timeout=60)
|
||||||
if topActivity == proc.procName:
|
if topActivity == proc.procName:
|
||||||
print "Browser unexpectedly found running. Killing..."
|
print("Browser unexpectedly found running. Killing...")
|
||||||
proc.kill(True)
|
proc.kill(True)
|
||||||
if status == 1:
|
if status == 1:
|
||||||
if maxTime:
|
if maxTime:
|
||||||
print "TEST-UNEXPECTED-FAIL | %s | application ran for longer than " \
|
print("TEST-UNEXPECTED-FAIL | %s | application ran for longer than "
|
||||||
"allowed maximum time of %s seconds" % (
|
"allowed maximum time of %s seconds" % (
|
||||||
self.lastTestSeen, maxTime)
|
self.lastTestSeen, maxTime))
|
||||||
else:
|
else:
|
||||||
print "TEST-UNEXPECTED-FAIL | %s | application ran for longer than " \
|
print("TEST-UNEXPECTED-FAIL | %s | application ran for longer than "
|
||||||
"allowed maximum time" % (self.lastTestSeen)
|
"allowed maximum time" % (self.lastTestSeen))
|
||||||
if status == 2:
|
if status == 2:
|
||||||
print "TEST-UNEXPECTED-FAIL | %s | application timed out after %d seconds with no output" \
|
print("TEST-UNEXPECTED-FAIL | %s | application timed out after %d seconds with"
|
||||||
% (self.lastTestSeen, int(timeout))
|
"no output"
|
||||||
|
% (self.lastTestSeen, int(timeout)))
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
@@ -109,7 +112,7 @@ class RemoteAutomation(Automation):
|
|||||||
self._device.shell_output('echo > %s' % traces, root=True)
|
self._device.shell_output('echo > %s' % traces, root=True)
|
||||||
self._device.shell_output('chmod 666 %s' % traces, root=True)
|
self._device.shell_output('chmod 666 %s' % traces, root=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "Error deleting %s: %s" % (traces, str(e))
|
print("Error deleting %s: %s" % (traces, str(e)))
|
||||||
|
|
||||||
def checkForANRs(self):
|
def checkForANRs(self):
|
||||||
traces = "/data/anr/traces.txt"
|
traces = "/data/anr/traces.txt"
|
||||||
@@ -119,14 +122,14 @@ class RemoteAutomation(Automation):
|
|||||||
if t:
|
if t:
|
||||||
stripped = t.strip()
|
stripped = t.strip()
|
||||||
if len(stripped) > 0:
|
if len(stripped) > 0:
|
||||||
print "Contents of %s:" % traces
|
print("Contents of %s:" % traces)
|
||||||
print t
|
print(t)
|
||||||
# Once reported, delete traces
|
# Once reported, delete traces
|
||||||
self.deleteANRs()
|
self.deleteANRs()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "Error pulling %s: %s" % (traces, str(e))
|
print("Error pulling %s: %s" % (traces, str(e)))
|
||||||
else:
|
else:
|
||||||
print "%s not found" % traces
|
print("%s not found" % traces)
|
||||||
|
|
||||||
def deleteTombstones(self):
|
def deleteTombstones(self):
|
||||||
# delete any tombstone files from device
|
# delete any tombstone files from device
|
||||||
@@ -155,9 +158,9 @@ class RemoteAutomation(Automation):
|
|||||||
os.rename(f, newname)
|
os.rename(f, newname)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print "%s does not exist; tombstone check skipped" % remoteDir
|
print("%s does not exist; tombstone check skipped" % remoteDir)
|
||||||
else:
|
else:
|
||||||
print "MOZ_UPLOAD_DIR not defined; tombstone check skipped"
|
print("MOZ_UPLOAD_DIR not defined; tombstone check skipped")
|
||||||
|
|
||||||
def checkForCrashes(self, directory, symbolsPath):
|
def checkForCrashes(self, directory, symbolsPath):
|
||||||
self.checkForANRs()
|
self.checkForANRs()
|
||||||
@@ -184,7 +187,8 @@ class RemoteAutomation(Automation):
|
|||||||
# minidumps directory is automatically created when Fennec
|
# minidumps directory is automatically created when Fennec
|
||||||
# (first) starts, so its lack of presence is a hint that
|
# (first) starts, so its lack of presence is a hint that
|
||||||
# something went wrong.
|
# something went wrong.
|
||||||
print "Automation Error: No crash directory (%s) found on remote device" % remoteCrashDir
|
print("Automation Error: No crash directory (%s) found on remote device" %
|
||||||
|
remoteCrashDir)
|
||||||
return True
|
return True
|
||||||
self._device.pull(remoteCrashDir, dumpDir)
|
self._device.pull(remoteCrashDir, dumpDir)
|
||||||
|
|
||||||
@@ -196,8 +200,8 @@ class RemoteAutomation(Automation):
|
|||||||
try:
|
try:
|
||||||
shutil.rmtree(dumpDir)
|
shutil.rmtree(dumpDir)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "WARNING: unable to remove directory %s: %s" % (
|
print("WARNING: unable to remove directory %s: %s" % (
|
||||||
dumpDir, str(e))
|
dumpDir, str(e)))
|
||||||
return crashed
|
return crashed
|
||||||
|
|
||||||
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
|
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
|
||||||
@@ -214,7 +218,7 @@ class RemoteAutomation(Automation):
|
|||||||
self, app, debuggerInfo, profileDir, testURL, extraArgs)
|
self, app, debuggerInfo, profileDir, testURL, extraArgs)
|
||||||
try:
|
try:
|
||||||
args.remove('-foreground')
|
args.remove('-foreground')
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
return app, args
|
return app, args
|
||||||
|
|
||||||
@@ -243,7 +247,7 @@ class RemoteAutomation(Automation):
|
|||||||
cmd = ' '.join(cmd)
|
cmd = ' '.join(cmd)
|
||||||
self.procName = app
|
self.procName = app
|
||||||
if not self.device.shell_bool(cmd):
|
if not self.device.shell_bool(cmd):
|
||||||
print "remote_automation.py failed to launch %s" % cmd
|
print("remote_automation.py failed to launch %s" % cmd)
|
||||||
else:
|
else:
|
||||||
args = cmd
|
args = cmd
|
||||||
if args[0] == app:
|
if args[0] == app:
|
||||||
@@ -302,7 +306,7 @@ class RemoteAutomation(Automation):
|
|||||||
r"TEST-START \| ([^\s]*)", newLogContent)
|
r"TEST-START \| ([^\s]*)", newLogContent)
|
||||||
if testStartFilenames:
|
if testStartFilenames:
|
||||||
self.lastTestSeen = testStartFilenames[-1]
|
self.lastTestSeen = testStartFilenames[-1]
|
||||||
print newLogContent
|
print(newLogContent)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self.logBuffer += newLogContent
|
self.logBuffer += newLogContent
|
||||||
@@ -340,7 +344,7 @@ class RemoteAutomation(Automation):
|
|||||||
self.counts['fail'] += val
|
self.counts['fail'] += val
|
||||||
elif "Todo:" in line:
|
elif "Todo:" in line:
|
||||||
self.counts['todo'] += val
|
self.counts['todo'] += val
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@@ -359,7 +363,7 @@ class RemoteAutomation(Automation):
|
|||||||
timer = 0
|
timer = 0
|
||||||
noOutputTimer = 0
|
noOutputTimer = 0
|
||||||
interval = 10
|
interval = 10
|
||||||
if timeout == None:
|
if timeout is None:
|
||||||
timeout = self.timeout
|
timeout = self.timeout
|
||||||
status = 0
|
status = 0
|
||||||
top = self.procName
|
top = self.procName
|
||||||
@@ -390,7 +394,7 @@ class RemoteAutomation(Automation):
|
|||||||
if not hasOutput:
|
if not hasOutput:
|
||||||
top = self.device.get_top_activity(timeout=60)
|
top = self.device.get_top_activity(timeout=60)
|
||||||
if top is None:
|
if top is None:
|
||||||
print "Failed to get top activity, retrying, once..."
|
print("Failed to get top activity, retrying, once...")
|
||||||
top = self.device.get_top_activity(timeout=60)
|
top = self.device.get_top_activity(timeout=60)
|
||||||
# Flush anything added to stdout during the sleep
|
# Flush anything added to stdout during the sleep
|
||||||
self.read_stdout()
|
self.read_stdout()
|
||||||
@@ -408,27 +412,27 @@ class RemoteAutomation(Automation):
|
|||||||
# Trigger an ANR report with "kill -3" (SIGQUIT)
|
# Trigger an ANR report with "kill -3" (SIGQUIT)
|
||||||
try:
|
try:
|
||||||
self.device.pkill(self.procName, sig=3, attempts=1)
|
self.device.pkill(self.procName, sig=3, attempts=1)
|
||||||
except:
|
except: # NOQA: E722
|
||||||
pass
|
pass
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
# Trigger a breakpad dump with "kill -6" (SIGABRT)
|
# Trigger a breakpad dump with "kill -6" (SIGABRT)
|
||||||
try:
|
try:
|
||||||
self.device.pkill(self.procName, sig=6, attempts=1)
|
self.device.pkill(self.procName, sig=6, attempts=1)
|
||||||
except:
|
except: # NOQA: E722
|
||||||
pass
|
pass
|
||||||
# Wait for process to end
|
# Wait for process to end
|
||||||
retries = 0
|
retries = 0
|
||||||
while retries < 3:
|
while retries < 3:
|
||||||
if self.device.process_exist(self.procName):
|
if self.device.process_exist(self.procName):
|
||||||
print "%s still alive after SIGABRT: waiting..." % self.procName
|
print("%s still alive after SIGABRT: waiting..." % self.procName)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
retries += 1
|
retries += 1
|
||||||
try:
|
try:
|
||||||
self.device.pkill(self.procName, sig=9, attempts=1)
|
self.device.pkill(self.procName, sig=9, attempts=1)
|
||||||
except:
|
except: # NOQA: E722
|
||||||
print "%s still alive after SIGKILL!" % self.procName
|
print("%s still alive after SIGKILL!" % self.procName)
|
||||||
if self.device.process_exist(self.procName):
|
if self.device.process_exist(self.procName):
|
||||||
self.device.stop_application(self.procName)
|
self.device.stop_application(self.procName)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
|
||||||
import distutils
|
import distutils
|
||||||
|
|
||||||
from mozbuild.base import MozbuildObject
|
from mozbuild.base import MozbuildObject
|
||||||
@@ -81,7 +80,7 @@ def writeCertspecForServerLocations(fd):
|
|||||||
if not customCertOption:
|
if not customCertOption:
|
||||||
SAN.append(loc.host)
|
SAN.append(loc.host)
|
||||||
|
|
||||||
fd.write("issuer:printableString/CN=Temporary Certificate Authority/O=Mozilla Testing/OU=Profile Guided Optimization\n")
|
fd.write("issuer:printableString/CN=Temporary Certificate Authority/O=Mozilla Testing/OU=Profile Guided Optimization\n") # NOQA: E501
|
||||||
fd.write("subject:{}\n".format(SAN[0]))
|
fd.write("subject:{}\n".format(SAN[0]))
|
||||||
fd.write("extension:subjectAlternativeName:{}\n".format(",".join(SAN)))
|
fd.write("extension:subjectAlternativeName:{}\n".format(",".join(SAN)))
|
||||||
|
|
||||||
@@ -95,9 +94,7 @@ def constructCertDatabase(build, srcDir):
|
|||||||
pykey = os.path.join(build.topsrcdir, "security", "manager", "ssl", "tests",
|
pykey = os.path.join(build.topsrcdir, "security", "manager", "ssl", "tests",
|
||||||
"unit", "pykey.py")
|
"unit", "pykey.py")
|
||||||
|
|
||||||
with NamedTemporaryFile() as pwfile, NamedTemporaryFile() as rndfile, TemporaryDirectory() as pemfolder:
|
with NamedTemporaryFile() as pwfile, TemporaryDirectory() as pemfolder:
|
||||||
pgoCAPath = os.path.join(srcDir, "pgoca.p12")
|
|
||||||
|
|
||||||
pwfile.write("\n")
|
pwfile.write("\n")
|
||||||
pwfile.flush()
|
pwfile.flush()
|
||||||
|
|
||||||
@@ -136,7 +133,9 @@ def constructCertDatabase(build, srcDir):
|
|||||||
return status
|
return status
|
||||||
|
|
||||||
status = runUtil(certutil, [
|
status = runUtil(certutil, [
|
||||||
"-A", "-n", name, "-t", "P,,", "-i", pem, "-d", srcDir, "-f", pwfile.name])
|
"-A", "-n", name, "-t", "P,,", "-i", pem,
|
||||||
|
"-d", srcDir, "-f", pwfile.name
|
||||||
|
])
|
||||||
if status:
|
if status:
|
||||||
return status
|
return status
|
||||||
|
|
||||||
@@ -145,8 +144,9 @@ def constructCertDatabase(build, srcDir):
|
|||||||
name = parts[0]
|
name = parts[0]
|
||||||
key_type = parts[1]
|
key_type = parts[1]
|
||||||
if key_type not in ["ca", "client", "server"]:
|
if key_type not in ["ca", "client", "server"]:
|
||||||
raise Exception("{}: keyspec filenames must be of the form XXX.client.keyspec or XXX.ca.keyspec (key_type={})".format(
|
raise Exception("{}: keyspec filenames must be of the form XXX.client.keyspec "
|
||||||
keyspec, key_type))
|
"or XXX.ca.keyspec (key_type={})".format(
|
||||||
|
keyspec, key_type))
|
||||||
key_pem = os.path.join(pemfolder, "{}.key.pem".format(name))
|
key_pem = os.path.join(pemfolder, "{}.key.pem".format(name))
|
||||||
|
|
||||||
print("Generating private key {} (pem={})".format(name, key_pem))
|
print("Generating private key {} (pem={})".format(name, key_pem))
|
||||||
@@ -161,14 +161,16 @@ def constructCertDatabase(build, srcDir):
|
|||||||
|
|
||||||
cert_pem = os.path.join(pemfolder, "{}.cert.pem".format(name))
|
cert_pem = os.path.join(pemfolder, "{}.cert.pem".format(name))
|
||||||
if not os.path.exists(cert_pem):
|
if not os.path.exists(cert_pem):
|
||||||
raise Exception("There has to be a corresponding certificate named {} for the keyspec {}".format(
|
raise Exception("There has to be a corresponding certificate named {} for "
|
||||||
cert_pem, keyspec))
|
"the keyspec {}".format(
|
||||||
|
cert_pem, keyspec))
|
||||||
|
|
||||||
p12 = os.path.join(pemfolder, "{}.key.p12".format(name))
|
p12 = os.path.join(pemfolder, "{}.key.p12".format(name))
|
||||||
print("Converting private key {} to PKCS12 (p12={})".format(
|
print("Converting private key {} to PKCS12 (p12={})".format(
|
||||||
key_pem, p12))
|
key_pem, p12))
|
||||||
status = runUtil(openssl, ["pkcs12", "-export", "-inkey", key_pem, "-in",
|
status = runUtil(openssl, ["pkcs12", "-export", "-inkey", key_pem, "-in",
|
||||||
cert_pem, "-name", name, "-out", p12, "-passout", "file:"+pwfile.name])
|
cert_pem, "-name", name, "-out", p12, "-passout",
|
||||||
|
"file:"+pwfile.name])
|
||||||
if status:
|
if status:
|
||||||
return status
|
return status
|
||||||
|
|
||||||
@@ -197,5 +199,5 @@ build = MozbuildObject.from_environment()
|
|||||||
certdir = os.path.join(build.topsrcdir, "build", "pgo", "certs")
|
certdir = os.path.join(build.topsrcdir, "build", "pgo", "certs")
|
||||||
certificateStatus = constructCertDatabase(build, certdir)
|
certificateStatus = constructCertDatabase(build, certdir)
|
||||||
if certificateStatus:
|
if certificateStatus:
|
||||||
print "TEST-UNEXPECTED-FAIL | SSL Server Certificate generation"
|
print("TEST-UNEXPECTED-FAIL | SSL Server Certificate generation")
|
||||||
sys.exit(certificateStatus)
|
sys.exit(certificateStatus)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from buildconfig import substs
|
|||||||
from mozbuild.base import MozbuildObject
|
from mozbuild.base import MozbuildObject
|
||||||
from mozfile import TemporaryDirectory
|
from mozfile import TemporaryDirectory
|
||||||
from mozhttpd import MozHttpd
|
from mozhttpd import MozHttpd
|
||||||
from mozprofile import FirefoxProfile, Profile, Preferences
|
from mozprofile import FirefoxProfile, Preferences
|
||||||
from mozprofile.permissions import ServerLocations
|
from mozprofile.permissions import ServerLocations
|
||||||
from mozrunner import FirefoxRunner, CLI
|
from mozrunner import FirefoxRunner, CLI
|
||||||
from six import string_types
|
from six import string_types
|
||||||
@@ -66,7 +66,8 @@ if __name__ == '__main__':
|
|||||||
profile = FirefoxProfile(profile=profilePath,
|
profile = FirefoxProfile(profile=profilePath,
|
||||||
preferences=prefs,
|
preferences=prefs,
|
||||||
addons=[os.path.join(
|
addons=[os.path.join(
|
||||||
build.topsrcdir, 'tools', 'quitter', 'quitter@mozilla.org.xpi')],
|
build.topsrcdir, 'tools', 'quitter',
|
||||||
|
'quitter@mozilla.org.xpi')],
|
||||||
locations=locations)
|
locations=locations)
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
@@ -96,7 +97,7 @@ if __name__ == '__main__':
|
|||||||
jarlog = os.getenv("JARLOG_FILE")
|
jarlog = os.getenv("JARLOG_FILE")
|
||||||
if jarlog:
|
if jarlog:
|
||||||
env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
|
env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
|
||||||
print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
|
print("jarlog: %s" % env["MOZ_JAR_LOG_FILE"])
|
||||||
|
|
||||||
cmdargs = ["http://localhost:%d/index.html" % PORT]
|
cmdargs = ["http://localhost:%d/index.html" % PORT]
|
||||||
runner = FirefoxRunner(profile=profile,
|
runner = FirefoxRunner(profile=profile,
|
||||||
|
|||||||
@@ -90,7 +90,9 @@ def scan_directory(path):
|
|||||||
|
|
||||||
# Now rewrite the library itself
|
# Now rewrite the library itself
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
[substs['INSTALL_NAME_TOOL'], '-id', '@executable_path/' + DYLIB_NAME, os.path.join(path, DYLIB_NAME)])
|
[substs['INSTALL_NAME_TOOL'], '-id',
|
||||||
|
'@executable_path/' + DYLIB_NAME,
|
||||||
|
os.path.join(path, DYLIB_NAME)])
|
||||||
dylibCopied = True
|
dylibCopied = True
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('dylib path in %s was not found at: %s\n' % (
|
sys.stderr.write('dylib path in %s was not found at: %s\n' % (
|
||||||
@@ -100,7 +102,9 @@ def scan_directory(path):
|
|||||||
relpath = '' if path == root else os.path.relpath(
|
relpath = '' if path == root else os.path.relpath(
|
||||||
path, root) + '/'
|
path, root) + '/'
|
||||||
subprocess.check_call([substs['INSTALL_NAME_TOOL'], '-change',
|
subprocess.check_call([substs['INSTALL_NAME_TOOL'], '-change',
|
||||||
absDylibPath, '@executable_path/' + relpath + DYLIB_NAME, filename])
|
absDylibPath,
|
||||||
|
'@executable_path/' + relpath + DYLIB_NAME,
|
||||||
|
filename])
|
||||||
break
|
break
|
||||||
|
|
||||||
if not dylibCopied:
|
if not dylibCopied:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -64,4 +63,4 @@ if __name__ == '__main__':
|
|||||||
}]}
|
}]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
print "PERFHERDER_DATA: %s" % json.dumps(perfherder_data)
|
print("PERFHERDER_DATA: %s" % json.dumps(perfherder_data))
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import mozinfo
|
import mozinfo
|
||||||
import os
|
import os
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from mach.decorators import (
|
from mach.decorators import (
|
||||||
Command,
|
Command,
|
||||||
@@ -45,10 +44,7 @@ class MachCommands(MachCommandBase):
|
|||||||
'--suppression multiple times to specify multiple suppression '
|
'--suppression multiple times to specify multiple suppression '
|
||||||
'files.')
|
'files.')
|
||||||
def valgrind_test(self, suppressions):
|
def valgrind_test(self, suppressions):
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
from mozbuild.base import MozbuildObject
|
|
||||||
from mozfile import TemporaryDirectory
|
from mozfile import TemporaryDirectory
|
||||||
from mozhttpd import MozHttpd
|
from mozhttpd import MozHttpd
|
||||||
from mozprofile import FirefoxProfile, Preferences
|
from mozprofile import FirefoxProfile, Preferences
|
||||||
@@ -172,7 +168,8 @@ class MachCommands(MachCommandBase):
|
|||||||
status = 1 # turns the TBPL job orange
|
status = 1 # turns the TBPL job orange
|
||||||
self.log(logging.ERROR, 'valgrind-fail-parsing',
|
self.log(logging.ERROR, 'valgrind-fail-parsing',
|
||||||
{'errs': errs, 'supps': supps},
|
{'errs': errs, 'supps': supps},
|
||||||
'TEST-UNEXPECTED-FAIL | valgrind-test | error parsing: {errs} errors seen, but {supps} generated suppressions seen')
|
'TEST-UNEXPECTED-FAIL | valgrind-test | error parsing: {errs} errors '
|
||||||
|
'seen, but {supps} generated suppressions seen')
|
||||||
|
|
||||||
elif errs == 0:
|
elif errs == 0:
|
||||||
status = 0
|
status = 0
|
||||||
@@ -182,15 +179,17 @@ class MachCommands(MachCommandBase):
|
|||||||
status = 1 # turns the TBPL job orange
|
status = 1 # turns the TBPL job orange
|
||||||
# We've already printed details of the errors.
|
# We've already printed details of the errors.
|
||||||
|
|
||||||
if exitcode == None:
|
if exitcode is None:
|
||||||
status = 2 # turns the TBPL job red
|
status = 2 # turns the TBPL job red
|
||||||
self.log(logging.ERROR, 'valgrind-fail-timeout',
|
self.log(logging.ERROR, 'valgrind-fail-timeout',
|
||||||
{'timeout': timeout},
|
{'timeout': timeout},
|
||||||
'TEST-UNEXPECTED-FAIL | valgrind-test | Valgrind timed out (reached {timeout} second limit)')
|
'TEST-UNEXPECTED-FAIL | valgrind-test | Valgrind timed out '
|
||||||
|
'(reached {timeout} second limit)')
|
||||||
elif exitcode != 0:
|
elif exitcode != 0:
|
||||||
status = 2 # turns the TBPL job red
|
status = 2 # turns the TBPL job red
|
||||||
self.log(logging.ERROR, 'valgrind-fail-errors', {},
|
self.log(logging.ERROR, 'valgrind-fail-errors', {},
|
||||||
'TEST-UNEXPECTED-FAIL | valgrind-test | non-zero exit code from Valgrind')
|
'TEST-UNEXPECTED-FAIL | valgrind-test | non-zero exit code'
|
||||||
|
'from Valgrind')
|
||||||
|
|
||||||
httpd.stop()
|
httpd.stop()
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class OutputHandler(object):
|
|||||||
the count of these lines doesn't match the error count found during
|
the count of these lines doesn't match the error count found during
|
||||||
parsing, then the parsing has missed one or more errors and we can fail
|
parsing, then the parsing has missed one or more errors and we can fail
|
||||||
appropriately.
|
appropriately.
|
||||||
'''
|
''' # NOQA: E501
|
||||||
|
|
||||||
def __init__(self, logger):
|
def __init__(self, logger):
|
||||||
# The regexps in this list match all of Valgrind's errors. Note that
|
# The regexps in this list match all of Valgrind's errors. Note that
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ BINSCOPE_OUTPUT_LOGFILE = r".\binscope_xml_output.log"
|
|||||||
|
|
||||||
# usage
|
# usage
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
print """usage : autobinscope.by path_to_binary path_to_symbols [log_file_path]"
|
print("""usage : autobinscope.by path_to_binary path_to_symbols [log_file_path]"
|
||||||
log_file_path is optional, log will be written to .\binscope_xml_output.log by default"""
|
log_file_path is optional, log will be written to .\binscope_xml_output.log by default""")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
binary_path = sys.argv[1]
|
binary_path = sys.argv[1]
|
||||||
@@ -36,7 +36,8 @@ else:
|
|||||||
try:
|
try:
|
||||||
binscope_path = os.environ['BINSCOPE']
|
binscope_path = os.environ['BINSCOPE']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print "TEST-UNEXPECTED-FAIL | autobinscope.py | BINSCOPE environment variable is not set, can't check DEP/ASLR etc. status."
|
print("TEST-UNEXPECTED-FAIL | autobinscope.py | BINSCOPE environment variable is not set, "
|
||||||
|
"can't check DEP/ASLR etc. status.")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -49,7 +50,7 @@ try:
|
|||||||
"/Checks", "ATLVulnCheck",
|
"/Checks", "ATLVulnCheck",
|
||||||
# We do not ship in the Windows Store
|
# We do not ship in the Windows Store
|
||||||
"/SkippedChecks", "AppContainerCheck",
|
"/SkippedChecks", "AppContainerCheck",
|
||||||
# The CompilerVersionCheck doesn't like clang-cl (we would need to set MinimumCompilerVersion)
|
# The CompilerVersionCheck doesn't like clang-cl (we would need to set MinimumCompilerVersion) # NOQA: E501
|
||||||
# But we check the compiler in our build system anyway, so this doesn't seem useful
|
# But we check the compiler in our build system anyway, so this doesn't seem useful
|
||||||
"/SkippedChecks", "CompilerVersionCheck",
|
"/SkippedChecks", "CompilerVersionCheck",
|
||||||
"/Checks", "DBCheck",
|
"/Checks", "DBCheck",
|
||||||
@@ -73,11 +74,12 @@ try:
|
|||||||
|
|
||||||
except WindowsError, (errno, strerror):
|
except WindowsError, (errno, strerror):
|
||||||
if errno != 2 and errno != 3:
|
if errno != 2 and errno != 3:
|
||||||
print "TEST-UNEXPECTED-FAIL | autobinscope.py | Unexpected error %d : %s" (
|
print("TEST-UNEXPECTED-FAIL | autobinscope.py | Unexpected error %d : %s" (
|
||||||
errno, strerror)
|
errno, strerror))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
print "TEST-UNEXPECTED-FAIL | autobinscope.py | Could not locate binscope at location : %s\n" % binscope_path
|
print("TEST-UNEXPECTED-FAIL | autobinscope.py | Could not locate binscope at location : "
|
||||||
|
"%s\n" % binscope_path)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
proc.wait()
|
proc.wait()
|
||||||
@@ -91,10 +93,10 @@ for line in output:
|
|||||||
errors += 1
|
errors += 1
|
||||||
|
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
print "TEST-UNEXPECTED-FAIL | autobinscope.py | Binscope returned error code %d for file %s" % (
|
print("TEST-UNEXPECTED-FAIL | autobinscope.py | Binscope returned error code %d for file %s" %
|
||||||
proc.returncode, binary_path)
|
(proc.returncode, binary_path))
|
||||||
elif errors != 0:
|
elif errors != 0:
|
||||||
print "TEST-UNEXPECTED-FAIL | autobinscope.py | Binscope reported %d error(s) for file %s" % (
|
print("TEST-UNEXPECTED-FAIL | autobinscope.py | Binscope reported %d error(s) for file %s" % (
|
||||||
errors, binary_path)
|
errors, binary_path))
|
||||||
else:
|
else:
|
||||||
print "TEST-PASS | autobinscope.py | %s succeeded" % binary_path
|
print("TEST-PASS | autobinscope.py | %s succeeded" % binary_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user