| from slave import base_recipe |
| from slave.step import code_coverage_step |
| from slave.step import x86_camera_step |
| |
| |
| COVERAGE_IGNORE_FILENAME_REGEX = '.*/gen/.*|.*/third_party/.*' |
| COVERAGE_REPORT_FORMAT = 'lcov' |
| |
| |
| def GetValidBuildNames(): |
| return [ |
| 'gq_x64-eng', |
| 'gq_x86_64-eng', |
| 'gq_x64-eng-coverage', |
| 'nq_x64-eng', |
| 'nq_x86_64-eng', |
| 'nq_exp_x86_64-eng', |
| 'nq_x64-eng-coverage', |
| 'spencer_x64-eng', |
| 'spencer_x86_64-eng', |
| 'spencer_x64-eng-coverage', |
| 'venus_x64-eng', |
| 'venus_x86_64-eng', |
| 'venus_x64-eng-coverage', |
| ] |
| |
| |
| def CreateRecipe(build_name: str, **kwargs): |
| del build_name |
| return X86SimulatorRecipe(**kwargs) |
| |
| |
| class X86SimulatorRecipe(base_recipe.BaseRecipe): |
| """ Recipe for build x86 64 simulator""" |
| |
| def __init__(self, **kwargs): |
| base_recipe.BaseRecipe.__init__( |
| self, enable_build_accelerator=True, **kwargs) |
| self._code_coverage = self._properties.get('code_coverage', False) |
| |
| # nq_x64-eng --> nq |
| product = self.buildername[:self.buildername.find('_')] |
| if ('exp' in self.buildername): |
| product = product + '_exp' |
| |
| self._step_kwargs.update({ |
| 'code_coverage': self._code_coverage, |
| 'product': product |
| }) |
| |
| self.out_dir = f'out_chromecast_{product}_x86_64/release' |
| self.chromium_out_dir = f'chromium/src/{self.out_dir}' |
| |
| def get_steps(self): |
| steps = [ |
| x86_camera_step.MakeCleanSim( |
| **self._step_kwargs), |
| x86_camera_step.BuildSimulatorStep( |
| **self._step_kwargs), |
| x86_camera_step.BuildChromiumIotTestsStep( |
| out_dir=self.chromium_out_dir, **self._step_kwargs) |
| ] |
| |
| if self._code_coverage: |
| # RunCoverageCommandStep already takes a product as an arg. |
| step_kwargs = self._step_kwargs.copy() |
| product = step_kwargs.pop('product') + '_x86_64' |
| |
| # Set appropriate LD_LIBRARY_PATH and TARGET_PRODUCT when executing test. |
| # coverage.py executes tests with chromium/src as the working directory |
| # so LD_LIBRARY_PATH has to be relative to chromium/src. |
| test_env = { |
| 'LD_LIBRARY_PATH': ':'.join([ |
| '../../prebuilt/toolchain/x86_64/usr/lib64', |
| f'../../out/target/product/{product}/system/lib', |
| ]), |
| 'TARGET_PRODUCT': product, |
| } |
| |
| coverage_step = code_coverage_step.RunCoverageCommandStep( |
| None, |
| None, |
| None, |
| None, |
| sanitizer=None, |
| build_args_product=self.buildername, |
| build_args_official=False, |
| ignore_filename_regex=COVERAGE_IGNORE_FILENAME_REGEX, |
| report_format=COVERAGE_REPORT_FORMAT, |
| build_out_dir=self.out_dir, |
| test_env=test_env, |
| **step_kwargs, |
| ) |
| steps.extend([ |
| coverage_step, |
| code_coverage_step.CollectLcovCoverageStep( |
| lcov_files=coverage_step.get_lcov_output_file_paths(), |
| **step_kwargs, |
| ), |
| ]) |
| else: |
| steps += [ |
| x86_camera_step.RunChromiumIotTestsStep( |
| cwd=self.chromium_out_dir, |
| **self._step_kwargs) |
| ] |
| |
| steps += [ |
| x86_camera_step.CreateSimTarStep( |
| **self._step_kwargs), |
| x86_camera_step.BuildAndRunNldaemonUnitTestStep( |
| **self._step_kwargs), |
| ] |
| |
| return steps |