chromite.api.TestService/DebugInfoTest: Add service.

BUG=chromium:905031, b:129703822
TEST=manual: debug_info_tests produced same output as endpoint.

Change-Id: Id0b4297708daca4bbb96d16ada182c23c642b61a
Reviewed-on: https://chromium-review.googlesource.com/1551220
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Evan Hernandez <evanhernandez@chromium.org>
diff --git a/api/controller/test.py b/api/controller/test.py
new file mode 100644
index 0000000..04b1aaf
--- /dev/null
+++ b/api/controller/test.py
@@ -0,0 +1,35 @@
+# -*- 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