| # -*- coding: utf-8 -*- |
| # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| """Test controller. |
| |
| Handles all testing related functionality, it is not itself a test. |
| """ |
| |
| from __future__ import print_function |
| |
| from chromite.lib import cros_build_lib |
| from chromite.lib import sysroot_lib |
| from chromite.service import test |
| |
| |
| def DebugInfoTest(input_proto, _output_proto): |
| """Run the debug info tests.""" |
| sysroot_path = input_proto.sysroot.path |
| target_name = input_proto.sysroot.build_target.name |
| |
| if not sysroot_path: |
| if target_name: |
| sysroot_path = cros_build_lib.GetSysroot(target_name) |
| else: |
| cros_build_lib.Die("The sysroot path or the sysroot's build target name " |
| 'must be provided.') |
| |
| # We could get away with out this, but it's a cheap check. |
| sysroot = sysroot_lib.Sysroot(sysroot_path) |
| if not sysroot.Exists(): |
| cros_build_lib.Die('The provided sysroot does not exist.') |
| |
| return 0 if test.DebugInfoTest(sysroot_path) else 1 |