blob: 8531e4e42d5d51e65e80a4626467421b9cf77573 [file]
import os
from slave import base_recipe
from slave.step import code_coverage_step
from slave.step import gn_step
from slave.step import gn_check_step
from slave.step import x86_camera_step
BUILD_BRANDING = 'chrome'
BUILD_ARCH = 'x86'
BUILD_FLAVOR = 'Release'
BUILD_PRODUCT = 'chromecast'
BUILD_ARGS_OFFICIAL = False
BUILD_ARGS_PRODUCT = 'nccm_x86'
COVERAGE_IGNORE_FILENAME_REGEX = '.*/gen/.*|.*/third_party/.*'
COVERAGE_REPORT_FORMAT = 'lcov'
def GetValidBuildNames():
return [
BUILD_ARGS_PRODUCT,
]
def CreateRecipe(build_name: str, **kwargs):
del build_name
return NccmRecipe(**kwargs)
class NccmRecipe(base_recipe.BaseRecipe):
""" Recipe for build/run reconnect proxy test"""
def __init__(self, **kwargs):
base_recipe.BaseRecipe.__init__(
self, enable_build_accelerator=True, **kwargs)
self._properties = kwargs.get('properties', {})
self._code_coverage = self._properties.get('code_coverage', False)
def get_steps(self):
cwd = os.getcwd()
# Output directory for gn gen step must match expected output directory
# for RunCoverageCommandStep based on given BUILD_ARCH, BUILD_PRODUCT, etc.
out_dir_parts = ['out', BUILD_ARCH, BUILD_PRODUCT, 'gn']
out_dir = os.path.join(
'chromium/src', '_'.join(out_dir_parts), BUILD_FLAVOR)
build_args = []
if self._code_coverage:
build_args.append('use_clang_coverage=true')
build_args.append('is_component_build=false')
steps = [
gn_step.GnGenStep(build_args_product=BUILD_ARGS_PRODUCT,
build_args=build_args,
out_dir=out_dir,
cwd=cwd,
halt_on_failure=True,
**self._step_kwargs),
x86_camera_step.BuildNccmUnitTestStep(out_dir=out_dir,
**self._step_kwargs),
]
if self._code_coverage:
# Code coverage step executes the binary from the step before based
# on the list of executables stored in step data and collects
# coverage information.
coverage_step = code_coverage_step.RunCoverageCommandStep(
BUILD_BRANDING,
BUILD_ARCH,
BUILD_PRODUCT,
BUILD_FLAVOR,
sanitizer=None,
build_args_product=BUILD_ARGS_PRODUCT,
build_args_official=BUILD_ARGS_OFFICIAL,
ignore_filename_regex=COVERAGE_IGNORE_FILENAME_REGEX,
report_format=COVERAGE_REPORT_FORMAT,
**self._step_kwargs,
)
steps.extend([
coverage_step,
code_coverage_step.CollectLcovCoverageStep(
lcov_files=coverage_step.get_lcov_output_file_paths(),
**self._step_kwargs,
),
])
else:
steps += [
x86_camera_step.RunNccmUnitTestStep(out_dir=out_dir,
**self._step_kwargs)
]
return steps