blob: 76662e86dcb43b5217791f8d90f0623565adb30d [file] [log] [blame]
Andy McFadden0198b142009-04-02 14:48:56 -07001#!/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/.$//`
Andy McFadden0acb6a42009-04-20 07:48:18 -07009if [ "$files" = "*" ]; then
10 echo 'ERROR: commands must run as root on device (try "adb root" first?)'
11 exit 1
12fi
13
14failure=0
Andy McFadden0198b142009-04-02 14:48:56 -070015
16# Check each file in turn. This is much faster with "dexdump -c", but that
17# was added post-cupcake.
Andy McFaddenbea515b2009-04-02 14:54:57 -070018#
19# The dexdump found in older builds does not stop on checksum failures and
20# will likely crash.
Andy McFadden0198b142009-04-02 14:48:56 -070021for file in $files; do
Andy McFadden0acb6a42009-04-20 07:48:18 -070022 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
Andy McFadden0198b142009-04-02 14:48:56 -070029done
30
Andy McFadden0acb6a42009-04-20 07:48:18 -070031exit $failure
Andy McFadden0198b142009-04-02 14:48:56 -070032