diff options
-rw-r--r-- | infra/bots/recipe_modules/flavor/api.py | 3 | ||||
-rw-r--r-- | infra/bots/recipe_modules/flavor/coverage_flavor.py | 86 | ||||
-rw-r--r-- | infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json | 508 | ||||
-rw-r--r-- | infra/bots/recipes/swarm_test.py | 1 | ||||
-rwxr-xr-x | tools/llvm_coverage.sh | 16 | ||||
-rwxr-xr-x | tools/llvm_coverage_build | 29 | ||||
-rwxr-xr-x | tools/llvm_coverage_run.py | 63 |
7 files changed, 0 insertions, 706 deletions
diff --git a/infra/bots/recipe_modules/flavor/api.py b/infra/bots/recipe_modules/flavor/api.py index 21ee590dc5..4a28a0b576 100644 --- a/infra/bots/recipe_modules/flavor/api.py +++ b/infra/bots/recipe_modules/flavor/api.py @@ -10,7 +10,6 @@ from recipe_engine import recipe_api from . import android_flavor from . import cmake_flavor -from . import coverage_flavor from . import default_flavor from . import gn_android_flavor from . import gn_flavor @@ -74,8 +73,6 @@ class SkiaFlavorApi(recipe_api.RecipeApi): return pdfium_flavor.PDFiumFlavorUtils(self.m) elif is_valgrind(builder_cfg): return valgrind_flavor.ValgrindFlavorUtils(self.m) - elif builder_cfg.get('configuration') == 'Coverage': - return coverage_flavor.CoverageFlavorUtils(self.m) else: return default_flavor.DefaultFlavorUtils(self.m) diff --git a/infra/bots/recipe_modules/flavor/coverage_flavor.py b/infra/bots/recipe_modules/flavor/coverage_flavor.py deleted file mode 100644 index 732da7fdd6..0000000000 --- a/infra/bots/recipe_modules/flavor/coverage_flavor.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - - -import datetime -import default_flavor -import posixpath - - -"""Utils for running coverage tests.""" - - -class CoverageFlavorUtils(default_flavor.DefaultFlavorUtils): - - def step(self, name, cmd, **kwargs): - """Run the given step through coverage.""" - compile_target = 'dm' - build_cmd = [self.m.vars.skia_dir.join('tools', 'llvm_coverage_build'), - compile_target] - build_env = kwargs.pop('env', {}) - # We have to use Clang 3.6 because earlier versions do not support the - # compile flags we use and 3.7 and 3.8 hit asserts during compilation. - build_env['CC'] = '/usr/bin/clang-3.6' - build_env['CXX'] = '/usr/bin/clang++-3.6' - build_env['GYP_DEFINES'] = ( - 'skia_arch_type=x86_64 ' - 'skia_clang_build=1 ' - 'skia_gpu=0 ' - 'skia_warnings_as_errors=0') - self.m.step('build %s' % compile_target, - cmd=build_cmd, - cwd=self.m.path['checkout'], - env=build_env, - **kwargs) - - # Slice out the 'key' and 'properties' arguments to be reused. - key = [] - properties = [] - current = None - for i in xrange(0, len(cmd)): - if isinstance(cmd[i], basestring) and cmd[i] == '--key': - current = key - elif isinstance(cmd[i], basestring) and cmd[i] == '--properties': - current = properties - elif isinstance(cmd[i], basestring) and cmd[i].startswith('--'): - current = None - if current is not None: - current.append(cmd[i]) - - results_dir = self.m.vars.skia_out.join('coverage_results') - self.create_clean_host_dir(results_dir) - - # Run DM under coverage. - report_file_basename = '%s.cov' % self.m.vars.got_revision - report_file = results_dir.join(report_file_basename) - args = [ - 'python', - self.m.vars.skia_dir.join('tools', 'llvm_coverage_run.py'), - ] + cmd + ['--outResultsFile', report_file] - self.m.run(self.m.step, name=name, cmd=args, - cwd=self.m.path['checkout'], **kwargs) - - # Generate nanobench-style JSON output from the coverage report. - nanobench_json = results_dir.join('nanobench_%s.json' % ( - self.m.vars.got_revision)) - line_by_line_basename = ('coverage_by_line_%s.json' % ( - self.m.vars.got_revision)) - line_by_line = results_dir.join(line_by_line_basename) - args = [ - 'python', - self.m.vars.skia_dir.join('tools', 'parse_llvm_coverage.py'), - '--report', report_file, '--nanobench', nanobench_json, - '--linebyline', line_by_line] - args.extend(key) - args.extend(properties) - self.m.run( - self.m.step, - 'Generate Coverage Data', - cmd=args, cwd=self.m.path['checkout']) - - # Copy files from results_dir into swarming_out_dir. - for r in self.m.file.listdir('results_dir', results_dir): - self.m.file.copy( - 'Copy to swarming out', results_dir.join(r), - self.m.vars.swarming_out_dir) diff --git a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json deleted file mode 100644 index 9098ea7280..0000000000 --- a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json +++ /dev/null @@ -1,508 +0,0 @@ -[ - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "[SLAVE_BUILD]/skia/infra/bots/assets/skp/VERSION", - "/path/to/tmp/" - ], - "name": "Get downloaded SKP VERSION" - }, - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "42", - "[SLAVE_BUILD]/tmp/SKP_VERSION" - ], - "name": "write SKP_VERSION" - }, - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "[SLAVE_BUILD]/skia/infra/bots/assets/skimage/VERSION", - "/path/to/tmp/" - ], - "name": "Get downloaded skimage VERSION" - }, - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "42", - "[SLAVE_BUILD]/tmp/SK_IMAGE_VERSION" - ], - "name": "write SK_IMAGE_VERSION" - }, - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "[SLAVE_BUILD]/skia/infra/bots/assets/svg/VERSION", - "/path/to/tmp/" - ], - "name": "Get downloaded SVG VERSION" - }, - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "42", - "[SLAVE_BUILD]/tmp/SVG_VERSION" - ], - "name": "write SVG_VERSION" - }, - { - "cmd": [ - "[SLAVE_BUILD]/skia/tools/llvm_coverage_build", - "dm" - ], - "cwd": "[SLAVE_BUILD]/skia", - "env": { - "BUILDTYPE": "Coverage", - "CC": "/usr/bin/clang-3.6", - "CHROME_HEADLESS": "1", - "CXX": "/usr/bin/clang++-3.6", - "GYP_DEFINES": "skia_arch_type=x86_64 skia_clang_build=1 skia_gpu=0 skia_warnings_as_errors=0", - "SKIA_OUT": "[SLAVE_BUILD]/out" - }, - "name": "build dm" - }, - { - "cmd": [ - "python", - "-u", - "\nimport os, sys\nfrom common import chromium_utils # Error? See https://crbug.com/584783.\n\n\nif os.path.exists(sys.argv[1]):\n chromium_utils.RemoveDirectory(sys.argv[1])\n", - "[SLAVE_BUILD]/out/coverage_results" - ], - "env": { - "PYTHONPATH": "[SLAVE_BUILD]/skia/infra/bots/.recipe_deps/build/scripts" - }, - "name": "rmtree coverage_results", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@python.inline@@@@", - "@@@STEP_LOG_LINE@python.inline@import os, sys@@@", - "@@@STEP_LOG_LINE@python.inline@from common import chromium_utils # Error? See https://crbug.com/584783.@@@", - "@@@STEP_LOG_LINE@python.inline@@@@", - "@@@STEP_LOG_LINE@python.inline@@@@", - "@@@STEP_LOG_LINE@python.inline@if os.path.exists(sys.argv[1]):@@@", - "@@@STEP_LOG_LINE@python.inline@ chromium_utils.RemoveDirectory(sys.argv[1])@@@", - "@@@STEP_LOG_END@python.inline@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "\nimport sys, os\npath = sys.argv[1]\nmode = int(sys.argv[2])\nif not os.path.isdir(path):\n if os.path.exists(path):\n print \"%s exists but is not a dir\" % path\n sys.exit(1)\n os.makedirs(path, mode)\n", - "[SLAVE_BUILD]/out/coverage_results", - "511" - ], - "name": "makedirs coverage_results", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@python.inline@@@@", - "@@@STEP_LOG_LINE@python.inline@import sys, os@@@", - "@@@STEP_LOG_LINE@python.inline@path = sys.argv[1]@@@", - "@@@STEP_LOG_LINE@python.inline@mode = int(sys.argv[2])@@@", - "@@@STEP_LOG_LINE@python.inline@if not os.path.isdir(path):@@@", - "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(path):@@@", - "@@@STEP_LOG_LINE@python.inline@ print \"%s exists but is not a dir\" % path@@@", - "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", - "@@@STEP_LOG_LINE@python.inline@ os.makedirs(path, mode)@@@", - "@@@STEP_LOG_END@python.inline@@@" - ] - }, - { - "cmd": [ - "python", - "[SLAVE_BUILD]/skia/tools/llvm_coverage_run.py", - "dm", - "--undefok", - "--resourcePath", - "[SLAVE_BUILD]/skia/resources", - "--skps", - "[SLAVE_BUILD]/skp", - "--images", - "[SLAVE_BUILD]/skimage/dm", - "--colorImages", - "[SLAVE_BUILD]/skimage/colorspace", - "--nameByHash", - "--properties", - "gitHash", - "abc123", - "master", - "client.skia", - "builder", - "Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot", - "build_number", - "5", - "issue", - "500", - "patchset", - "1", - "patch_storage", - "rietveld", - "--svgs", - "[SLAVE_BUILD]/svg", - "--key", - "arch", - "x86_64", - "compiler", - "Clang", - "configuration", - "Coverage", - "cpu_or_gpu", - "CPU", - "cpu_or_gpu_value", - "AVX2", - "model", - "GCE", - "os", - "Ubuntu", - "--nogpu", - "--config", - "8888", - "gpu", - "gpusrgb", - "pdf", - "msaa16", - "565", - "f16", - "srgb", - "sp-8888", - "2ndpic-8888", - "lite-8888", - "serialize-8888", - "tiles_rt-8888", - "pic-8888", - "--src", - "tests", - "gm", - "image", - "colorImage", - "svg", - "--blacklist", - "f16", - "_", - "_", - "dstreadshuffle", - "f16", - "image", - "_", - "_", - "srgb", - "image", - "_", - "_", - "gpusrgb", - "image", - "_", - "_", - "serialize-8888", - "gm", - "_", - "bleed_image", - "serialize-8888", - "gm", - "_", - "c_gms", - "serialize-8888", - "gm", - "_", - "colortype", - "serialize-8888", - "gm", - "_", - "colortype_xfermodes", - "serialize-8888", - "gm", - "_", - "drawfilter", - "serialize-8888", - "gm", - "_", - "fontmgr_bounds_0.75_0", - "serialize-8888", - "gm", - "_", - "fontmgr_bounds_1_-0.25", - "serialize-8888", - "gm", - "_", - "fontmgr_bounds", - "serialize-8888", - "gm", - "_", - "fontmgr_match", - "serialize-8888", - "gm", - "_", - "fontmgr_iter", - "serialize-8888", - "gm", - "_", - "imagemasksubset", - "serialize-8888", - "gm", - "_", - "bitmapfilters", - "serialize-8888", - "gm", - "_", - "bitmapshaders", - "serialize-8888", - "gm", - "_", - "bleed", - "serialize-8888", - "gm", - "_", - "bleed_alpha_bmp", - "serialize-8888", - "gm", - "_", - "bleed_alpha_bmp_shader", - "serialize-8888", - "gm", - "_", - "convex_poly_clip", - "serialize-8888", - "gm", - "_", - "extractalpha", - "serialize-8888", - "gm", - "_", - "filterbitmap_checkerboard_32_32_g8", - "serialize-8888", - "gm", - "_", - "filterbitmap_image_mandrill_64", - "serialize-8888", - "gm", - "_", - "shadows", - "serialize-8888", - "gm", - "_", - "simpleaaclip_aaclip", - "serialize-8888", - "gm", - "_", - "composeshader_bitmap", - "serialize-8888", - "gm", - "_", - "scaled_tilemodes_npot", - "serialize-8888", - "gm", - "_", - "scaled_tilemodes", - "serialize-8888", - "gm", - "_", - "bleed_alpha_image", - "serialize-8888", - "gm", - "_", - "bleed_alpha_image_shader", - "sp-8888", - "gm", - "_", - "drawfilter", - "pic-8888", - "gm", - "_", - "drawfilter", - "2ndpic-8888", - "gm", - "_", - "drawfilter", - "lite-8888", - "gm", - "_", - "drawfilter", - "sp-8888", - "gm", - "_", - "image-cacherator-from-picture", - "pic-8888", - "gm", - "_", - "image-cacherator-from-picture", - "2ndpic-8888", - "gm", - "_", - "image-cacherator-from-picture", - "serialize-8888", - "gm", - "_", - "image-cacherator-from-picture", - "sp-8888", - "gm", - "_", - "image-cacherator-from-raster", - "pic-8888", - "gm", - "_", - "image-cacherator-from-raster", - "2ndpic-8888", - "gm", - "_", - "image-cacherator-from-raster", - "serialize-8888", - "gm", - "_", - "image-cacherator-from-raster", - "sp-8888", - "gm", - "_", - "image-cacherator-from-ctable", - "pic-8888", - "gm", - "_", - "image-cacherator-from-ctable", - "2ndpic-8888", - "gm", - "_", - "image-cacherator-from-ctable", - "serialize-8888", - "gm", - "_", - "image-cacherator-from-ctable", - "sp-8888", - "gm", - "_", - "gamut", - "pic-8888", - "gm", - "_", - "gamut", - "lite-8888", - "gm", - "_", - "gamut", - "2ndpic-8888", - "gm", - "_", - "gamut", - "serialize-8888", - "gm", - "_", - "gamut", - "--outResultsFile", - "[SLAVE_BUILD]/out/coverage_results/abc123.cov" - ], - "cwd": "[SLAVE_BUILD]/skia", - "env": { - "BUILDTYPE": "Coverage", - "CHROME_HEADLESS": "1", - "SKIA_OUT": "[SLAVE_BUILD]/out" - }, - "name": "dm" - }, - { - "cmd": [ - "python", - "[SLAVE_BUILD]/skia/tools/parse_llvm_coverage.py", - "--report", - "[SLAVE_BUILD]/out/coverage_results/abc123.cov", - "--nanobench", - "[SLAVE_BUILD]/out/coverage_results/nanobench_abc123.json", - "--linebyline", - "[SLAVE_BUILD]/out/coverage_results/coverage_by_line_abc123.json", - "--key", - "arch", - "x86_64", - "compiler", - "Clang", - "configuration", - "Coverage", - "cpu_or_gpu", - "CPU", - "cpu_or_gpu_value", - "AVX2", - "model", - "GCE", - "os", - "Ubuntu", - "--properties", - "gitHash", - "abc123", - "master", - "client.skia", - "builder", - "Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot", - "build_number", - "5", - "issue", - "500", - "patchset", - "1", - "patch_storage", - "rietveld" - ], - "cwd": "[SLAVE_BUILD]/skia", - "env": { - "BUILDTYPE": "Coverage", - "CHROME_HEADLESS": "1", - "SKIA_OUT": "[SLAVE_BUILD]/out" - }, - "name": "Generate Coverage Data" - }, - { - "cmd": [ - "python", - "-u", - "\nimport json, os, sys\nif os.path.exists(sys.argv[1]) and os.path.isdir(sys.argv[1]):\n with open(sys.argv[2], 'w') as f:\n json.dump(os.listdir(sys.argv[1]), f)\n", - "[SLAVE_BUILD]/out/coverage_results", - "/path/to/tmp/json" - ], - "name": "listdir results_dir", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@json.output@[@@@", - "@@@STEP_LOG_LINE@json.output@ \"file 1\", @@@", - "@@@STEP_LOG_LINE@json.output@ \"file 2\"@@@", - "@@@STEP_LOG_LINE@json.output@]@@@", - "@@@STEP_LOG_END@json.output@@@", - "@@@STEP_LOG_LINE@python.inline@@@@", - "@@@STEP_LOG_LINE@python.inline@import json, os, sys@@@", - "@@@STEP_LOG_LINE@python.inline@if os.path.exists(sys.argv[1]) and os.path.isdir(sys.argv[1]):@@@", - "@@@STEP_LOG_LINE@python.inline@ with open(sys.argv[2], 'w') as f:@@@", - "@@@STEP_LOG_LINE@python.inline@ json.dump(os.listdir(sys.argv[1]), f)@@@", - "@@@STEP_LOG_END@python.inline@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "[SLAVE_BUILD]/out/coverage_results/file 1", - "[CUSTOM_[SWARM_OUT_DIR]]" - ], - "name": "Copy to swarming out" - }, - { - "cmd": [ - "python", - "-u", - "\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n", - "[SLAVE_BUILD]/out/coverage_results/file 2", - "[CUSTOM_[SWARM_OUT_DIR]]" - ], - "name": "Copy to swarming out (2)" - }, - { - "name": "$result", - "recipe_result": null, - "status_code": 0 - } -]
\ No newline at end of file diff --git a/infra/bots/recipes/swarm_test.py b/infra/bots/recipes/swarm_test.py index 83b18fbe0e..edb2cf691e 100644 --- a/infra/bots/recipes/swarm_test.py +++ b/infra/bots/recipes/swarm_test.py @@ -36,7 +36,6 @@ TEST_BUILDERS = { 'Test-Mac-Clang-MacMini4.1-GPU-GeForce320M-x86_64-Debug', 'Test-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Debug', 'Test-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug-CommandBuffer', - 'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot', 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug', 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug', 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN', diff --git a/tools/llvm_coverage.sh b/tools/llvm_coverage.sh deleted file mode 100755 index 59d99e7a27..0000000000 --- a/tools/llvm_coverage.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Copyright (c) 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Run from Skia repo like this: -# $ tools/llvm_coverage.sh dm -# or -# $ tools/llvm_coverage.sh nanobench - -set -x -set -e - -make clean -tools/llvm_coverage_build $1 -python tools/llvm_coverage_run.py $@ diff --git a/tools/llvm_coverage_build b/tools/llvm_coverage_build deleted file mode 100755 index 85e9db9641..0000000000 --- a/tools/llvm_coverage_build +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright (c) 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Build Skia for use with LLVM's coverage tools. -# -# $ tools/llvm_coverage_build [any other flags to pass to make...] -# -# This script assumes the use of Clang 3.6. Earlier versions do not support -# the flags we use in the build, and 3.7+ hit asserts during compilation. -# -set -e - -export CC="${CC:-$(which clang)}" -export CXX="${CXX:-$(which clang++)}" - -if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]]; then - echo "Couldn't find Clang on this machine!" - exit 1 -fi - -echo "CC=$CC" -echo "CXX=$CXX" -$CC --version - -export GYP_DEFINES="skia_clang_build=1" -export BUILDTYPE=Coverage -make $@ diff --git a/tools/llvm_coverage_run.py b/tools/llvm_coverage_run.py deleted file mode 100755 index 8b497506e6..0000000000 --- a/tools/llvm_coverage_run.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - - -"""Run the given command through LLVM's coverage tools.""" - - -import argparse -import os -import subprocess - - -BUILDTYPE = 'Coverage' -PROFILE_DATA = 'default.profraw' -PROFILE_DATA_MERGED = 'prof_merged' -SKIA_OUT = 'SKIA_OUT' - - -def _get_out_dir(): - """Determine the location for compiled binaries.""" - return os.path.join(os.environ.get(SKIA_OUT, os.path.realpath('out')), - BUILDTYPE) - - -def run_coverage(cmd): - """Run the given command and return per-file coverage data. - - Assumes that the binary has been built using llvm_coverage_build and that - LLVM 3.6 or newer is installed. - """ - binary_path = os.path.join(_get_out_dir(), cmd[0]) - subprocess.call([binary_path] + cmd[1:]) - try: - subprocess.check_call( - ['llvm-profdata', 'merge', PROFILE_DATA, - '-output=%s' % PROFILE_DATA_MERGED]) - finally: - os.remove(PROFILE_DATA) - try: - return subprocess.check_output(['llvm-cov', 'show', '-no-colors', - '-instr-profile', PROFILE_DATA_MERGED, - binary_path]) - finally: - os.remove(PROFILE_DATA_MERGED) - - -def main(): - """Run coverage and generate a report.""" - # Parse args. - parser = argparse.ArgumentParser() - parser.add_argument('--outResultsFile') - args, cmd = parser.parse_known_args() - - # Run coverage. - report = run_coverage(cmd) - with open(args.outResultsFile, 'w') as f: - f.write(report) - - -if __name__ == '__main__': - main() |