| # Copyright 2018 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. |
| |
| from recipe_engine import recipe_test_api |
| |
| |
| class GomaTestApi(recipe_test_api.RecipeTestApi): |
| |
| def __call__(self, |
| goma_dir=None, |
| jobs=None, |
| deps_cache=None, |
| local_output_cache=None, |
| server=None, |
| enable_arbritrary_toolchains=None): |
| """Simulate pre-configured Goma through properties.""" |
| assert not jobs or isinstance(jobs, int) |
| assert not deps_cache or isinstance(deps_cache, bool) |
| assert not local_output_cache or isinstance(local_output_cache, bool) |
| ret = self.test(None) |
| ret.properties = {'$fuchsia/goma': {}} |
| if goma_dir: |
| ret.properties['$fuchsia/goma'].update({ |
| 'goma_dir': goma_dir, |
| }) |
| if jobs: |
| ret.properties['$fuchsia/goma'].update({ |
| 'jobs': jobs, |
| }) |
| if deps_cache: |
| ret.properties['$fuchsia/goma'].update({ |
| 'deps_cache': deps_cache, |
| }) |
| if local_output_cache: |
| ret.properties['$fuchsia/goma'].update({ |
| 'local_output_cache': local_output_cache, |
| }) |
| if server: |
| ret.properties['$fuchsia/goma'].update({ |
| 'server': server, |
| }) |
| if enable_arbritrary_toolchains: |
| ret.properties['$fuchsia/goma'].update({ |
| 'enable_arbritrary_toolchains': enable_arbritrary_toolchains, |
| }) |
| return ret |