[js-code-coverage] Convert cov output into line and uncovered blocks

Coverage is merged post browser_test execution but the format is in
contiguous blocks representing character offsets in the source file. To
upload this data into the coverage dashboard a new format is required
which can be found at:

  //appengine/findit/model/proto/code_coverage.proto

The format we have available to convert to is line coverage, the other
formats are not considered during this conversion. If multiple
invocation counts are found within the same line, the larger of the two
is taken.

The main logic logic is supplied in this CL with follow up CLs to
introduce logic for the helper functions _add_uncovered_block and
_extend_previous_line_range. Tests for the function to follow.

Bug: 1113941
Test: ./recipes.py test run
Test: ./generate_coverage_metadata_for_javascript_test.py
Test: python generate_coverage_metadata_for_javascript.py \
	--src-path chromium/src \
	--coverage-dir chromium/src/out/Default/devtools_code_coverage \
	--dir-metadata-path component_mapping \
	--output-dir none
Change-Id: I153b4143643a161974b1d929ac87b846a2119ca2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/build/+/2556418
Commit-Queue: Ben Reich <benreich@chromium.org>
Reviewed-by: Zhaoyang Li <zhaoyangli@chromium.org>
1 file changed
tree: 876ecbb8e23bd9b956dcfd1965fed1ac3203fad9
  1. infra/
  2. recipes/
  3. scripts/
  4. site_config/
  5. third_party/
  6. .gitattributes
  7. .gitignore
  8. .style.yapf
  9. .vpython
  10. .yapfignore
  11. codereview.settings
  12. CROS_OWNERS
  13. DEPS
  14. environment.cfg.py
  15. LICENSE
  16. OWNERS
  17. PRESUBMIT.py
  18. README.md
  19. WATCHLISTS
README.md

Recipes

If you're here to make a change to ‘recipes’ (the code located in scripts/slave/recipes*), please take a look at the README for more information pertaining to recipes.

Style

The preferred style is PEP8 with two-space indent; that is, the Chromium Python style. Functions use lowercase_with_underscores, with the exception of the special functions RunSteps and RunTests in recipes. Use yapf (git cl format --no-clang-format) to autoformat new code.