blob: 7dee149129b503cdc85d6aad21c4969c0b4f1e9d [file] [log] [blame]
Roland Levillaine4f1c512017-10-30 13:28:28 +00001#!/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
Ulya Trafimovich95977482021-11-09 14:05:14 +000017. "$(dirname $0)/buildbot-utils.sh"
Roland Levillaine4f1c512017-10-30 13:28:28 +000018
19# Setup as root, as device cleanup requires it.
20adb root
21adb wait-for-device
22
23if [[ -n "$ART_TEST_CHROOT" ]]; then
24 # Check that ART_TEST_CHROOT is correctly defined.
25 if [[ "x$ART_TEST_CHROOT" != x/* ]]; then
26 echo "$ART_TEST_CHROOT is not an absolute path"
27 exit 1
28 fi
29
Roland Levillain917c80f2018-06-08 16:27:23 +010030 if adb shell test -d "$ART_TEST_CHROOT"; then
Ulya Trafimovich5298bcd2021-11-09 14:46:22 +000031 msginfo "Remove entire /linkerconfig directory from chroot directory"
Roland Levillain15ff34d2020-02-05 19:55:34 +000032 adb shell rm -rf "$ART_TEST_CHROOT/linkerconfig"
33
Ulya Trafimovich5298bcd2021-11-09 14:46:22 +000034 msginfo "Remove entire /system directory from chroot directory"
Roland Levillain917c80f2018-06-08 16:27:23 +010035 adb shell rm -rf "$ART_TEST_CHROOT/system"
Roland Levillaine4f1c512017-10-30 13:28:28 +000036
Ulya Trafimovich5298bcd2021-11-09 14:46:22 +000037 msginfo "Remove entire /data directory from chroot directory"
Roland Levillain917c80f2018-06-08 16:27:23 +010038 adb shell rm -rf "$ART_TEST_CHROOT/data"
39
Ulya Trafimovich5298bcd2021-11-09 14:46:22 +000040 msginfo "Remove entire chroot directory"
Roland Levillain917c80f2018-06-08 16:27:23 +010041 adb shell rmdir "$ART_TEST_CHROOT" || adb shell ls -la "$ART_TEST_CHROOT"
42 fi
Roland Levillaine4f1c512017-10-30 13:28:28 +000043else
44 adb shell rm -rf \
45 /data/local/tmp /data/art-test /data/nativetest /data/nativetest64 '/data/misc/trace/*'
46fi