Port breakpad symbol uploading to AMBuild 2 (bug 5997 part 16, r=ds).
This commit is contained in:
parent
a55b000273
commit
cfad3b26ca
@ -468,3 +468,6 @@ builder.RunBuildScripts(
|
||||
'SM': SM
|
||||
}
|
||||
)
|
||||
|
||||
if builder.options.breakpad_dump:
|
||||
builder.RunScript('tools/buildbot/BreakpadSymbols', { 'SM': SM })
|
||||
|
@ -23,4 +23,6 @@ run.options.add_option('--no-mysql', action='store_false', default=True, dest='h
|
||||
run.options.add_option('-s', '--sdks', default='all', dest='sdks',
|
||||
help='Build against specified SDKs; valid args are "all", "present", or '
|
||||
'comma-delimited list of engine names (default: %default)')
|
||||
run.options.add_option('--breakpad-dump', action='store_true', dest='breakpad_dump',
|
||||
default=False, help='Dump and upload breakpad symbols')
|
||||
run.Configure()
|
||||
|
@ -1,31 +1,35 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
try:
|
||||
import urllib.request as urllib
|
||||
except ImportError:
|
||||
import urllib2 as urllib
|
||||
from ambuild.command import Command
|
||||
from ambuild.command import ShellCommand
|
||||
import os, sys
|
||||
|
||||
class IterateDebugInfoCommand(Command):
|
||||
def run(self, master, job):
|
||||
pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'rt')
|
||||
for debug_info in pdblog:
|
||||
debug_info = os.path.join(AMBuild.outputFolder, debug_info.strip())
|
||||
job.AddCommand(SymbolCommand(debug_info, symbolServer))
|
||||
pdblog.close()
|
||||
builder.SetBuildFolder('symbols')
|
||||
|
||||
UPLOAD_SCRIPT = os.path.join(builder.sourcePath, 'tools', 'buildbot', 'upload_symbols.py')
|
||||
|
||||
cxx_tasks = SM.binaries + SM.extensions + [SM.spcomp]
|
||||
for cxx_task in cxx_tasks:
|
||||
if builder.target_platform in ['windows']:
|
||||
debug_entry = cxx_task.debug
|
||||
else:
|
||||
debug_entry = cxx_task.binary
|
||||
|
||||
debug_file = os.path.join(builder.buildPath, debug_entry.path)
|
||||
if builder.target_platform is 'linux':
|
||||
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
|
||||
elif builder.target_platform is 'mac':
|
||||
argv = ['dump_syms', debug_file]
|
||||
elif builder.target_platform is 'windows':
|
||||
argv = ['dump_syms.exe', debug_file]
|
||||
|
||||
base_file = os.path.splitext(os.path.basename(debug_file))[0]
|
||||
symbol_file = base_file + '.breakpad'
|
||||
|
||||
argv = [sys.executable, UPLOAD_SCRIPT, symbol_file] + argv
|
||||
builder.AddCommand(
|
||||
inputs = [UPLOAD_SCRIPT, debug_file],
|
||||
argv = argv,
|
||||
outputs = [symbol_file]
|
||||
)
|
||||
|
||||
class SymbolCommand(ShellCommand):
|
||||
def __init__(self, debugFile, symbolServer):
|
||||
self.serverResponse = None
|
||||
self.symbolServer = symbolServer
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
cmdstring = "dump_syms {0} {1}".format(debugFile, os.path.dirname(debugFile))
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
cmdstring = "dump_syms {0}".format(debugFile)
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
cmdstring = "dump_syms.exe {0}".format(debugFile)
|
||||
ShellCommand.__init__(self, cmdstring)
|
||||
def run(self, master, job):
|
||||
ShellCommand.run(self, master, job)
|
||||
if self.stdout != None and len(self.stdout) > 0:
|
||||
@ -37,8 +41,3 @@ class SymbolCommand(ShellCommand):
|
||||
runner.PrintOut(self.stderr)
|
||||
if self.serverResponse != None and len(self.serverResponse) > 0:
|
||||
runner.PrintOut(self.serverResponse)
|
||||
|
||||
if 'BREAKPAD_SYMBOL_SERVER' in os.environ:
|
||||
symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
|
||||
job = AMBuild.AddJob('breakpad-symbols')
|
||||
job.AddCommand(IterateDebugInfoCommand())
|
||||
|
@ -26,13 +26,14 @@ if (!(-f 'OUTPUT/.ambuild2/graph') || !(-f 'OUTPUT/.ambuild2/vars')) {
|
||||
my ($result, $argn);
|
||||
$argn = $#ARGV + 1;
|
||||
print "Attempting to reconfigure...\n";
|
||||
my $conf_args = '--enable-optimize --breakpad-dump';
|
||||
if ($argn > 0 && $^O !~ /MSWin/) {
|
||||
$result = `CC=$ARGV[0] CXX=$ARGV[0] python ../build/configure.py --enable-optimize`;
|
||||
$result = `CC=$ARGV[0] CXX=$ARGV[0] python ../build/configure.py $conf_args`;
|
||||
} else {
|
||||
if ($^O =~ /MSWin/) {
|
||||
$result = `C:\\Python27\\Python.exe ..\\build\\configure.py --enable-optimize`;
|
||||
$result = `C:\\Python27\\Python.exe ..\\build\\configure.py $conf_args`;
|
||||
} else {
|
||||
$result = `CC=clang CXX=clang python ../build/configure.py --enable-optimize`;
|
||||
$result = `CC=clang CXX=clang python ../build/configure.py $conf_args`;
|
||||
}
|
||||
}
|
||||
print "$result\n";
|
||||
|
38
tools/buildbot/upload_symbols.py
Normal file
38
tools/buildbot/upload_symbols.py
Normal file
@ -0,0 +1,38 @@
|
||||
# vim: ts=8 sts=2 sw=2 tw=99 et ft=python:
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
try:
|
||||
import urllib.request as urllib
|
||||
except ImportError:
|
||||
import urllib2 as urllib
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
sys.stderr.write('Usage: <symbol-file> <dump-syms-cmd> <args...>\n')
|
||||
sys.exit(1)
|
||||
|
||||
SYMBOL_SERVER = os.environ['BREAKPAD_SYMBOL_SERVER']
|
||||
symbol_file = sys.argv[1]
|
||||
cmd_argv = sys.argv[2:]
|
||||
|
||||
sys.stdout.write(' '.join(cmd_argv))
|
||||
sys.stdout.write('\n')
|
||||
|
||||
p = subprocess.Popen(
|
||||
args = cmd_argv,
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE,
|
||||
shell = False
|
||||
)
|
||||
stdout, stderr = p.communicate()
|
||||
out = stdout.decode('utf8')
|
||||
err = stdout.decode('utf8')
|
||||
|
||||
with open(symbol_file, 'w') as fp:
|
||||
fp.write(stdout)
|
||||
fp.write(stderr)
|
||||
|
||||
request = urllib.Request(SYMBOL_SERVER, out)
|
||||
request.add_header('Content-Type', 'text/plain')
|
||||
server_response = urllib.urlopen(request).read().decode('utf8')
|
||||
print(server_response)
|
Loading…
Reference in New Issue
Block a user