test.BuildTargetUnitTest: Allow executing inside or outside SDK
Allow the BuildTargetUnitTest function to execute inside or outside
of the SDK to facilitate the transition to only running inside.
BUG=b:187784525
TEST=CQ
Change-Id: I6aa327acf19cdea9ebf389dc83a0864040e472cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3587124
Tested-by: Alex Klein <saklein@chromium.org>
Auto-Submit: Alex Klein <saklein@chromium.org>
Reviewed-by: Lizzy Presland <zland@google.com>
Commit-Queue: Lizzy Presland <zland@google.com>
diff --git a/api/controller/test.py b/api/controller/test.py
index c2479c7..a5f2e99 100644
--- a/api/controller/test.py
+++ b/api/controller/test.py
@@ -115,7 +115,10 @@
testable_packages_optional = input_proto.flags.testable_packages_optional
build_target = controller_util.ParseBuildTarget(input_proto.build_target)
- chroot = controller_util.ParseChroot(input_proto.chroot)
+ if cros_build_lib.IsOutsideChroot():
+ chroot = controller_util.ParseChroot(input_proto.chroot)
+ else:
+ chroot = None
code_coverage = input_proto.flags.code_coverage