Hi All,
Finally, the emma code coverage measurement is working for me (for a
custom project). So here are the steps what you need to make it work
(I have tested it, with Java 1.5 on Ubuntu 8.04):
mkdir android-src
cd android-src
repo init -u git://android.git.kernel.org/platform/manifest.git -b
cupcake
repo sync
# Add emma.jar to the system/core/rootdir/init.rc
sed 's/\/system\/framework\/core.jar:\/system\/framework\/ext.jar:/\/
system\/framework\/core.jar:\/system\/framework\/ext.jar:\/system\/
framework\/emma.jar:/' system/core/rootdir/init.rc > system/core/
rootdir/init.rc.tmp
mv system/core/rootdir/init.rc.tmp system/core/rootdir/init.rc
# Rebuild the boot image
make bootimage
# To build the full system image
make -j4
# Set the PATH:
export PATH=${PATH}:/<_path_>/android-src/out/host/linux-x86/bin/
# Build the emma jar itself
make emma
# Setting the environment and additional bash commands. (like
m,mm,mmm, choosecombo etc) Notice the space after the dot!
. build/envsetup.sh
# Set EMMA_INSTRUMENTATION to true
export EMMA_INSTRUMENT=true
# Copy your project to development/samples/<_projectname_> or
somewhere..:)
# Based on the ApiDemo create an Android.mk file for the project
directory and the project test directory
# The LOCAL_INSTRUMENTATION_FOR value in test dir Android.mk has to be
equal with the LOCAL_PACKAGE_NAME defined in the Android.mk in the
main project dir.
# Compile the Application would like to instrument
mmm development/samples/<_projectname_>
# Set the ANDROID_PRODUCT_OUT directory for the emulator to know the
image location
export ANDROID_PRODUCT_OUT=/<_path_>/android-src/out/target/product/
generic
# Start an emulator with a simulated sdcard:
emulator -sdcard <path to sdcard>
# Remount the drive - it is needed to have a writable drive. without
that sync wont work
adb remount
# Synchronize the local content with the emulator
adb sync
adb shell
# create directory: mkdir /etc/coverageresult
# Executing tests
adb shell am instrument -w -e coverage true -e coverageFile /etc/
coverageresult/coverage.ec hu.agsoftware.sample.tests/
android.test.InstrumentationTestRunner
# Dump a runtime coverage data file:
adb pull /etc/coverageresult/coverage.ec coverage.ec
# Generate a coverage report
java -cp external/emma/lib/emma.jar emma report -r html -in
coverage.ec -sp development/samples/<_projectname_>/src -in out/target/
common/obj/APPS/<_projectname>_intermediates/coverage.em
I hope it helps.
Gabor
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---