api: Provide pkg logs in BuildTargetUnitTest
Some builders have package build failures in the BuildTargetUnitTest
CI step, and this CL provides the package log locations in these cases.
BUG=b:204816060
TEST=./run_tests
TEST=cq forthcoming
Change-Id: I7ad627f51a2fefdccd4555641be554f669a7e952
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3404957
Reviewed-by: Cindy Lin <xcl@google.com>
Commit-Queue: Lizzy Presland <zland@google.com>
Tested-by: Lizzy Presland <zland@google.com>
Auto-Submit: Lizzy Presland <zland@google.com>
diff --git a/api/controller/test.py b/api/controller/test.py
index e1cafe1..20bfd81 100644
--- a/api/controller/test.py
+++ b/api/controller/test.py
@@ -78,6 +78,9 @@
pkg_info = package_info.parse(pkg)
pkg_info_msg = output_proto.failed_packages.add()
controller_util.serialize_package_info(pkg_info, pkg_info_msg)
+ failed_pkg_data_msg = output_proto.failed_package_data.add()
+ controller_util.serialize_package_info(pkg_info, failed_pkg_data_msg.name)
+ failed_pkg_data_msg.log_path.path = '/path/to/%s/log' % pkg
@faux.success(_BuildTargetUnitTestResponse)
@@ -120,6 +123,8 @@
code_coverage = input_proto.flags.code_coverage
+ sysroot = sysroot_lib.Sysroot(build_target.root)
+
result = test.BuildTargetUnitTest(
build_target,
chroot,
@@ -131,17 +136,17 @@
filter_only_cros_workon=filter_only_cros_workon)
if not result.success:
- # Failed to run tests or some tests failed.
- # Record all failed packages.
- for pkg_info in result.failed_pkgs:
- package_info_msg = output_proto.failed_packages.add()
- controller_util.serialize_package_info(pkg_info, package_info_msg)
+ # Record all failed packages and retrieve log locations.
+ controller_util.retrieve_package_log_paths(
+ sysroot_lib.PackageInstallError('error installing packages',
+ cros_build_lib.CommandResult(),
+ packages=result.failed_pkgs),
+ output_proto, sysroot)
if result.failed_pkgs:
return controller.RETURN_CODE_UNSUCCESSFUL_RESPONSE_AVAILABLE
else:
return controller.RETURN_CODE_COMPLETED_UNSUCCESSFULLY
- sysroot = sysroot_lib.Sysroot(build_target.root)
tarball = test.BuildTargetUnitTestTarball(chroot, sysroot, result_path)
if tarball:
output_proto.tarball_path = tarball