diff options
author | Gilad Arnold <garnold@chromium.org> | 2015-07-16 16:33:00 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-22 05:02:51 +0000 |
commit | 53b62278d049a50c20e6693aeaefe9675ccb8407 (patch) | |
tree | dcb2e8a2714e7dd990838f3a4926b30a48a6a063 | |
parent | e4beff7dacb170298f86bb5bde1946b9b827b174 (diff) |
paycheck: Small improvements to the block tracer utility.
This prepends the current block number to the output, simplifies some
logic, and tightens argument validation in the command-line parser.
BUG=None
TEST=paycheck -B/-b works.
Change-Id: I90d5cdf721612cdd12e49f4e4181849fc699807f
Reviewed-on: https://chromium-review.googlesource.com/286547
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
-rwxr-xr-x | scripts/paycheck.py | 2 | ||||
-rw-r--r-- | scripts/update_payload/block_tracer.py | 21 |
2 files changed, 12 insertions, 11 deletions
diff --git a/scripts/paycheck.py b/scripts/paycheck.py index 5290e9d5..0195f531 100755 --- a/scripts/paycheck.py +++ b/scripts/paycheck.py @@ -117,7 +117,7 @@ def ParseArguments(argv): parser.error('invalid argument to --disabled_tests: %s' % test) # Ensure consistent use of block tracing options. - do_block_trace = opts.root_block or opts.kern_block + do_block_trace = not (opts.root_block is None and opts.kern_block is None) if opts.skip and not do_block_trace: parser.error('--skip must be used with either --root-block or --kern-block') diff --git a/scripts/update_payload/block_tracer.py b/scripts/update_payload/block_tracer.py index e7a9d273..f222b214 100644 --- a/scripts/update_payload/block_tracer.py +++ b/scripts/update_payload/block_tracer.py @@ -14,6 +14,8 @@ tracer is as follows: """ +from __future__ import print_function + import common @@ -50,7 +52,6 @@ class PayloadBlockTracer(object): trace_out_file: a file object to dump the trace to operations: the sequence of operations base_name: name of the operation sequence - """ # Traverse operations backwards. for op, op_name in common.OperationIter(operations, base_name, @@ -68,8 +69,9 @@ class PayloadBlockTracer(object): else: total_block_offset += block - dst_ex.start_block trace_out_file.write( - '%s: found %s (total block offset: %d)\n' % - (dst_ex_name, common.FormatExtent(dst_ex), total_block_offset)) + '%d: %s: found %s (total block offset: %d)\n' % + (block, dst_ex_name, common.FormatExtent(dst_ex), + total_block_offset)) found = True break @@ -100,13 +102,12 @@ class PayloadBlockTracer(object): skip: the number of first origin mappings to skip trace_out_file: file object to dump the trace to is_kernel: trace through kernel (True) or rootfs (False) operations - """ if is_kernel: - self._TraceBlock(block, skip, trace_out_file, - self.payload.manifest.kernel_install_operations, - 'kernel_install_operations') + operations = self.payload.manifest.kernel_install_operations + base_name = 'kernel_install_operations' else: - self._TraceBlock(block, skip, trace_out_file, - self.payload.manifest.install_operations, - 'install_operations') + operations = self.payload.manifest.install_operations + base_name = 'install_operations' + + self._TraceBlock(block, skip, trace_out_file, operations, base_name) |