Add robustness to possible empty BUILD_CONTEXT
We find possible evidence that BUILD_CONTEXT existed but was incorrectly
empty.
Adding robustness for this for safety while continuing to investigate
the root cause.
Change-Id: I8e9149a97e8cba8291cb41e010d75102a437ad87
Test: presubmit
Bug: 383383586
diff --git a/ci/build_test_suites.py b/ci/build_test_suites.py
index 343a177..a541d89 100644
--- a/ci/build_test_suites.py
+++ b/ci/build_test_suites.py
@@ -72,6 +72,12 @@
if 'optimized_build' not in self.build_context.enabled_build_features:
return BuildPlan(set(self.args.extra_targets), set())
+ if not self.build_context.test_infos:
+ logging.warning('Build context has no test infos, skipping optimizations.')
+ for target in self.args.extra_targets:
+ get_metrics_agent().report_unoptimized_target(target, 'BUILD_CONTEXT has no test infos.')
+ return BuildPlan(set(self.args.extra_targets), set())
+
build_targets = set()
packaging_commands_getters = []
# In order to roll optimizations out differently between test suites and