Check that /system exists in chroot before cleaning it up.
Test: adb shell rm -rf "$ART_TEST_CHROOT/system" && art/tools/cleanup-buildbot-device.sh
Bug: 34729697
Change-Id: Icd5a1e0dd35480704c468a4e738f88a86ab85f8f
diff --git a/tools/cleanup-buildbot-device.sh b/tools/cleanup-buildbot-device.sh
index 53072ae..8c28828 100755
--- a/tools/cleanup-buildbot-device.sh
+++ b/tools/cleanup-buildbot-device.sh
@@ -44,10 +44,11 @@
# TODO: Also consider adding a "tear down device" step on the ART
# Buildbot (at the very end of a build) undoing (some of) the work
# done in the "device setup" step.
- adb shell find "$ART_TEST_CHROOT/system" \
- ! -path "$ART_TEST_CHROOT/system/etc/selinux/plat_property_contexts" \
- ! -type d \
- -exec rm -f \{\} +
+ adb shell test -f "$ART_TEST_CHROOT/system" \
+ "&&" find "$ART_TEST_CHROOT/system" \
+ ! -path "$ART_TEST_CHROOT/system/etc/selinux/plat_property_contexts" \
+ ! -type d \
+ -exec rm -f \{\} +
echo -e "${green}Clean up some subdirs in /data in chroot${nc}"
adb shell rm -rf \