1#!/bin/bash 2# 3# Copyright (C) 2017 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17green='\033[0;32m' 18nc='\033[0m' 19 20# Setup as root, as device cleanup requires it. 21adb root 22adb wait-for-device 23 24if [[ -n "$ART_TEST_CHROOT" ]]; then 25 # Check that ART_TEST_CHROOT is correctly defined. 26 if [[ "x$ART_TEST_CHROOT" != x/* ]]; then 27 echo "$ART_TEST_CHROOT is not an absolute path" 28 exit 1 29 fi 30 31 if adb shell test -d "$ART_TEST_CHROOT"; then 32 echo -e "${green}Remove entire /system directory from chroot directory${nc}" 33 adb shell rm -rf "$ART_TEST_CHROOT/system" 34 35 echo -e "${green}Remove entire /data directory from chroot directory${nc}" 36 adb shell rm -rf "$ART_TEST_CHROOT/data" 37 38 echo -e "${green}Remove entire chroot directory${nc}" 39 adb shell rmdir "$ART_TEST_CHROOT" || adb shell ls -la "$ART_TEST_CHROOT" 40 fi 41else 42 adb shell rm -rf \ 43 /data/local/tmp /data/art-test /data/nativetest /data/nativetest64 '/data/misc/trace/*' 44fi 45