Roland Levillain | e4f1c51 | 2017-10-30 13:28:28 +0000 | [diff] [blame] | 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 | |
Orion Hodson | 5697fab | 2019-11-19 15:01:02 +0000 | [diff] [blame] | 17 | if [ -t 1 ]; then |
| 18 | # Color sequences if terminal is a tty. |
| 19 | green='\033[0;32m' |
| 20 | nc='\033[0m' |
| 21 | fi |
Roland Levillain | e4f1c51 | 2017-10-30 13:28:28 +0000 | [diff] [blame] | 22 | |
| 23 | # Setup as root, as device cleanup requires it. |
| 24 | adb root |
| 25 | adb wait-for-device |
| 26 | |
| 27 | if [[ -n "$ART_TEST_CHROOT" ]]; then |
| 28 | # Check that ART_TEST_CHROOT is correctly defined. |
| 29 | if [[ "x$ART_TEST_CHROOT" != x/* ]]; then |
| 30 | echo "$ART_TEST_CHROOT is not an absolute path" |
| 31 | exit 1 |
| 32 | fi |
| 33 | |
Roland Levillain | 917c80f | 2018-06-08 16:27:23 +0100 | [diff] [blame] | 34 | if adb shell test -d "$ART_TEST_CHROOT"; then |
Roland Levillain | 15ff34d | 2020-02-05 19:55:34 +0000 | [diff] [blame] | 35 | echo -e "${green}Remove entire /linkerconfig directory from chroot directory${nc}" |
| 36 | adb shell rm -rf "$ART_TEST_CHROOT/linkerconfig" |
| 37 | |
Roland Levillain | 917c80f | 2018-06-08 16:27:23 +0100 | [diff] [blame] | 38 | echo -e "${green}Remove entire /system directory from chroot directory${nc}" |
| 39 | adb shell rm -rf "$ART_TEST_CHROOT/system" |
Roland Levillain | e4f1c51 | 2017-10-30 13:28:28 +0000 | [diff] [blame] | 40 | |
Roland Levillain | 917c80f | 2018-06-08 16:27:23 +0100 | [diff] [blame] | 41 | echo -e "${green}Remove entire /data directory from chroot directory${nc}" |
| 42 | adb shell rm -rf "$ART_TEST_CHROOT/data" |
| 43 | |
| 44 | echo -e "${green}Remove entire chroot directory${nc}" |
| 45 | adb shell rmdir "$ART_TEST_CHROOT" || adb shell ls -la "$ART_TEST_CHROOT" |
| 46 | fi |
Roland Levillain | e4f1c51 | 2017-10-30 13:28:28 +0000 | [diff] [blame] | 47 | else |
| 48 | adb shell rm -rf \ |
| 49 | /data/local/tmp /data/art-test /data/nativetest /data/nativetest64 '/data/misc/trace/*' |
| 50 | fi |