Bug 539516 - Switch automation.py to use the new python stack fixer. r=ted

--HG--
rename : tools/rb/fix-macosx-stack.py => tools/rb/fix_macosx_stack.py
This commit is contained in:
Jesse Ruderman 2010-02-21 13:03:20 -08:00
parent 53c12b1846
commit 96ef373380
4 changed files with 27 additions and 16 deletions

View File

@ -101,6 +101,8 @@ libs:: bloatcycle.html
ifeq ($(OS_ARCH),Darwin)
libs:: $(topsrcdir)/tools/rb/fix-macosx-stack.pl
$(INSTALL) $< $(DIST)/bin
libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py
$(INSTALL) $< $(DIST)/bin
# Basic unit tests for some stuff in the unify script
check::

View File

@ -580,26 +580,30 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime):
""" Look for timeout or crashes and return the status after the process terminates """
stackFixerProcess = None
stackFixerModule = None
didTimeout = False
if proc.stdout is None:
self.log.info("TEST-INFO: Not logging stdout or stderr due to debugger connection")
else:
logsource = proc.stdout
if self.IS_DEBUG_BUILD:
stackFixerCommand = None
if self.IS_MAC:
stackFixerCommand = "fix-macosx-stack.pl"
elif self.IS_LINUX:
stackFixerCommand = "fix-linux-stack.pl"
if stackFixerCommand is not None:
stackFixerProcess = self.Process([self.PERL, os.path.join(utilityPath, stackFixerCommand)],
stdin=logsource,
stdout=subprocess.PIPE)
logsource = stackFixerProcess.stdout
if self.IS_DEBUG_BUILD and self.IS_LINUX:
# Run logsource through fix-linux-stack.pl
stackFixerProcess = self.Process([self.PERL, os.path.join(utilityPath, "fix-linux-stack.pl")],
stdin=logsource,
stdout=subprocess.PIPE)
logsource = stackFixerProcess.stdout
if self.IS_DEBUG_BUILD and self.IS_MAC:
# Import fix_macosx_stack.py from utilityPath
sys.path.insert(0, utilityPath)
import fix_macosx_stack as stackFixerModule
del sys.path[0]
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
hitMaxTime = False
while line != "" and not didTimeout:
if stackFixerModule:
line = stackFixerModule.fixSymbols(line)
self.log.info(line.rstrip())
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
if not hitMaxTime and maxTime and datetime.now() - startTime > timedelta(seconds = maxTime):

View File

@ -106,7 +106,7 @@ TEST_HARNESS_BINS += \
endif
ifeq ($(OS_ARCH),Darwin)
TEST_HARNESS_BINS += fix-macosx-stack.pl
TEST_HARNESS_BINS += fix_macosx_stack.py
endif
ifeq ($(OS_ARCH),Linux)

View File

@ -134,7 +134,8 @@ def cxxfilt(sym):
line_re = re.compile("^([ \|0-9-]*)(.*) ?\[([^ ]*) \+(0x[0-9A-F]{1,8})\](.*)$")
atos_sym_re = re.compile("^(\S+) \(in ([^)]+)\) \((.+)\)$")
for line in sys.stdin:
def fixSymbols(line):
result = line_re.match(line)
if result is not None:
# before allows preservation of balance trees
@ -157,9 +158,13 @@ for line in sys.stdin:
symbol = cxxfilt(symbol)
info = "%s (%s, in %s)" % (symbol, fileline, library)
sys.stdout.write(before + info + after + "\n")
return before + info + after + "\n"
else:
sys.stderr.write("Warning: File \"" + file + "\" does not exist.\n")
sys.stdout.write(line)
return line
else:
sys.stdout.write(line)
return line
if __name__ == "__main__":
for line in sys.stdin:
sys.stdout.write(fixSymbols(line))