cbuildbot: Clean up chroots more carefully
Instead of just removing the directory and chroot.img file, use the
cleanup function introduced in crrev.com/c/611156 to ensure that chroots
are fully cleaned up.
BUG=chromium:752562,chromium:730144
TEST=trybots; unit tests.
Change-Id: I14a510d71c9a3924376a8893b32aa7f25b2e472f
Reviewed-on: https://chromium-review.googlesource.com/641973
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Trybot-Ready: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/cbuildbot_launch_unittest.py b/scripts/cbuildbot_launch_unittest.py
index 677eb5a..60548c5 100644
--- a/scripts/cbuildbot_launch_unittest.py
+++ b/scripts/cbuildbot_launch_unittest.py
@@ -302,6 +302,7 @@
"""Test CleanBuildRoot with a change in branches."""
self.populateBuildroot('2 branchA')
self.mock_repo.branch = 'branchB'
+ m = self.PatchObject(cros_build_lib, 'CleanupChrootMount')
cbuildbot_launch.CleanBuildRoot(
self.root, self.mock_repo, self.metrics)
@@ -310,6 +311,7 @@
self.assertExists(self.repo)
self.assertNotExists(self.chroot)
self.assertExists(self.general)
+ m.assert_called()
def testBuildrootBranchMatch(self):
"""Test CleanBuildRoot with no change in branch."""