I had been surfing for the past one month on this Code coverage. But
its disappointing that there is no clear documentation on using EMMA
code coverage for Android.
case 1: I am trying to execute from Command prompt.
I have sucessfully implemented instrumentation class for my
application. I would like to go for code coverage. I executed the
following command in the cmd line:
adb shell am instrument -w -e coverage true com.android.app/
android.test.InstrumentationTestRunner
adb shell am instrument -w -e coverageFile /sdcard/codefile.ec
com.android.app/android.test.InstrumentationTestRunner
Also i have configured to run with sdcard.. I could see that all my
test cases are executed but no coverage file is generated at '/
sdcard'.
case 2: I am trying to execute from eclipse.
When i did all coverage configuration settings and try to run the
application, it pops up a message saying,
" No coverage data file has been written during this coverage session.
Please make sure that your application does NOT include EMMA run time
libraries or EMMA configurations.Do not terminate java process
manually from Eclipse"
Please do clarify my error.
Is there a right solution to get the code coverage for Android
applications...?
1. did you download and set classpath for emma.jar?
2. after that, you could get coverage.ec file.
But it's not right file for coverage report in my test. Perhaps other
things need to be done.
currently I don't know how to get an emma instrumented build, which is
needed for coverage test.
On 5月8日, 下午7时19分, Deeps <L.Prade...@gmail.com> wrote:
> I had been surfing for the past one month on this Code coverage. But
> its disappointing that there is no clear documentation on using EMMA
> code coverage for Android.
> case 1: I am trying to execute from Command prompt.
> I have sucessfully implemented instrumentation class for my
> application. I would like to go for code coverage. I executed the
> following command in the cmd line:
> Also i have configured to run with sdcard.. I could see that all my
> test cases are executed but no coverage file is generated at '/
> sdcard'.
> case 2: I am trying to execute from eclipse.
> When i did all coverage configuration settings and try to run the
> application, it pops up a message saying,
> " No coverage data file has been written during this coverage session.
> Please make sure that your application does NOT include EMMA run time
> libraries or EMMA configurations.Do not terminate java process
> manually from Eclipse"
> Please do clarify my error.
> Is there a right solution to get the code coverage for Android
> applications...?
I as well am looking to understand how o build an emma instrumented test.
I am unable to find any information on EMMA through SDK or through the web.
Maybe the three of us can pool our resources and keep this thread alive to
a.) get noticed, b.) get some code coverage.
For those catching on:
http://emma.sourceforge.net/intro.html is the place to download EMMA (I
assume). It may also be included in the SDK, I haven't verified this. It may
need to be modified to run with Android?
The command lines above work for me, but no files are generated. I have
added EMMA to the build path.
Has anyone had any luck yet? I've also considered Clover as an alternative
to generating reports, but I have no progress there either.
> 1. did you download and set classpath for emma.jar?
> 2. after that, you could get coverage.ec file.
> But it's not right file for coverage report in my test. Perhaps other
> things need to be done.
> currently I don't know how to get an emma instrumented build, which is
> needed for coverage test.
> On 5月8日, 下午7时19分, Deeps <L.Prade...@gmail.com> wrote:
> > I had been surfing for the past one month on this Code coverage. But
> > its disappointing that there is no clear documentation on using EMMA
> > code coverage for Android.
> > case 1: I am trying to execute from Command prompt.
> > I have sucessfully implemented instrumentation class for my
> > application. I would like to go for code coverage. I executed the
> > following command in the cmd line:
> > Also i have configured to run with sdcard.. I could see that all my
> > test cases are executed but no coverage file is generated at '/
> > sdcard'.
> > case 2: I am trying to execute from eclipse.
> > When i did all coverage configuration settings and try to run the
> > application, it pops up a message saying,
> > " No coverage data file has been written during this coverage session.
> > Please make sure that your application does NOT include EMMA run time
> > libraries or EMMA configurations.Do not terminate java process
> > manually from Eclipse"
> > Please do clarify my error.
> > Is there a right solution to get the code coverage for Android
> > applications...?
I don't know if this thread is still active, but I spent some hours
trying to make the EMMA instrumented code generation works.
I actually came pretty close of getting it, I think. You can use the
EMMA_INSTRUMENT:=true on the project Android.mk file to turn on the
EMMA instrumentation for that project. Everything seems to work, but
at the end I get a bizarre error on Calendar Tests:
target Java: Calendar (out/target/common/obj/APPS/
Calendar_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
EMMA: processing instrumentation path ...
EMMA: instrumentation path processed in 703 ms
EMMA: [119 class(es) instrumented, 11 resource(s) copied]
EMMA: metadata merged into [/work/android3/out/target/common/obj/APPS/
Calendar_intermediates/coverage.em] {in 51 ms}
Copying: out/target/common/obj/APPS/Calendar_intermediates/classes.jar
target Dex: Calendar
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.code.SimException: local variable type mismatch:
attempt to set or access a value of type java.lang.String[] using a
local variable of type java.lang.String. This is symptomatic of .class
transformation tools that ignore local variable information.
at com.android.dx.cf.code.BaseMachine.throwLocalMismatch
(BaseMachine.java:537)
at com.android.dx.cf.code.BaseMachine.getLocalTarget(BaseMachine.java:
392)
at com.android.dx.cf.code.BaseMachine.storeResults(BaseMachine.java:
519)
at com.android.dx.cf.code.ValueAwareMachine.run
(ValueAwareMachine.java:196)
at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:290)
at com.android.dx.cf.code.Simulator$SimVisitor.visitLocal
(Simulator.java:542)
at com.android.dx.cf.code.BytecodeArray.parseInstruction
(BytecodeArray.java:472)
at com.android.dx.cf.code.Simulator.simulate(Simulator.java:96)
at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:681)
at com.android.dx.cf.code.Ropper.doit(Ropper.java:636)
at com.android.dx.cf.code.Ropper.convert(Ropper.java:253)
at com.android.dx.dex.cf.CfTranslator.processMethods
(CfTranslator.java:252)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:
131)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85)
at com.android.dx.command.dexer.Main.processClass(Main.java:297)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:276)
at com.android.dx.command.dexer.Main.access$100(Main.java:56)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:
228)
at com.android.dx.cf.direct.ClassPathOpener.processArchive
(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne
(ClassPathOpener.java:130)
at com.android.dx.cf.direct.ClassPathOpener.process
(ClassPathOpener.java:108)
at com.android.dx.command.dexer.Main.processOne(Main.java:245)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
at com.android.dx.command.dexer.Main.run(Main.java:139)
at com.android.dx.command.dexer.Main.main(Main.java:120)
at com.android.dx.command.Main.main(Main.java:87)
...at bytecode offset 000000b7
locals[0000]: Lcom/google/android/googleapps/IGoogleLoginService$Stub;
locals[0001]: I
locals[0002]: Landroid/os/Parcel;
locals[0003]: Landroid/os/Parcel;
locals[0004]: I
locals[0005]: <invalid>
locals[0006]: <invalid>
locals[0007]: <invalid>
locals[0008]: <invalid>
locals[0009]: [Z
...while working on block 00b7
...while working on method onTransact:(ILandroid/os/Parcel;Landroid/os/
Parcel;I)Z
...while processing onTransact (ILandroid/os/Parcel;Landroid/os/
Parcel;I)Z
...while processing com/google/android/googleapps/IGoogleLoginService
$Stub.class
1 error; aborting
Really strange error. I'll keep trying to find out how to fix this.
Thanks
Felipe
On May 11, 9:00 pm, Richard Cook <richardgc...@gmail.com> wrote:
> I as well am looking to understand how o build an emma instrumented test.
> I am unable to find any information on EMMA through SDK or through the web.
> Maybe the three of us can pool our resources and keep this thread alive to
> a.) get noticed, b.) get some code coverage.
> For those catching on:http://emma.sourceforge.net/intro.htmlis the place to download EMMA (I
> assume). It may also be included in the SDK, I haven't verified this. It may
> need to be modified to run with Android?
> The command lines above work for me, but no files are generated. I have
> added EMMA to the build path.
> Has anyone had any luck yet? I've also considered Clover as an alternative
> to generating reports, but I have no progress there either.
> > 1. did you download and set classpath for emma.jar?
> > 2. after that, you could get coverage.ec file.
> > But it's not right file for coverage report in my test. Perhaps other
> > things need to be done.
> > currently I don't know how to get an emma instrumented build, which is
> > needed for coverage test.
> > On 5月8日, 下午7时19分, Deeps <L.Prade...@gmail.com> wrote:
> > > I had been surfing for the past one month on this Code coverage. But
> > > its disappointing that there is no clear documentation on using EMMA
> > > code coverage for Android.
> > > case 1: I am trying to execute from Command prompt.
> > > I have sucessfully implemented instrumentation class for my
> > > application. I would like to go for code coverage. I executed the
> > > following command in the cmd line:
> > > Also i have configured to run with sdcard.. I could see that all my
> > > test cases are executed but no coverage file is generated at '/
> > > sdcard'.
> > > case 2: I am trying to execute from eclipse.
> > > When i did all coverage configuration settings and try to run the
> > > application, it pops up a message saying,
> > > " No coverage data file has been written during this coverage session.
> > > Please make sure that your application does NOT include EMMA run time
> > > libraries or EMMA configurations.Do not terminate java process
> > > manually from Eclipse"
> > > Please do clarify my error.
> > > Is there a right solution to get the code coverage for Android
> > > applications...?
I discovered a way of getting the android code instrumented, using the
full source from google.
On the project Android.mk I added the line EMMA_INSTRUMENT:=true and
voilá, it instrumented the code. Now I'm facing problems to run the
instrumented code. Although emma.jar is inside the image and installed
correctly during emulator startup, I keep getting errors that indicate
that Android is not being able to find the classes provided by emma. I
tried to force the usage of emma library by adding on the test
manifest <uses-library android:name="emma" /> but if I do that, it
does not allow me to install the test application because Android
thinks that emma library is missing.
Does anyone have any ideas that I could try to fix this problem. I
really think I'm near of solving this puzzle, but I could not find the
last part yet.
On May 11, 9:00 pm, Richard Cook <richardgc...@gmail.com> wrote:
> I as well am looking to understand how o build an emma instrumented test.
> I am unable to find any information on EMMA through SDK or through the web.
> Maybe the three of us can pool our resources and keep this thread alive to
> a.) get noticed, b.) get some code coverage.
> For those catching on:http://emma.sourceforge.net/intro.htmlis the place to download EMMA (I
> assume). It may also be included in the SDK, I haven't verified this. It may
> need to be modified to run with Android?
> The command lines above work for me, but no files are generated. I have
> added EMMA to the build path.
> Has anyone had any luck yet? I've also considered Clover as an alternative
> to generating reports, but I have no progress there either.
> > 1. did you download and set classpath for emma.jar?
> > 2. after that, you could get coverage.ec file.
> > But it's not right file for coverage report in my test. Perhaps other
> > things need to be done.
> > currently I don't know how to get an emma instrumented build, which is
> > needed for coverage test.
> > On 5月8日, 下午7时19分, Deeps <L.Prade...@gmail.com> wrote:
> > > I had been surfing for the past one month on this Code coverage. But
> > > its disappointing that there is no clear documentation on using EMMA
> > > code coverage for Android.
> > > case 1: I am trying to execute from Command prompt.
> > > I have sucessfully implemented instrumentation class for my
> > > application. I would like to go for code coverage. I executed the
> > > following command in the cmd line:
> > > Also i have configured to run with sdcard.. I could see that all my
> > > test cases are executed but no coverage file is generated at '/
> > > sdcard'.
> > > case 2: I am trying to execute from eclipse.
> > > When i did all coverage configuration settings and try to run the
> > > application, it pops up a message saying,
> > > " No coverage data file has been written during this coverage session.
> > > Please make sure that your application does NOT include EMMA run time
> > > libraries or EMMA configurations.Do not terminate java process
> > > manually from Eclipse"
> > > Please do clarify my error.
> > > Is there a right solution to get the code coverage for Android
> > > applications...?
I'm stuck on the point where I need to run the instrumented tests on
the emulator. I could not find a way yet to make the emulator believe
that the emma.jar is already installed on it.
Also, I don't know if there is a way of enabling EMMA instrumentation
using the SDK. I have not tried that yet. I'm using the android full
source, compiling it from scratch. I think I'm close, at least to run
it on the emulator, but on this past week I was too busy and could not
investigate more about this issue. I'm planning to put everything I
know on a blog or something like that, at least to help the other
developers that are trying to make EMMA work on Android, since I could
not find relevant references on this matter from the Google guys.
I'll send later a step by step of what I made up to now... I'm
currently at my job, so I don't have much time to write right now.
BR
Felipe
On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
Atlast i am half way through in getting the coverage file. But..I dont
see any required output in that file.
I created a sdcard. Then i run my Instrumentation with the following
command,
# am instrument -e coverage true -w com.app.exam.tests/
android.test.InstrumentationTestRunner
First I got error, Is EMMA jar included.
So, i added the amma.jar in the build path. Again I ran the same
command. Then, I found a coverage file , "coverage.ec" while
navigating thro file explorer of ddms. I pulled it to the desktop and
imported the session to Coverage field in eclipse.
Its unfortunate that I dont see any code coverage but i could see only
the number of instructions.Even though my test cases has run and the
results has displayed, I am getting 0.0% code coverage..
Can u please try this and share ur experience..
Deeps
On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> I'm stuck on the point where I need to run the instrumented tests on
> the emulator. I could not find a way yet to make the emulator believe
> that theemma.jar is already installed on it.
> Also, I don't know if there is a way of enablingEMMAinstrumentation
> using the SDK. I have not tried that yet. I'm using theandroidfull
> source, compiling it from scratch. I think I'm close, at least to run
> it on the emulator, but on this past week I was too busy and could not
> investigate more about this issue. I'm planning to put everything I
> know on a blog or something like that, at least to help the other
> developers that are trying to makeEMMAwork onAndroid, since I could
> not find relevant references on this matter from the Google guys.
> I'll send later a step by step of what I made up to now... I'm
> currently at my job, so I don't have much time to write right now.
> BR
> Felipe
> On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
> > Felipe Ramos,
> > Did u end up somewhere..? I am not able to go ahead with this......
Hi Deeps,
Nice to hear that you are making progress. Are you using only the SDK, or
are you building the entire android source code? Maybe your code is not
instrumented to generate the coverage statistics and this would be why you
are getting 0% of code coverage. Are you using the emma.jar provided on the
Emma site, or the one built in Android source code??
I'll try to reproduce what you have done up to now here. I hope we can
manage to get a final solution for this matter.
BR
Felipe
On Tue, May 26, 2009 at 3:26 AM, Deeps <L.Prade...@gmail.com> wrote:
> Felipe,
> Atlast i am half way through in getting the coverage file. But..I dont
> see any required output in that file.
> I created a sdcard. Then i run my Instrumentation with the following
> command,
> # am instrument -e coverage true -w com.app.exam.tests/
> android.test.InstrumentationTestRunner
> First I got error, Is EMMA jar included.
> So, i added the amma.jar in the build path. Again I ran the same
> command. Then, I found a coverage file , "coverage.ec" while
> navigating thro file explorer of ddms. I pulled it to the desktop and
> imported the session to Coverage field in eclipse.
> Its unfortunate that I dont see any code coverage but i could see only
> the number of instructions.Even though my test cases has run and the
> results has displayed, I am getting 0.0% code coverage..
> Can u please try this and share ur experience..
> Deeps
> On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > Hi deeps,
> > I'm stuck on the point where I need to run the instrumented tests on
> > the emulator. I could not find a way yet to make the emulator believe
> > that theemma.jar is already installed on it.
> > Also, I don't know if there is a way of enablingEMMAinstrumentation
> > using the SDK. I have not tried that yet. I'm using theandroidfull
> > source, compiling it from scratch. I think I'm close, at least to run
> > it on the emulator, but on this past week I was too busy and could not
> > investigate more about this issue. I'm planning to put everything I
> > know on a blog or something like that, at least to help the other
> > developers that are trying to makeEMMAwork onAndroid, since I could
> > not find relevant references on this matter from the Google guys.
> > I'll send later a step by step of what I made up to now... I'm
> > currently at my job, so I don't have much time to write right now.
> > BR
> > Felipe
> > On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
> > > Felipe Ramos,
> > > Did u end up somewhere..? I am not able to go ahead with this......
Yeah..I have included emma.jar in the build path of my application.
I have the android latest release 1.5 sdk.. However, my application
has 1.1 target. I tried using Android JUnit and found all my test
cases are executed.
And also throu command prompt i followed the syntax mentioned in the
earlier post..
Still coverage is 0.0% but i could see the no of instructions. Will
there be a solution?
Thanks
Deeps
On May 27, 5:33 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> Hi Deeps,
> Nice to hear that you are making progress. Are you using only the SDK, or
> are you building the entire android source code? Maybe your code is not
> instrumented to generate the coverage statistics and this would be why you
> are getting 0% of code coverage. Are you using the emma.jar provided on the
> Emma site, or the one built in Android source code??
> I'll try to reproduce what you have done up to now here. I hope we can
> manage to get a final solution for this matter.
> BR
> Felipe
> On Tue, May 26, 2009 at 3:26 AM, Deeps <L.Prade...@gmail.com> wrote:
> > Felipe,
> > Atlast i am half way through in getting the coverage file. But..I dont
> > see any required output in that file.
> > I created a sdcard. Then i run my Instrumentation with the following
> > command,
> > # am instrument -e coverage true -w com.app.exam.tests/
> > android.test.InstrumentationTestRunner
> > First I got error, Is EMMA jar included.
> > So, i added the amma.jar in the build path. Again I ran the same
> > command. Then, I found a coverage file , "coverage.ec" while
> > navigating thro file explorer of ddms. I pulled it to the desktop and
> > imported the session to Coverage field in eclipse.
> > Its unfortunate that I dont see any code coverage but i could see only
> > the number of instructions.Even though my test cases has run and the
> > results has displayed, I am getting 0.0% code coverage..
> > Can u please try this and share ur experience..
> > Deeps
> > On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > > Hi deeps,
> > > I'm stuck on the point where I need to run the instrumented tests on
> > > the emulator. I could not find a way yet to make the emulator believe
> > > that theemma.jar is already installed on it.
> > > Also, I don't know if there is a way of enablingEMMAinstrumentation
> > > using the SDK. I have not tried that yet. I'm using theandroidfull
> > > source, compiling it from scratch. I think I'm close, at least to run
> > > it on the emulator, but on this past week I was too busy and could not
> > > investigate more about this issue. I'm planning to put everything I
> > > know on a blog or something like that, at least to help the other
> > > developers that are trying to makeEMMAwork onAndroid, since I could
> > > not find relevant references on this matter from the Google guys.
> > > I'll send later a step by step of what I made up to now... I'm
> > > currently at my job, so I don't have much time to write right now.
> > > BR
> > > Felipe
> > > On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
> > > > Felipe Ramos,
> > > > Did u end up somewhere..? I am not able to go ahead with this......
Its great to see people interested in EMMA code coverage on Android.
However, note that EMMA code coverage support on Android is currently quite
preliminary. Its not supported from within the SDK yet. The support that is
in place is for apps and tests that are part of the android source tree.
That being said, if you still want to give it a try, download the android
source for cupcake, do a full build, and give the instructions below a try.
There are a couple helper scripts that have been created which will
hopefully make this a bit easier.
1. Generating code coverage for your own tests using runtest script
First, you need to add the target system/framework/emma.jar to the device's
boot classpath. Modify the BOOTCLASSPATH variable in
/system/core/rootdir/init.rc. The system/framework/emma.jar entry needs to
be added in the exact position shown below:
Rebuild the bootimage to pick up the init.rc changes:
make bootimage
Start an emulator with a simulated sdcard:
emulator -sdcard <path to sdcard.img>&
Note that the emulator will not fully boot up at this point since the
emma.jar file is not present yet.
Next, use the runtest.py script. Runtest will do all the necessary steps to
instrument your test and target package, run the test, and generate the code
coverage report.
When testing on the emulator, you must launch the emulator with a simulated
sdcard (-sdcard option), as code coverage results are stored to the sdcard.
To use runtest_py, the test must be defined in
development/testrunner/test_defs.xml.
To generate code coverage results, the test must have a "coverage_target"
attribute, which must refer to a target defined in
development/testrunner/coverage_targets.xml
2. Generating code coverage for your own tests - The Hard Way
The following steps will use apidemos tests as an example, and will assume
the current working path is the android build root.
Modify the targets BOOTCLASSPATH as described in the preceding section.
Before doing a build, set
export EMMA_INSTRUMENT=true
This instructs the build system to add the necessary emma instrumentation
to the generated bytecode.
mmm development/samples/ApiDemos
Pass in a '-e coverage true' argument to adb shell am instrument when
executing tests.
adb shell am instrument -w -e coverage true
com.example.android.apis.tests/android.test.InstrumentationTestRunner
This command will dump a runtime coverage data file at
/sdcard/coverage.econ the device. Extract it to local host
adb pull /sdcard/coverage.ec coverage.ec
Now generate a coverage report. You'll need to pass in the path to the
coverage metadata generated at build time.
java -cp external/emma/lib/emma.jar emma report -r html -in
coverage.ec -sp development/samples/ApiDemos/src -in
out/target/common/obj/APPS/ApiDemos_intermediates/coverage.em
On Wed, May 27, 2009 at 9:25 PM, Deeps <L.Prade...@gmail.com> wrote:
> Thanks a lot Felipe.
> Yeah..I have included emma.jar in the build path of my application.
> I have the android latest release 1.5 sdk.. However, my application
> has 1.1 target. I tried using Android JUnit and found all my test
> cases are executed.
> And also throu command prompt i followed the syntax mentioned in the
> earlier post..
> Still coverage is 0.0% but i could see the no of instructions. Will
> there be a solution?
> Thanks
> Deeps
> On May 27, 5:33 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > Hi Deeps,
> > Nice to hear that you are making progress. Are you using only the SDK, or
> > are you building the entire android source code? Maybe your code is not
> > instrumented to generate the coverage statistics and this would be why
> you
> > are getting 0% of code coverage. Are you using the emma.jar provided on
> the
> > Emma site, or the one built in Android source code??
> > I'll try to reproduce what you have done up to now here. I hope we can
> > manage to get a final solution for this matter.
> > BR
> > Felipe
> > On Tue, May 26, 2009 at 3:26 AM, Deeps <L.Prade...@gmail.com> wrote:
> > > Felipe,
> > > Atlast i am half way through in getting the coverage file. But..I dont
> > > see any required output in that file.
> > > I created a sdcard. Then i run my Instrumentation with the following
> > > command,
> > > # am instrument -e coverage true -w com.app.exam.tests/
> > > android.test.InstrumentationTestRunner
> > > First I got error, Is EMMA jar included.
> > > So, i added the amma.jar in the build path. Again I ran the same
> > > command. Then, I found a coverage file , "coverage.ec" while
> > > navigating thro file explorer of ddms. I pulled it to the desktop and
> > > imported the session to Coverage field in eclipse.
> > > Its unfortunate that I dont see any code coverage but i could see only
> > > the number of instructions.Even though my test cases has run and the
> > > results has displayed, I am getting 0.0% code coverage..
> > > Can u please try this and share ur experience..
> > > Deeps
> > > On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > > > Hi deeps,
> > > > I'm stuck on the point where I need to run the instrumented tests on
> > > > the emulator. I could not find a way yet to make the emulator believe
> > > > that theemma.jar is already installed on it.
> > > > Also, I don't know if there is a way of enablingEMMAinstrumentation
> > > > using the SDK. I have not tried that yet. I'm using theandroidfull
> > > > source, compiling it from scratch. I think I'm close, at least to run
> > > > it on the emulator, but on this past week I was too busy and could
> not
> > > > investigate more about this issue. I'm planning to put everything I
> > > > know on a blog or something like that, at least to help the other
> > > > developers that are trying to makeEMMAwork onAndroid, since I could
> > > > not find relevant references on this matter from the Google guys.
> > > > I'll send later a step by step of what I made up to now... I'm
> > > > currently at my job, so I don't have much time to write right now.
> > > > BR
> > > > Felipe
> > > > On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
> > > > > Felipe Ramos,
> > > > > Did u end up somewhere..? I am not able to go ahead with this......
Hi Brett,
Thanks a lot for all the info provided!!! I was missing some of the steps
you mentioned, that is why it was not working well over here. Even knowing
that the EMMA support is quite preliminary, I will certainly give it a try.
UT + code coverage are really important to help us obtain better and more
stable code. Thanks again!
Best Regards
Felipe
On Thu, May 28, 2009 at 5:09 PM, Brett Chabot <brettcha...@android.com>wrote:
> Its great to see people interested in EMMA code coverage on Android.
> However, note that EMMA code coverage support on Android is currently quite
> preliminary. Its not supported from within the SDK yet. The support that is
> in place is for apps and tests that are part of the android source tree.
> That being said, if you still want to give it a try, download the android
> source for cupcake, do a full build, and give the instructions below a try.
> There are a couple helper scripts that have been created which will
> hopefully make this a bit easier.
> 1. Generating code coverage for your own tests using runtest script
> First, you need to add the target system/framework/emma.jar to the
> device's boot classpath. Modify the BOOTCLASSPATH variable in
> /system/core/rootdir/init.rc. The system/framework/emma.jar entry needs to
> be added in the exact position shown below:
> Rebuild the bootimage to pick up the init.rc changes:
> make bootimage
> Start an emulator with a simulated sdcard:
> emulator -sdcard <path to sdcard.img>&
> Note that the emulator will not fully boot up at this point since the
> emma.jar file is not present yet.
> Next, use the runtest.py script. Runtest will do all the necessary steps
> to instrument your test and target package, run the test, and generate the
> code coverage report.
> When testing on the emulator, you must launch the emulator with a
> simulated sdcard (-sdcard option), as code coverage results are stored to
> the sdcard. To use runtest_py, the test must be defined in development/testrunner/test_defs.xml.
> To generate code coverage results, the test must have a "coverage_target"
> attribute, which must refer to a target defined in
> development/testrunner/coverage_targets.xml
> 2. Generating code coverage for your own tests - The Hard Way
> The following steps will use apidemos tests as an example, and will assume
> the current working path is the android build root.
> Modify the targets BOOTCLASSPATH as described in the preceding section.
> Before doing a build, set
> export EMMA_INSTRUMENT=true
> This instructs the build system to add the necessary emma instrumentation
> to the generated bytecode.
> mmm development/samples/ApiDemos
> Pass in a '-e coverage true' argument to adb shell am instrument when
> executing tests.
> adb shell am instrument -w -e coverage true com.example.android.apis.tests/android.test.InstrumentationTestRunner
> This command will dump a runtime coverage data file at /sdcard/coverage.econ the device. Extract it to local host
> adb pull /sdcard/coverage.ec coverage.ec
> Now generate a coverage report. You'll need to pass in the path to the
> coverage metadata generated at build time.
> java -cp external/emma/lib/emma.jar emma report -r html -in coverage.ec -sp development/samples/ApiDemos/src -in out/target/common/obj/APPS/ApiDemos_intermediates/coverage.em
> I hope this helps.
> Regards,
> Brett.
> On Wed, May 27, 2009 at 9:25 PM, Deeps <L.Prade...@gmail.com> wrote:
>> Thanks a lot Felipe.
>> Yeah..I have included emma.jar in the build path of my application.
>> I have the android latest release 1.5 sdk.. However, my application
>> has 1.1 target. I tried using Android JUnit and found all my test
>> cases are executed.
>> And also throu command prompt i followed the syntax mentioned in the
>> earlier post..
>> Still coverage is 0.0% but i could see the no of instructions. Will
>> there be a solution?
>> Thanks
>> Deeps
>> On May 27, 5:33 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
>> > Hi Deeps,
>> > Nice to hear that you are making progress. Are you using only the SDK,
>> or
>> > are you building the entire android source code? Maybe your code is not
>> > instrumented to generate the coverage statistics and this would be why
>> you
>> > are getting 0% of code coverage. Are you using the emma.jar provided on
>> the
>> > Emma site, or the one built in Android source code??
>> > I'll try to reproduce what you have done up to now here. I hope we can
>> > manage to get a final solution for this matter.
>> > BR
>> > Felipe
>> > On Tue, May 26, 2009 at 3:26 AM, Deeps <L.Prade...@gmail.com> wrote:
>> > > Felipe,
>> > > Atlast i am half way through in getting the coverage file. But..I dont
>> > > see any required output in that file.
>> > > I created a sdcard. Then i run my Instrumentation with the following
>> > > command,
>> > > # am instrument -e coverage true -w com.app.exam.tests/
>> > > android.test.InstrumentationTestRunner
>> > > First I got error, Is EMMA jar included.
>> > > So, i added the amma.jar in the build path. Again I ran the same
>> > > command. Then, I found a coverage file , "coverage.ec" while
>> > > navigating thro file explorer of ddms. I pulled it to the desktop and
>> > > imported the session to Coverage field in eclipse.
>> > > Its unfortunate that I dont see any code coverage but i could see only
>> > > the number of instructions.Even though my test cases has run and the
>> > > results has displayed, I am getting 0.0% code coverage..
>> > > Can u please try this and share ur experience..
>> > > Deeps
>> > > On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
>> > > > Hi deeps,
>> > > > I'm stuck on the point where I need to run the instrumented tests on
>> > > > the emulator. I could not find a way yet to make the emulator
>> believe
>> > > > that theemma.jar is already installed on it.
>> > > > Also, I don't know if there is a way of enablingEMMAinstrumentation
>> > > > using the SDK. I have not tried that yet. I'm using theandroidfull
>> > > > source, compiling it from scratch. I think I'm close, at least to
>> run
>> > > > it on the emulator, but on this past week I was too busy and could
>> not
>> > > > investigate more about this issue. I'm planning to put everything I
>> > > > know on a blog or something like that, at least to help the other
>> > > > developers that are trying to makeEMMAwork onAndroid, since I could
>> > > > not find relevant references on this matter from the Google guys.
>> > > > I'll send later a step by step of what I made up to now... I'm
>> > > > currently at my job, so I don't have much time to write right now.
>> > > > BR
>> > > > Felipe
>> > > > On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
>> > > > > Felipe Ramos,
>> > > > > Did u end up somewhere..? I am not able to go ahead with
>> this......
Brett
first of all thanks for all the information on Emma coverage.
I have written my own instrument testcase for Setting app and added
these to /packages/apps/Settings/tests/
with export EMMA_INSTRUEMNT=true;and mmm packages/apps/Setting
coverage.em,Settings.apk,SettingsTests.apk are generated.
But when i do adb shell am instrument -w -e coverage true
com.android.settings.tests/android.test.InstruementationTestRunner
all the tests are performed on emulator but its giving error Error:
Failed to generate emma coverage.
i was able to generate reports for all apps that come with build
(apidemos,Calculator etc).
Is it possible to generate coverage through the tests that wont come
with android.If so what am i missing?
Are there any suggested solutions?
Any help is really appreciated.
thanks and regards
haritha
On May 28, 1:09 pm, Brett Chabot <brettcha...@android.com> wrote:
> Its great to see people interested in EMMA code coverage on Android.
> However, note that EMMA code coverage support on Android is currently quite
> preliminary. Its not supported from within the SDK yet. The support that is
> in place is for apps and tests that are part of the android source tree.
> That being said, if you still want to give it a try, download the android
> source for cupcake, do a full build, and give the instructions below a try.
> There are a couple helper scripts that have been created which will
> hopefully make this a bit easier.
> 1. Generating code coverage for your own tests using runtest script
> First, you need to add the target system/framework/emma.jar to the device's
> boot classpath. Modify the BOOTCLASSPATH variable in
> /system/core/rootdir/init.rc. The system/framework/emma.jar entry needs to
> be added in the exact position shown below:
> Rebuild the bootimage to pick up the init.rc changes:
> make bootimage
> Start an emulator with a simulated sdcard:
> emulator -sdcard <path to sdcard.img>&
> Note that the emulator will not fully boot up at this point since the
> emma.jar file is not present yet.
> Next, use the runtest.py script. Runtest will do all the necessary steps to
> instrument your test and target package, run the test, and generate the code
> coverage report.
> When testing on the emulator, you must launch the emulator with a simulated
> sdcard (-sdcard option), as code coverage results are stored to the sdcard.
> To use runtest_py, the test must be defined in
> development/testrunner/test_defs.xml.
> To generate code coverage results, the test must have a "coverage_target"
> attribute, which must refer to a target defined in
> development/testrunner/coverage_targets.xml
> 2. Generating code coverage for your own tests - The Hard Way
> The following steps will use apidemos tests as an example, and will assume
> the current working path is the android build root.
> Modify the targets BOOTCLASSPATH as described in the preceding section.
> Before doing a build, set
> export EMMA_INSTRUMENT=true
> This instructs the build system to add the necessary emma instrumentation
> to the generated bytecode.
> mmm development/samples/ApiDemos
> Pass in a '-e coverage true' argument to adb shell am instrument when
> executing tests.
> This command will dump a runtime coverage data file at
> /sdcard/coverage.econ the device. Extract it to local host
> adb pull /sdcard/coverage.ec coverage.ec
> Now generate a coverage report. You'll need to pass in the path to the
> coverage metadata generated at build time.
> java -cp external/emma/lib/emma.jar emma report -r html -in
> coverage.ec -sp development/samples/ApiDemos/src -in
> out/target/common/obj/APPS/ApiDemos_intermediates/coverage.em
> I hope this helps.
> Regards,
> Brett.
> On Wed, May 27, 2009 at 9:25 PM, Deeps <L.Prade...@gmail.com> wrote:
> > Thanks a lot Felipe.
> > Yeah..I have included emma.jar in the build path of my application.
> > I have the android latest release 1.5 sdk.. However, my application
> > has 1.1 target. I tried using Android JUnit and found all my test
> > cases are executed.
> > And also throu command prompt i followed the syntax mentioned in the
> > earlier post..
> > Still coverage is 0.0% but i could see the no of instructions. Will
> > there be a solution?
> > Thanks
> > Deeps
> > On May 27, 5:33 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > > Hi Deeps,
> > > Nice to hear that you are making progress. Are you using only the SDK, or
> > > are you building the entire android source code? Maybe your code is not
> > > instrumented to generate the coverage statistics and this would be why
> > you
> > > are getting 0% of code coverage. Are you using the emma.jar provided on
> > the
> > > Emma site, or the one built in Android source code??
> > > I'll try to reproduce what you have done up to now here. I hope we can
> > > manage to get a final solution for this matter.
> > > BR
> > > Felipe
> > > On Tue, May 26, 2009 at 3:26 AM, Deeps <L.Prade...@gmail.com> wrote:
> > > > Felipe,
> > > > Atlast i am half way through in getting the coverage file. But..I dont
> > > > see any required output in that file.
> > > > I created a sdcard. Then i run my Instrumentation with the following
> > > > command,
> > > > # am instrument -e coverage true -w com.app.exam.tests/
> > > > android.test.InstrumentationTestRunner
> > > > First I got error, Is EMMA jar included.
> > > > So, i added the amma.jar in the build path. Again I ran the same
> > > > command. Then, I found a coverage file , "coverage.ec" while
> > > > navigating thro file explorer of ddms. I pulled it to the desktop and
> > > > imported the session to Coverage field in eclipse.
> > > > Its unfortunate that I dont see any code coverage but i could see only
> > > > the number of instructions.Even though my test cases has run and the
> > > > results has displayed, I am getting 0.0% code coverage..
> > > > Can u please try this and share ur experience..
> > > > Deeps
> > > > On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > > > > Hi deeps,
> > > > > I'm stuck on the point where I need to run the instrumented tests on
> > > > > the emulator. I could not find a way yet to make the emulator believe
> > > > > that theemma.jar is already installed on it.
> > > > > Also, I don't know if there is a way of enablingEMMAinstrumentation
> > > > > using the SDK. I have not tried that yet. I'm using theandroidfull
> > > > > source, compiling it from scratch. I think I'm close, at least to run
> > > > > it on the emulator, but on this past week I was too busy and could
> > not
> > > > > investigate more about this issue. I'm planning to put everything I
> > > > > know on a blog or something like that, at least to help the other
> > > > > developers that are trying to makeEMMAwork onAndroid, since I could
> > > > > not find relevant references on this matter from the Google guys.
> > > > > I'll send later a step by step of what I made up to now... I'm
> > > > > currently at my job, so I don't have much time to write right now.
> > > > > BR
> > > > > Felipe
> > > > > On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
> > > > > > Felipe Ramos,
> > > > > > Did u end up somewhere..? I am not able to go ahead with this......
> > > > > > deeps- Hide quoted text -
> > > > > - Show quoted text -- Hide quoted text -
> Brett
> first of all thanks for all the information on Emma coverage.
> I have written my own instrument testcase for Setting app and added
> these to /packages/apps/Settings/tests/
> with export EMMA_INSTRUEMNT=true;and mmm packages/apps/Setting
> coverage.em,Settings.apk,SettingsTests.apk are generated.
> But when i do adb shell am instrument -w -e coverage true
> com.android.settings.tests/android.test.InstruementationTestRunner
> all the tests are performed on emulator but its giving error Error:
> Failed to generate emma coverage.
> i was able to generate reports for all apps that come with build
> (apidemos,Calculator etc).
> Is it possible to generate coverage through the tests that wont come
> with android.If so what am i missing?
> Are there any suggested solutions?
> Any help is really appreciated.
> thanks and regards
> haritha
> On May 28, 1:09 pm, Brett Chabot <brettcha...@android.com> wrote:
> > + android-platform
> > Its great to see people interested in EMMA code coverage on Android.
> > However, note that EMMA code coverage support on Android is currently quite
> > preliminary. Its not supported from within the SDK yet. The support that is
> > in place is for apps and tests that are part of the android source tree.
> > That being said, if you still want to give it a try, download the android
> > source for cupcake, do a full build, and give the instructions below a try.
> > There are a couple helper scripts that have been created which will
> > hopefully make this a bit easier.
> > 1. Generating code coverage for your own tests using runtest script
> > First, you need to add the target system/framework/emma.jar to the device's
> > boot classpath. Modify the BOOTCLASSPATH variable in
> > /system/core/rootdir/init.rc. The system/framework/emma.jar entry needs to
> > be added in the exact position shown below:
> > Rebuild the bootimage to pick up the init.rc changes:
> > make bootimage
> > Start an emulator with a simulated sdcard:
> > emulator -sdcard <path to sdcard.img>&
> > Note that the emulator will not fully boot up at this point since the
> > emma.jar file is not present yet.
> > Next, use the runtest.py script. Runtest will do all the necessary steps to
> > instrument your test and target package, run the test, and generate the code
> > coverage report.
> > When testing on the emulator, you must launch the emulator with a simulated
> > sdcard (-sdcard option), as code coverage results are stored to the sdcard.
> > To use runtest_py, the test must be defined in
> > development/testrunner/test_defs.xml.
> > To generate code coverage results, the test must have a "coverage_target"
> > attribute, which must refer to a target defined in
> > development/testrunner/coverage_targets.xml
> > 2. Generating code coverage for your own tests - The Hard Way
> > The following steps will use apidemos tests as an example, and will assume
> > the current working path is the android build root.
> > Modify the targets BOOTCLASSPATH as described in the preceding section.
> > Before doing a build, set
> > export EMMA_INSTRUMENT=true
> > This instructs the build system to add the necessary emma instrumentation
> > to the generated bytecode.
> > mmm development/samples/ApiDemos
> > Pass in a '-e coverage true' argument to adb shell am instrument when
> > executing tests.
> > This command will dump a runtime coverage data file at
> > /sdcard/coverage.econ the device. Extract it to local host
> > adb pull /sdcard/coverage.ec coverage.ec
> > Now generate a coverage report. You'll need to pass in the path to the
> > coverage metadata generated at build time.
> > java -cp external/emma/lib/emma.jar emma report -r html -in
> > coverage.ec -sp development/samples/ApiDemos/src -in
> > out/target/common/obj/APPS/ApiDemos_intermediates/coverage.em
> > I hope this helps.
> > Regards,
> > Brett.
> > On Wed, May 27, 2009 at 9:25 PM, Deeps <L.Prade...@gmail.com> wrote:
> > > Thanks a lot Felipe.
> > > Yeah..I have included emma.jar in the build path of my application.
> > > I have the android latest release 1.5 sdk.. However, my application
> > > has 1.1 target. I tried using Android JUnit and found all my test
> > > cases are executed.
> > > And also throu command prompt i followed the syntax mentioned in the
> > > earlier post..
> > > Still coverage is 0.0% but i could see the no of instructions. Will
> > > there be a solution?
> > > Thanks
> > > Deeps
> > > On May 27, 5:33 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > > > Hi Deeps,
> > > > Nice to hear that you are making progress. Are you using only the SDK, or
> > > > are you building the entire android source code? Maybe your code is not
> > > > instrumented to generate the coverage statistics and this would be why
> > > you
> > > > are getting 0% of code coverage. Are you using the emma.jar provided on
> > > the
> > > > Emma site, or the one built in Android source code??
> > > > I'll try to reproduce what you have done up to now here. I hope we can
> > > > manage to get a final solution for this matter.
> > > > BR
> > > > Felipe
> > > > On Tue, May 26, 2009 at 3:26 AM, Deeps <L.Prade...@gmail.com> wrote:
> > > > > Felipe,
> > > > > Atlast i am half way through in getting the coverage file. But..I dont
> > > > > see any required output in that file.
> > > > > I created a sdcard. Then i run my Instrumentation with the following
> > > > > command,
> > > > > # am instrument -e coverage true -w com.app.exam.tests/
> > > > > android.test.InstrumentationTestRunner
> > > > > First I got error, Is EMMA jar included.
> > > > > So, i added the amma.jar in the build path. Again I ran the same
> > > > > command. Then, I found a coverage file , "coverage.ec" while
> > > > > navigating thro file explorer of ddms. I pulled it to the desktop and
> > > > > imported the session to Coverage field in eclipse.
> > > > > Its unfortunate that I dont see any code coverage but i could see only
> > > > > the number of instructions.Even though my test cases has run and the
> > > > > results has displayed, I am getting 0.0% code coverage..
> > > > > Can u please try this and share ur experience..
> > > > > Deeps
> > > > > On May 21, 9:25 pm, Felipe Ramos <felipe.wo...@gmail.com> wrote:
> > > > > > Hi deeps,
> > > > > > I'm stuck on the point where I need to run the instrumented tests on
> > > > > > the emulator. I could not find a way yet to make the emulator believe
> > > > > > that theemma.jar is already installed on it.
> > > > > > Also, I don't know if there is a way of enablingEMMAinstrumentation
> > > > > > using the SDK. I have not tried that yet. I'm using theandroidfull
> > > > > > source, compiling it from scratch. I think I'm close, at least to run
> > > > > > it on the emulator, but on this past week I was too busy and could
> > > not
> > > > > > investigate more about this issue. I'm planning to put everything I
> > > > > > know on a blog or something like that, at least to help the other
> > > > > > developers that are trying to makeEMMAwork onAndroid, since I could
> > > > > > not find relevant references on this matter from the Google guys.
> > > > > > I'll send later a step by step of what I made up to now... I'm
> > > > > > currently at my job, so I don't have much time to write right now.
> > > > > > BR
> > > > > > Felipe
> > > > > > On May 21, 10:00 am, Deeps <L.Prade...@gmail.com> wrote:
> > > > > > > Felipe Ramos,
> > > > > > > Did u end up somewhere..? I am not able to go ahead with this......
> > > > > > > deeps- Hide quoted text -
> > > > > > - Show quoted text -- Hide quoted text -
Thanks for your help. But, for me, there's something not clearly, so
that I need more supports from you.
1. Firstly, as you said,
"Before doing a build, set
export EMMA_INSTRUMENT=true"
a. Did you mean "doing a build" is building entire source code of
Android or just re-making images?
b. And, when we re-make images, do we need to make both bootimage and
system image or just do with bootimage?
c. And, after that, do we need to sync new images with the emulator? I
mean, run the command: "adb sync". or something like that?
2. Second, if I set EMMA_INSTRUMENT=true before making images or
building from source code, I always got the error with
com.android.dx.cf.code.SimException:, which is exactly mentioned in
here: http://code.google.com/p/android/issues/detail?id=3080.
So that, i can not run the EMMA coverage after that.
Do you have any solutions for this? Your help will be very appreciated
for me!
On Tue, Aug 18, 2009 at 9:16 PM, duykham<duyk...@gmail.com> wrote:
> Hi Brett,
> Thanks for your help. But, for me, there's something not clearly, so
> that I need more supports from you.
> 1. Firstly, as you said,
> "Before doing a build, set
> export EMMA_INSTRUMENT=true"
> a. Did you mean "doing a build" is building entire source code of
> Android or just re-making images?
You don't necessarily need to have EMMA_INSTRUMENT set when doing a
full build, you only need to build the packages you want to measure
with code coverage. For example, if you're interested in measuring the
coverage of ApiDemos, I'd recommend the following exact steps
# ensure emulator is NOT launched
edit init.rc to add emma.jar to the BOOTCLASSPATH as described in my
earlier mail
make bootimage # not sure this is necessary since next step will do a full build
make -j4 # to build the full system image
export EMMA_INSTRUMENT=true"
make emma # builds the emma jar itself
mmm development/samples/ApiDemos
emulator -sdcard <path to sdcard>
adb sync # just to be safe
> b. And, when we re-make images, do we need to make both bootimage and
> system image or just do with bootimage?
You only need to rebuild bootimage if you've changed init.rx
> c. And, after that, do we need to sync new images with the emulator? I
> mean, run the command: "adb sync". or something like that?
Yes
> 2. Second, if I set EMMA_INSTRUMENT=true before making images or
> building from source code, I always got the error with
> com.android.dx.cf.code.SimException:, which is exactly mentioned in
> here: http://code.google.com/p/android/issues/detail?id=3080.
I think this error only occurs when trying to build a package with
emma instrumentation, which includes a static library that has not
gone through emma instrumentation. If you try to make the static
library first with emma instrument on, that might help get around the
problem. ie
export EMMA_INSTRUMENT = true
make <name of static library>
mmm <path to package>
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):
# 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
Thanks Gabor, indeed it's a very useful information.
Am getting an error while building the project, it says:
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/
android/skin/window.o] Error 1
seems some problem with emulator skin.
Have you faced this, or else can you let me know how to correct this
error.
Urgent reply required, as am just stuck and not able to proceed.
Thanks
On Aug 20, 6:08 pm, Gabor <gabor.andr...@googlemail.com> wrote:
> Finally, the emmacodecoveragemeasurement 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):
> # 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
Just to follow that up, I was able to get it working as well for a
custom project (thanks Gabor!). I had to make some minor changes to
the instructions to get it all to work for me, particularly with the
SDCard on cupcake. If folks are interested, here's what I did:
> 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):
> # 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
hey Gabor,
thanks a lot for your help.
Actually i tried reproducing the same steps, it is working fine till
emulator starts, it launches emulator but it does not shows the home
screen
i tried steps after that, doing adb remount and adb sync, it pushes
all the neccessay files into the emulator, but emulator is still in
sleep state, just the first screen saying Android.. keeps up, does not
boot after that.
Then i tries running test cases using 'am' command no tests run and no
coverage file got generated.
Can you tell me whats the problem in this.(all the bulding process wa
successfully passed with no errors)
Thanks,
Mayank
On Aug 20, 6:08 pm, Gabor <gabor.andr...@googlemail.com> wrote:
> 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):
> # 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
has anyone stuck with the problem on android OS not booting while
launching emulator showing error that can not specify non '.' in your
classpath,
unable to launch dalvikvm
On Aug 20, 6:08 pm, Gabor <gabor.andr...@googlemail.com> wrote:
> Finally, the emmacodecoveragemeasurement 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):
> # 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
thanks everyone for posting info on emma coverage.I was also able to
generate coverage reports for custom tests with necessary changes to
vold.conf.
regards
Haritha
On Aug 20, 6:08 am, Gabor <gabor.andr...@googlemail.com> wrote:
> 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):
> # 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
> thanks everyone for posting info on emma coverage.I was also able to
> generate coverage reports for custom tests with necessary changes to
> vold.conf.
> regards
> Haritha
> On Aug 20, 6:08 am, Gabor <gabor.andr...@googlemail.com> wrote:
> > 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):
> > # 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
hi
i was not facing any issues with emulator.Only thing was my coverage.ec file
was empty as my sdcard is not recognised.with the following steps the issues
was resolved.If possible post the logcat o/p and also the steps followed.
1) edit system/core/rootdir/Android.mk so that the copy_from variable on
line 6 contains etc/vold.conf.
copy_from := \
etc/dbus.conf \
etc/vold.conf \
etc/init.goldfish.sh \
etc/hosts
2)copy vold.conf from (git://
android.git.kernel.org/platform/vendor/htc/dream-open.git) to
system/core/rootdir/etc/
cp vendor/htc/dream-open/vold.conf system/core/rootdir/etc.
regards
Haritha
On Tue, Aug 25, 2009 at 2:40 AM, santosh kumar <santosh.1...@gmail.com>wrote:
> On Aug 25, 2:23 am, Haritha <hari.andr...@gmail.com> wrote:
> > thanks everyone for posting info on emma coverage.I was also able to
> > generate coverage reports for custom tests with necessary changes to
> > vold.conf.
> > regards
> > Haritha
> > On Aug 20, 6:08 am, Gabor <gabor.andr...@googlemail.com> wrote:
> > > 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):
> > > # 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
> hi
> i was not facing any issues with emulator.Only thing was my coverage.ec file
> was empty as my sdcard is not recognised.with the following steps the issues
> was resolved.If possible post the logcat o/p and also the steps followed.
> 1) edit system/core/rootdir/Android.mk so that the copy_from variable on
> line 6 contains etc/vold.conf.
> copy_from := \
> etc/dbus.conf \
> etc/vold.conf \
> etc/init.goldfish.sh \
> etc/hosts
> 2)copy vold.conf from (git://
> android.git.kernel.org/platform/vendor/htc/dream-open.git) to
> system/core/rootdir/etc/
> cp vendor/htc/dream-open/vold.conf system/core/rootdir/etc.
> regards
> Haritha
> On Tue, Aug 25, 2009 at 2:40 AM, santosh kumar <santosh.1...@gmail.com>wrote:
> > Hi All,
> > what changes you have been done to vold.conf?
> > and i followed the steps of gobor..
> > but for me also, emulator is getting stucked..
> > can you plz help me..
> > On Aug 25, 2:23 am, Haritha <hari.andr...@gmail.com> wrote:
> > > thanks everyone for posting info on emma coverage.I was also able to
> > > generate coverage reports for custom tests with necessary changes to
> > > vold.conf.
> > > regards
> > > Haritha
> > > On Aug 20, 6:08 am, Gabor <gabor.andr...@googlemail.com> wrote:
> > > > 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):
> > > > # 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