1#!/bin/bash 2# 3# This requires read permission on /data/dalvik-cache. On an eng build this 4# works, on userdebug you will need to "adb root", or "su" followed by 5# "chmod 777 /data/dalvik-cache". 6 7# Get the list of files. Use "sed" to drop the trailing carriage return. 8files=`adb shell "cd /data/dalvik-cache; echo *" | sed -e s/.$//` 9if [ "$files" = "*" ]; then 10 echo 'ERROR: commands must run as root on device (try "adb root" first?)' 11 exit 1 12fi 13 14failure=0 15 16# Check each file in turn. This is much faster with "dexdump -c", but that 17# was added post-cupcake. 18# 19# The dexdump found in older builds does not stop on checksum failures and 20# will likely crash. 21for file in $files; do 22 echo $file 23 errout=`adb shell "dexdump /data/dalvik-cache/$file > dev/null"` 24 errcount=`echo $errout | wc -w` > /dev/null 25 if [ $errcount != "0" ]; then 26 echo " Failure in $file: $errout" 27 failure=1 28 fi 29done 30 31exit $failure 32 33