OSDN Git Service

am 798e7434: (-s ours) Don\'t init class during reflection signature scan.
[android-x86/dalvik.git] / tools / dexcheck
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.
8 files=`adb shell "cd /data/dalvik-cache; echo *" | sed -e s/.$//`
9 if [ "$files" = "*" ]; then
10     echo 'ERROR: commands must run as root on device (try "adb root" first?)'
11     exit 1
12 fi
13
14 failure=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.
21 for 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
29 done
30
31 exit $failure
32