blob: 04b1aaf412c7326d1cd048dabcddff02c4ea16e2 [file] [log] [blame]
Alex Kleinc5403d62019-04-03 09:34:59 -06001# -*- coding: utf-8 -*-
2# Copyright 2019 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Test controller.
7
8Handles all testing related functionality, it is not itself a test.
9"""
10
11from __future__ import print_function
12
13from chromite.lib import cros_build_lib
14from chromite.lib import sysroot_lib
15from chromite.service import test
16
17
18def DebugInfoTest(input_proto, _output_proto):
19 """Run the debug info tests."""
20 sysroot_path = input_proto.sysroot.path
21 target_name = input_proto.sysroot.build_target.name
22
23 if not sysroot_path:
24 if target_name:
25 sysroot_path = cros_build_lib.GetSysroot(target_name)
26 else:
27 cros_build_lib.Die("The sysroot path or the sysroot's build target name "
28 'must be provided.')
29
30 # We could get away with out this, but it's a cheap check.
31 sysroot = sysroot_lib.Sysroot(sysroot_path)
32 if not sysroot.Exists():
33 cros_build_lib.Die('The provided sysroot does not exist.')
34
35 return 0 if test.DebugInfoTest(sysroot_path) else 1