blob: ff3e98da5f0a0845524a3e3bdfbda4ccff6b98db [file] [log] [blame]
#!/bin/bash
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This requires read permission on /data/dalvik-cache. On an eng build this
# works, on userdebug you will need to "adb root", or "su" followed by
# "chmod 777 /data/dalvik-cache".
# Get the list of files. Use "sed" to drop the trailing carriage return.
files=`adb shell "cd /data/dalvik-cache; echo *" | sed -e s/.$//`
if [ "$files" = "*" ]; then
echo 'ERROR: commands must run as root on device (try "adb root" first?)'
exit 1
fi
failure=0
# Check each file in turn. This is much faster with "dexdump -c", but that
# flag was not available in 1.6 and earlier.
#
# The dexdump found in older builds does not stop on checksum failures and
# will likely crash.
for file in $files; do
echo $file
errout=`adb shell "dexdump /data/dalvik-cache/$file > dev/null"`
errcount=`echo $errout | wc -w` > /dev/null
if [ $errcount != "0" ]; then
echo " Failure in $file: $errout"
failure=1
fi
done
exit $failure