[SuperSize] Fix default src root to find OWNERS files.
Two notions of "src root" in SuperSize are: (1) SuperSize script's src root |path_util.SRC_ROOT|. This is useful for finding tools used by SuperSize. (2) The src root of the input binary (i.e., Chrome) given for SuperSize-archive, and can be specified by the --source-directory switch. This is used to find OWNER files to extract symbol component values. Previously SuperSize uses (1) as the default value of (2). Normally this is okay since (1) and (2) coincide. However, for development we may need to compare the results of two versions of SuperSize (with different (1) src root) on common binaries (common (2) src root). In this case, defaulting (2) to (1) would lead to inconsistent default results (fixable by --source-directory, but this is error-prone manually). This CL fixes the problem by changing the default value for (2), by having SuperSize search for src root using the output directory as the starting point, i.e., map /.../src/out/Debug/ -> /.../src , and falls back to (1) only if results are inconclusive. Details: * path_util.py: * For (1): Rename |SRC_ROOT| to |TOOLS_SRC_ROOT|. * Add GetSrcRootFromOutputDirectory(). * Rename {From, To}SrcRootRelative() to {From, To}ToolsSrcRootRelative(). * archive.py: * ContainerArchiveOptions: Take optional |output_directory| in __init__() to compute default (2) |self.src_root|. * _ParseComponentFromOwners(): Take ContainerArchiveOptions param, and clean up to avoid recursion. * Update tests: * Specify --source-directory. * Mock OWNER files no longer refer to actual Chrome directories. Bug: 1040645 Change-Id: I8f72608491624eddf5790c1a1fc240bfd23ca9cb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2171855 Commit-Queue: Samuel Huang <huangs@chromium.org> Reviewed-by:Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#763985}
Showing
Please register or sign in to comment