diff options
author | Cassidy Burden <cburden@google.com> | 2016-06-29 13:51:20 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-06-30 14:21:46 -0700 |
commit | d5113fb3bb67fc27f6fdc04e757e7a4b65e2a5f4 (patch) | |
tree | d962dd23d137d73cfdc189b33fe27eb60cdd5e61 /binary_search_tool/bisect.py | |
parent | caf9d96c94a914866c4cb9dfe401dfcee02c6047 (diff) | |
download | toolchain-utils-d5113fb3bb67fc27f6fdc04e757e7a4b65e2a5f4.tar.gz |
binary search tool: Add object bisecting to bisect.py
Add object file bisecting to bisect.py. This is the frontend to the
sysroot_wrapper bisection scripts. This bisection mode takes the
following arguments: board, remote IP, package to bisect, and optionally
the directory for the good/bad build trees.
Adds default install/test scripts to sysroot_wrapper (similar to
default scripts in cros_pkg) to support this bisection mode.
TEST=Run unit tests and system test with cryptohome package
CQ-DEPEND=CL:*267995
Change-Id: I1e9166b753f78ca7bdcf6ddbd056af62bc03923b
Reviewed-on: https://chrome-internal-review.googlesource.com/268035
Commit-Ready: Cassidy Burden <cburden@google.com>
Tested-by: Cassidy Burden <cburden@google.com>
Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'binary_search_tool/bisect.py')
-rwxr-xr-x | binary_search_tool/bisect.py | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/binary_search_tool/bisect.py b/binary_search_tool/bisect.py index 027956e5..8e454f62 100755 --- a/binary_search_tool/bisect.py +++ b/binary_search_tool/bisect.py @@ -168,17 +168,46 @@ class BisectPackage(Bisector): class BisectObject(Bisector): """The class for object bisection steps.""" + sysroot_wrapper_files = ['bad/_LIST', 'good/_LIST'] + def __init__(self, options, overrides): super(BisectObject, self).__init__(options, overrides) + self.method_name = 'ChromeOS Object' + self.default_kwargs = { + 'get_initial_items': 'sysroot_wrapper/get_initial_items.sh', + 'switch_to_good': 'sysroot_wrapper/switch_to_good.sh', + 'switch_to_bad': 'sysroot_wrapper/switch_to_bad.sh', + 'install_script': 'sysroot_wrapper/install.sh', + 'test_script': 'sysroot_wrapper/interactive_test.sh', + 'noincremental': True, + 'prune': True, + 'file_args': True + } + self.options = options + if options.dir: + os.environ['BISECT_DIR'] = options.dir + self.options.dir = os.environ.get('BISECT_DIR', '/tmp/sysroot_bisect') + + self.ArgOverride(self.default_kwargs, overrides) def PreRun(self): - raise NotImplementedError('Object bisecting still WIP') + for f in self.sysroot_wrapper_files: + full_path = os.path.join(self.options.dir, f) + if not os.path.exists(full_path): + self.logger.LogError('Object bisector setup failed, %s does not exist' % + full_path) + return 1 + + os.environ['BISECT_BOARD'] = self.options.board + os.environ['BISECT_REMOTE'] = self.options.remote + os.environ['BISECT_PACKAGE'] = self.options.package + return 0 def Run(self): - return 1 + return binary_search_state.Run(**self.default_kwargs) def PostRun(self): - return 1 + return 0 def Run(bisector): @@ -236,6 +265,15 @@ def Main(argv): parser_package.set_defaults(handler=BisectPackage) parser_object = subparsers.add_parser('object') + parser_object.add_argument('board', help='Board to target') + parser_object.add_argument('remote', help='Remote machine to test on') + parser_object.add_argument('package', help='Package to emerge and test') + parser_object.add_argument('--dir', + help=('Bisection directory to use, sets ' + '$BISECT_DIR if provided. Defaults to ' + 'current value of $BISECT_DIR (or ' + '/tmp/sysroot_bisect if $BISECT_DIR is ' + 'empty).')) parser_object.set_defaults(handler=BisectObject) options, remaining = parser.parse_known_args(argv) |