Commit b2b46786 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Ignore [exe|lib].unstripped in test runner

Fuchsia test/exe runner was looking for symbols in exe.unstripped and
lib.unstripped directories. Files in these directories are no longer
generated, so the script would use outdated files left over from when
they were generated. Cleanup the script to ignore these directories.

Change-Id: Ic9d8ced326c3c2d83caf70e0ccea7df4af01c414
Reviewed-on: https://chromium-review.googlesource.com/834762Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525224}
parent 0f56604a
...@@ -133,11 +133,9 @@ def _ExpandDirectories(file_mapping, mapper): ...@@ -133,11 +133,9 @@ def _ExpandDirectories(file_mapping, mapper):
return expanded return expanded
def _GetSymbolsMapping(dry_run, file_mapping, output_directory): def _GetSymbolsMapping(dry_run, file_mapping):
"""For each stripped executable or dynamic library in |file_mapping|, looks """Generates symbols mapping from |file_mapping| by filtering out all files
for an unstripped version in [exe|lib].unstripped under |output_directory|. that are not ELF binaries."""
Returns a map from target filenames to un-stripped binary, if available, or
to the run-time binary otherwise."""
symbols_mapping = {} symbols_mapping = {}
for target, source in file_mapping.iteritems(): for target, source in file_mapping.iteritems():
with open(source, 'rb') as f: with open(source, 'rb') as f:
...@@ -145,22 +143,7 @@ def _GetSymbolsMapping(dry_run, file_mapping, output_directory): ...@@ -145,22 +143,7 @@ def _GetSymbolsMapping(dry_run, file_mapping, output_directory):
if file_tag != '\x7fELF': if file_tag != '\x7fELF':
continue continue
# TODO(wez): Rather than bake-in assumptions about the naming of unstripped symbols_mapping[target] = source
# binaries, once we have ELF Build-Id values in the stack printout we should
# just scan the two directories to populate an Id->path mapping.
binary_name = os.path.basename(source)
exe_unstripped_path = os.path.join(
output_directory, 'exe.unstripped', binary_name)
lib_unstripped_path = os.path.join(
output_directory, 'lib.unstripped', binary_name)
if os.path.exists(exe_unstripped_path):
symbols_mapping[target] = exe_unstripped_path
elif os.path.exists(lib_unstripped_path):
# TODO(wez): libraries are named by basename in stacks, not by path.
symbols_mapping[binary_name] = lib_unstripped_path
symbols_mapping[target] = lib_unstripped_path
else:
symbols_mapping[target] = source
if dry_run: if dry_run:
print 'Symbols:', binary_name, '->', symbols_mapping[target] print 'Symbols:', binary_name, '->', symbols_mapping[target]
...@@ -403,8 +386,7 @@ def _BuildBootfsManifest(image_creation_data): ...@@ -403,8 +386,7 @@ def _BuildBootfsManifest(image_creation_data):
lambda x: _MakeTargetImageName(DIR_SOURCE_ROOT, icd.output_directory, x)) lambda x: _MakeTargetImageName(DIR_SOURCE_ROOT, icd.output_directory, x))
# Determine the locations of unstripped versions of each binary, if any. # Determine the locations of unstripped versions of each binary, if any.
symbols_mapping = _GetSymbolsMapping( symbols_mapping = _GetSymbolsMapping(icd.dry_run, file_mapping)
icd.dry_run, file_mapping, icd.output_directory)
return file_mapping, symbols_mapping return file_mapping, symbols_mapping
...@@ -495,8 +477,8 @@ def _SymbolizeEntries(entries): ...@@ -495,8 +477,8 @@ def _SymbolizeEntries(entries):
return results return results
def _LookupDebugBinary(entry, file_mapping): def _LookupDebugBinary(entry, symbols_mapping):
"""Looks up the binary listed in |entry| in the |file_mapping|, and returns """Looks up the binary listed in |entry| in the |symbols_mapping|, and returns
the corresponding host-side binary's filename, or None.""" the corresponding host-side binary's filename, or None."""
binary = entry['binary'] binary = entry['binary']
if not binary: if not binary:
...@@ -517,25 +499,25 @@ def _LookupDebugBinary(entry, file_mapping): ...@@ -517,25 +499,25 @@ def _LookupDebugBinary(entry, file_mapping):
binary = binary[len(system_prefix):] binary = binary[len(system_prefix):]
# Allow any other paths to pass-through; sometimes neither prefix is present. # Allow any other paths to pass-through; sometimes neither prefix is present.
if binary in file_mapping: if binary in symbols_mapping:
return file_mapping[binary] return symbols_mapping[binary]
# |binary| may be truncated by the crashlogger, so if there is a unique # |binary| may be truncated by the crashlogger, so if there is a unique
# match for the truncated name in |file_mapping|, use that instead. # match for the truncated name in |symbols_mapping|, use that instead.
matches = filter(lambda x: x.startswith(binary), file_mapping.keys()) matches = filter(lambda x: x.startswith(binary), symbols_mapping.keys())
if len(matches) == 1: if len(matches) == 1:
return file_mapping[matches[0]] return symbols_mapping[matches[0]]
return None return None
def _SymbolizeBacktrace(backtrace, file_mapping): def _SymbolizeBacktrace(backtrace, symbols_mapping):
# Group |backtrace| entries according to the associated binary, and locate # Group |backtrace| entries according to the associated binary, and locate
# the path to the debug symbols for that binary, if any. # the path to the debug symbols for that binary, if any.
batches = {} batches = {}
for entry in backtrace: for entry in backtrace:
debug_binary = _LookupDebugBinary(entry, file_mapping) debug_binary = _LookupDebugBinary(entry, symbols_mapping)
if debug_binary: if debug_binary:
entry['debug_binary'] = debug_binary entry['debug_binary'] = debug_binary
batches.setdefault(debug_binary, []).append(entry) batches.setdefault(debug_binary, []).append(entry)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment