You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by "D. Stuart Freeman" <st...@et.gatech.edu> on 2010/07/08 20:39:04 UTC

instrumenting bundles with emma

I'm trying to instrument some bundles with emma so that I can run
integration tests against them and get coverage stats out.

I've added the following to my project's base pom:

<build>
...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>emma-maven-plugin</artifactId>
        <version>1.0-alpha-2</version>
        <inherited>true</inherited>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>instrument</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>emma-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>emma</classifier>
              <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
...
</build>

That seems to give me instrumented and uninstrumented artifacts, but the
bnd plugin seems to add emma as a bundle import even on the
uninstrumented artifacts.  Is there a way to configure it to only add the
emma dependency to the instrumented bundles?  Is there a better way to
build instrumented bundles?

In my search for ways to do this, I've found
http://www.eclemma.org/research/instrumentingosgi/index.html is there a
way to do something similar with Felix?

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: instrumenting bundles with emma

Posted by "D. Stuart Freeman" <st...@et.gatech.edu>.
On Tue, Jul 13, 2010 at 09:47:00AM -0400, Justin Edelson wrote:
> On 7/12/10 9:18 AM, D. Stuart Freeman wrote:
> > On Sat, Jul 10, 2010 at 09:38:08PM -0400, Justin Edelson wrote:
> >> On 7/9/10 3:17 PM, D. Stuart Freeman wrote:
> >>> On Fri, Jul 09, 2010 at 10:55:14AM -0400, Justin Edelson wrote:
> >>>> I think the simplest thing would be to add the emma jar to the
> >>>> classpath and then add the necessary package(s) to the packages
> >>>> exported by the system bundle (i.e. via sling.system.packages). You
> >>>> can do this by adding emma as a dependency to the
> >>>> maven-launchpad-plugin and create a file called
> >>>> src/test/config/sling.properties with this line in it:
> >>>>
> >>>> sling.system.packages.simple=com.vladium.emma.rt
> >>>>
> >>>
> >>> That makes sense, but I can't seem to figure out where to put the
> >>> dependency so that it actually works.
> >>
> >> Take a look at http://codereview.appspot.com/1807041, specifically
> >> http://codereview.appspot.com/1807041/patch/1/5
> >>
> >> Here I'm putting the emma stuff in a profile, so you'd run it like
> >>
> >> mvn -P emma clean verify
> >>
> >> I verified that when not using the instrumented bundles, I don't need
> >> emma on the classpath, so I'm not sure how to explain what you were
> >> seeing where the uninstrumented bundles still needed emma.
> >>
> > 
> > I'm trying to have the launchpad start with my alternative bundle list,
> > but have the build output a launchpad jar with the uninstrumented
> > bundles.  This might not be ideal, and I may have some configuration
> > issue that's getting instrumented bundles into my launchpad jar.
> This *is* ideal... at least with the way integration tests are run in
> Sling, there shouldn't be a need to package the emma bundles into a
> launchpad jar. To do this, you need to move the emma bundle list
> configuration to specific executions within the plugin block:
> 
> http://codereview.appspot.com/1829041/patch/1/5
> 

That makes sense but doesn't fix my problem.  I think what's happening is
that my uninstrumented bundles go into the launchpad, but the launchpad
itself is instrumented, perhaps because of the emma outputDirectory issue
you mentioned earlier.

> Justin

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: instrumenting bundles with emma

Posted by Justin Edelson <ju...@gmail.com>.
On 7/12/10 9:18 AM, D. Stuart Freeman wrote:
> On Sat, Jul 10, 2010 at 09:38:08PM -0400, Justin Edelson wrote:
>> On 7/9/10 3:17 PM, D. Stuart Freeman wrote:
>>> On Fri, Jul 09, 2010 at 10:55:14AM -0400, Justin Edelson wrote:
>>>> I think the simplest thing would be to add the emma jar to the
>>>> classpath and then add the necessary package(s) to the packages
>>>> exported by the system bundle (i.e. via sling.system.packages). You
>>>> can do this by adding emma as a dependency to the
>>>> maven-launchpad-plugin and create a file called
>>>> src/test/config/sling.properties with this line in it:
>>>>
>>>> sling.system.packages.simple=com.vladium.emma.rt
>>>>
>>>
>>> That makes sense, but I can't seem to figure out where to put the
>>> dependency so that it actually works.
>>
>> Take a look at http://codereview.appspot.com/1807041, specifically
>> http://codereview.appspot.com/1807041/patch/1/5
>>
>> Here I'm putting the emma stuff in a profile, so you'd run it like
>>
>> mvn -P emma clean verify
>>
>> I verified that when not using the instrumented bundles, I don't need
>> emma on the classpath, so I'm not sure how to explain what you were
>> seeing where the uninstrumented bundles still needed emma.
>>
> 
> I'm trying to have the launchpad start with my alternative bundle list,
> but have the build output a launchpad jar with the uninstrumented
> bundles.  This might not be ideal, and I may have some configuration
> issue that's getting instrumented bundles into my launchpad jar.
This *is* ideal... at least with the way integration tests are run in
Sling, there shouldn't be a need to package the emma bundles into a
launchpad jar. To do this, you need to move the emma bundle list
configuration to specific executions within the plugin block:

http://codereview.appspot.com/1829041/patch/1/5

Justin

Re: instrumenting bundles with emma

Posted by "D. Stuart Freeman" <st...@et.gatech.edu>.
On Sat, Jul 10, 2010 at 09:38:08PM -0400, Justin Edelson wrote:
> On 7/9/10 3:17 PM, D. Stuart Freeman wrote:
> > On Fri, Jul 09, 2010 at 10:55:14AM -0400, Justin Edelson wrote:
> >> I think the simplest thing would be to add the emma jar to the
> >> classpath and then add the necessary package(s) to the packages
> >> exported by the system bundle (i.e. via sling.system.packages). You
> >> can do this by adding emma as a dependency to the
> >> maven-launchpad-plugin and create a file called
> >> src/test/config/sling.properties with this line in it:
> >>
> >> sling.system.packages.simple=com.vladium.emma.rt
> >>
> > 
> > That makes sense, but I can't seem to figure out where to put the
> > dependency so that it actually works.
> 
> Take a look at http://codereview.appspot.com/1807041, specifically
> http://codereview.appspot.com/1807041/patch/1/5
> 
> Here I'm putting the emma stuff in a profile, so you'd run it like
> 
> mvn -P emma clean verify
> 
> I verified that when not using the instrumented bundles, I don't need
> emma on the classpath, so I'm not sure how to explain what you were
> seeing where the uninstrumented bundles still needed emma.
> 

I'm trying to have the launchpad start with my alternative bundle list,
but have the build output a launchpad jar with the uninstrumented
bundles.  This might not be ideal, and I may have some configuration
issue that's getting instrumented bundles into my launchpad jar.

> I'm totally unsatisifed with the need here to specify an alternate
> bundle list file. At least for Sling, this isn't going to work as it
> means we need to maintain two bundle lists with essentially duplicate
> information. This is just a recipe for failure.
> 

I handled this by generating the "emmafied" bundle list using an xslt
transform of the production bundle list using the mvn-xml-plugin.  

> So I'm thinking there needs to be something like this in the plugin
> configuration:
> 
> <bundleOverrides>
>   <bundleOverride>
>     <pattern>org.apache.sling:*</pattern>
>     <classifier>emma</classifier>
>   </bundleOverride>
> </bundleOverrides>
> 
> Which means... process the bundle list and for each bundle with a
> groupId of org.apache.sling, set the classifier to "emma".
> 

That would have been a lot easier to deal with than figuring out xslt :).

> But I'm still at a loss for how to handle the .em files effectively. The
> merge reference you sent still seems to require the assembly of the .em
> file list.
> 
> Justin

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: instrumenting bundles with emma

Posted by Justin Edelson <ju...@gmail.com>.
On 7/9/10 3:17 PM, D. Stuart Freeman wrote:
> On Fri, Jul 09, 2010 at 10:55:14AM -0400, Justin Edelson wrote:
>> I think the simplest thing would be to add the emma jar to the
>> classpath and then add the necessary package(s) to the packages
>> exported by the system bundle (i.e. via sling.system.packages). You
>> can do this by adding emma as a dependency to the
>> maven-launchpad-plugin and create a file called
>> src/test/config/sling.properties with this line in it:
>>
>> sling.system.packages.simple=com.vladium.emma.rt
>>
> 
> That makes sense, but I can't seem to figure out where to put the
> dependency so that it actually works.

Take a look at http://codereview.appspot.com/1807041, specifically
http://codereview.appspot.com/1807041/patch/1/5

Here I'm putting the emma stuff in a profile, so you'd run it like

mvn -P emma clean verify

I verified that when not using the instrumented bundles, I don't need
emma on the classpath, so I'm not sure how to explain what you were
seeing where the uninstrumented bundles still needed emma.

I'm totally unsatisifed with the need here to specify an alternate
bundle list file. At least for Sling, this isn't going to work as it
means we need to maintain two bundle lists with essentially duplicate
information. This is just a recipe for failure.

So I'm thinking there needs to be something like this in the plugin
configuration:

<bundleOverrides>
  <bundleOverride>
    <pattern>org.apache.sling:*</pattern>
    <classifier>emma</classifier>
  </bundleOverride>
</bundleOverrides>

Which means... process the bundle list and for each bundle with a
groupId of org.apache.sling, set the classifier to "emma".

But I'm still at a loss for how to handle the .em files effectively. The
merge reference you sent still seems to require the assembly of the .em
file list.

Justin

Re: instrumenting bundles with emma

Posted by "D. Stuart Freeman" <st...@et.gatech.edu>.
On Fri, Jul 09, 2010 at 10:55:14AM -0400, Justin Edelson wrote:
> I think the simplest thing would be to add the emma jar to the
> classpath and then add the necessary package(s) to the packages
> exported by the system bundle (i.e. via sling.system.packages). You
> can do this by adding emma as a dependency to the
> maven-launchpad-plugin and create a file called
> src/test/config/sling.properties with this line in it:
> 
> sling.system.packages.simple=com.vladium.emma.rt
> 

That makes sense, but I can't seem to figure out where to put the
dependency so that it actually works.

> Running launchpad via the maven-launchpad-plugin will then produce
> the coverage.ec file.
> 
> Here's where things get a bit messy. In order to produce an HTML
> report, it seems you need both the .ec file and the .em files
> produced during the instrumentation. So you need to do something
> like this:
> java -cp ~/.m2/repository/emma/emma/2.0.5312/emma-2.0.5312.jar emma
> report -r html -in coverage.ec,../../bundles/commons/json/target/coverage.em,../../bundles/commons/auth/target/coverage.em
> 
> (here I instrumented commons.json and commons.auth)
> 

I think the emma merge operation could simplify the command by putting
all the metadata in a single file:

http://fisheye5.cenqua.com/browse/~raw,r=1.1/jaxp-sources/jaxp-ri/util/emma/docs/reference_single/reference.html#tool-ref.merge

I could be misuinderstanding that though, and we'd still have to build up
the list at some point to do the merge.

> I'll have to think about how to codify this in the Maven build (a
> plugin which scans for these .em files and builds the parameter
> list? Attaching the .em files as artifacts?). But it DOES work:
> http://people.apache.org/~justin/coverage/
> <http://people.apache.org/%7Ejustin/coverage/>
> 

Good to see that it is possible :)

> Let's move this back to a sling mailing list.
> 
> Justin
> 
> D. Stuart Freeman wrote:
> >That was going to be my next question :).  I was wondering whether it
> >would be better to make an emma bundle that exports the required classes,
> >or if I could do something like boot delegation and have the emma jar on
> >the classpath when I start sling.
> >
> >On Thu, Jul 08, 2010 at 09:08:58PM -0400, Justin Edelson wrote:
> >>D. Stuart -
> >>
> >>Question for you: once you get the bundles instrumented, how do you get
> >>them to resolve in Felix? I don't see an emma bundle which exports the
> >>right package.
> >>
> >>Justin
> >>
> >>On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
> >>>I'm trying to instrument some bundles with emma so that I can run
> >>>integration tests against them and get coverage stats out.
> >>>
> >>>I've added the following to my project's base pom:
> >>>
> >>><build>
> >>>...
> >>>      <plugin>
> >>>        <groupId>org.codehaus.mojo</groupId>
> >>>        <artifactId>emma-maven-plugin</artifactId>
> >>>        <version>1.0-alpha-2</version>
> >>>        <inherited>true</inherited>
> >>>        <executions>
> >>>          <execution>
> >>>            <phase>prepare-package</phase>
> >>>            <goals>
> >>>              <goal>instrument</goal>
> >>>            </goals>
> >>>          </execution>
> >>>        </executions>
> >>>      </plugin>
> >>>      <plugin>
> >>>        <groupId>org.apache.maven.plugins</groupId>
> >>>        <artifactId>maven-jar-plugin</artifactId>
> >>>        <executions>
> >>>          <execution>
> >>>            <id>emma-jar</id>
> >>>            <phase>package</phase>
> >>>            <goals>
> >>>              <goal>jar</goal>
> >>>            </goals>
> >>>            <configuration>
> >>>              <classifier>emma</classifier>
> >>>              <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
> >>>            </configuration>
> >>>          </execution>
> >>>        </executions>
> >>>      </plugin>
> >>>...
> >>></build>
> >>>
> >>>That seems to give me instrumented and uninstrumented artifacts, but the
> >>>bnd plugin seems to add emma as a bundle import even on the
> >>>uninstrumented artifacts.  Is there a way to configure it to only add the
> >>>emma dependency to the instrumented bundles?  Is there a better way to
> >>>build instrumented bundles?
> >>>
> >>>In my search for ways to do this, I've found
> >>>http://www.eclemma.org/research/instrumentingosgi/index.html is there a
> >>>way to do something similar with Felix?
> >>>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>For additional commands, e-mail: users-help@felix.apache.org
> >>
> >
> 

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: instrumenting bundles with emma

Posted by "D. Stuart Freeman" <st...@et.gatech.edu>.
On Fri, Jul 09, 2010 at 10:55:14AM -0400, Justin Edelson wrote:
> I think the simplest thing would be to add the emma jar to the
> classpath and then add the necessary package(s) to the packages
> exported by the system bundle (i.e. via sling.system.packages). You
> can do this by adding emma as a dependency to the
> maven-launchpad-plugin and create a file called
> src/test/config/sling.properties with this line in it:
> 
> sling.system.packages.simple=com.vladium.emma.rt
> 

That makes sense, but I can't seem to figure out where to put the
dependency so that it actually works.

> Running launchpad via the maven-launchpad-plugin will then produce
> the coverage.ec file.
> 
> Here's where things get a bit messy. In order to produce an HTML
> report, it seems you need both the .ec file and the .em files
> produced during the instrumentation. So you need to do something
> like this:
> java -cp ~/.m2/repository/emma/emma/2.0.5312/emma-2.0.5312.jar emma
> report -r html -in coverage.ec,../../bundles/commons/json/target/coverage.em,../../bundles/commons/auth/target/coverage.em
> 
> (here I instrumented commons.json and commons.auth)
> 

I think the emma merge operation could simplify the command by putting
all the metadata in a single file:

http://fisheye5.cenqua.com/browse/~raw,r=1.1/jaxp-sources/jaxp-ri/util/emma/docs/reference_single/reference.html#tool-ref.merge

I could be misuinderstanding that though, and we'd still have to build up
the list at some point to do the merge.

> I'll have to think about how to codify this in the Maven build (a
> plugin which scans for these .em files and builds the parameter
> list? Attaching the .em files as artifacts?). But it DOES work:
> http://people.apache.org/~justin/coverage/
> <http://people.apache.org/%7Ejustin/coverage/>
> 

Good to see that it is possible :)

> Let's move this back to a sling mailing list.
> 
> Justin
> 
> D. Stuart Freeman wrote:
> >That was going to be my next question :).  I was wondering whether it
> >would be better to make an emma bundle that exports the required classes,
> >or if I could do something like boot delegation and have the emma jar on
> >the classpath when I start sling.
> >
> >On Thu, Jul 08, 2010 at 09:08:58PM -0400, Justin Edelson wrote:
> >>D. Stuart -
> >>
> >>Question for you: once you get the bundles instrumented, how do you get
> >>them to resolve in Felix? I don't see an emma bundle which exports the
> >>right package.
> >>
> >>Justin
> >>
> >>On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
> >>>I'm trying to instrument some bundles with emma so that I can run
> >>>integration tests against them and get coverage stats out.
> >>>
> >>>I've added the following to my project's base pom:
> >>>
> >>><build>
> >>>...
> >>>      <plugin>
> >>>        <groupId>org.codehaus.mojo</groupId>
> >>>        <artifactId>emma-maven-plugin</artifactId>
> >>>        <version>1.0-alpha-2</version>
> >>>        <inherited>true</inherited>
> >>>        <executions>
> >>>          <execution>
> >>>            <phase>prepare-package</phase>
> >>>            <goals>
> >>>              <goal>instrument</goal>
> >>>            </goals>
> >>>          </execution>
> >>>        </executions>
> >>>      </plugin>
> >>>      <plugin>
> >>>        <groupId>org.apache.maven.plugins</groupId>
> >>>        <artifactId>maven-jar-plugin</artifactId>
> >>>        <executions>
> >>>          <execution>
> >>>            <id>emma-jar</id>
> >>>            <phase>package</phase>
> >>>            <goals>
> >>>              <goal>jar</goal>
> >>>            </goals>
> >>>            <configuration>
> >>>              <classifier>emma</classifier>
> >>>              <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
> >>>            </configuration>
> >>>          </execution>
> >>>        </executions>
> >>>      </plugin>
> >>>...
> >>></build>
> >>>
> >>>That seems to give me instrumented and uninstrumented artifacts, but the
> >>>bnd plugin seems to add emma as a bundle import even on the
> >>>uninstrumented artifacts.  Is there a way to configure it to only add the
> >>>emma dependency to the instrumented bundles?  Is there a better way to
> >>>build instrumented bundles?
> >>>
> >>>In my search for ways to do this, I've found
> >>>http://www.eclemma.org/research/instrumentingosgi/index.html is there a
> >>>way to do something similar with Felix?
> >>>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>For additional commands, e-mail: users-help@felix.apache.org
> >>
> >
> 

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: instrumenting bundles with emma

Posted by Justin Edelson <ju...@gmail.com>.
I think the simplest thing would be to add the emma jar to the classpath 
and then add the necessary package(s) to the packages exported by the 
system bundle (i.e. via sling.system.packages). You can do this by 
adding emma as a dependency to the maven-launchpad-plugin and create a 
file called src/test/config/sling.properties with this line in it:

sling.system.packages.simple=com.vladium.emma.rt

Running launchpad via the maven-launchpad-plugin will then produce the 
coverage.ec file.

Here's where things get a bit messy. In order to produce an HTML report, 
it seems you need both the .ec file and the .em files produced during 
the instrumentation. So you need to do something like this:
java -cp ~/.m2/repository/emma/emma/2.0.5312/emma-2.0.5312.jar emma 
report -r html -in 
coverage.ec,../../bundles/commons/json/target/coverage.em,../../bundles/commons/auth/target/coverage.em

(here I instrumented commons.json and commons.auth)

I'll have to think about how to codify this in the Maven build (a plugin 
which scans for these .em files and builds the parameter list? Attaching 
the .em files as artifacts?). But it DOES work: 
http://people.apache.org/~justin/coverage/ 
<http://people.apache.org/%7Ejustin/coverage/>

Let's move this back to a sling mailing list.

Justin

D. Stuart Freeman wrote:
> That was going to be my next question :).  I was wondering whether it
> would be better to make an emma bundle that exports the required classes,
> or if I could do something like boot delegation and have the emma jar on
> the classpath when I start sling.
>
> On Thu, Jul 08, 2010 at 09:08:58PM -0400, Justin Edelson wrote:
>   
>> D. Stuart -
>>
>> Question for you: once you get the bundles instrumented, how do you get
>> them to resolve in Felix? I don't see an emma bundle which exports the
>> right package.
>>
>> Justin
>>
>> On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
>>     
>>> I'm trying to instrument some bundles with emma so that I can run
>>> integration tests against them and get coverage stats out.
>>>
>>> I've added the following to my project's base pom:
>>>
>>> <build>
>>> ...
>>>       <plugin>
>>>         <groupId>org.codehaus.mojo</groupId>
>>>         <artifactId>emma-maven-plugin</artifactId>
>>>         <version>1.0-alpha-2</version>
>>>         <inherited>true</inherited>
>>>         <executions>
>>>           <execution>
>>>             <phase>prepare-package</phase>
>>>             <goals>
>>>               <goal>instrument</goal>
>>>             </goals>
>>>           </execution>
>>>         </executions>
>>>       </plugin>
>>>       <plugin>
>>>         <groupId>org.apache.maven.plugins</groupId>
>>>         <artifactId>maven-jar-plugin</artifactId>
>>>         <executions>
>>>           <execution>
>>>             <id>emma-jar</id>
>>>             <phase>package</phase>
>>>             <goals>
>>>               <goal>jar</goal>
>>>             </goals>
>>>             <configuration>
>>>               <classifier>emma</classifier>
>>>               <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
>>>             </configuration>
>>>           </execution>
>>>         </executions>
>>>       </plugin>
>>> ...
>>> </build>
>>>
>>> That seems to give me instrumented and uninstrumented artifacts, but the
>>> bnd plugin seems to add emma as a bundle import even on the
>>> uninstrumented artifacts.  Is there a way to configure it to only add the
>>> emma dependency to the instrumented bundles?  Is there a better way to
>>> build instrumented bundles?
>>>
>>> In my search for ways to do this, I've found
>>> http://www.eclemma.org/research/instrumentingosgi/index.html is there a
>>> way to do something similar with Felix?
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: instrumenting bundles with emma

Posted by Justin Edelson <ju...@gmail.com>.
I think the simplest thing would be to add the emma jar to the classpath 
and then add the necessary package(s) to the packages exported by the 
system bundle (i.e. via sling.system.packages). You can do this by 
adding emma as a dependency to the maven-launchpad-plugin and create a 
file called src/test/config/sling.properties with this line in it:

sling.system.packages.simple=com.vladium.emma.rt

Running launchpad via the maven-launchpad-plugin will then produce the 
coverage.ec file.

Here's where things get a bit messy. In order to produce an HTML report, 
it seems you need both the .ec file and the .em files produced during 
the instrumentation. So you need to do something like this:
java -cp ~/.m2/repository/emma/emma/2.0.5312/emma-2.0.5312.jar emma 
report -r html -in 
coverage.ec,../../bundles/commons/json/target/coverage.em,../../bundles/commons/auth/target/coverage.em

(here I instrumented commons.json and commons.auth)

I'll have to think about how to codify this in the Maven build (a plugin 
which scans for these .em files and builds the parameter list? Attaching 
the .em files as artifacts?). But it DOES work: 
http://people.apache.org/~justin/coverage/ 
<http://people.apache.org/%7Ejustin/coverage/>

Let's move this back to a sling mailing list.

Justin

D. Stuart Freeman wrote:
> That was going to be my next question :).  I was wondering whether it
> would be better to make an emma bundle that exports the required classes,
> or if I could do something like boot delegation and have the emma jar on
> the classpath when I start sling.
>
> On Thu, Jul 08, 2010 at 09:08:58PM -0400, Justin Edelson wrote:
>   
>> D. Stuart -
>>
>> Question for you: once you get the bundles instrumented, how do you get
>> them to resolve in Felix? I don't see an emma bundle which exports the
>> right package.
>>
>> Justin
>>
>> On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
>>     
>>> I'm trying to instrument some bundles with emma so that I can run
>>> integration tests against them and get coverage stats out.
>>>
>>> I've added the following to my project's base pom:
>>>
>>> <build>
>>> ...
>>>       <plugin>
>>>         <groupId>org.codehaus.mojo</groupId>
>>>         <artifactId>emma-maven-plugin</artifactId>
>>>         <version>1.0-alpha-2</version>
>>>         <inherited>true</inherited>
>>>         <executions>
>>>           <execution>
>>>             <phase>prepare-package</phase>
>>>             <goals>
>>>               <goal>instrument</goal>
>>>             </goals>
>>>           </execution>
>>>         </executions>
>>>       </plugin>
>>>       <plugin>
>>>         <groupId>org.apache.maven.plugins</groupId>
>>>         <artifactId>maven-jar-plugin</artifactId>
>>>         <executions>
>>>           <execution>
>>>             <id>emma-jar</id>
>>>             <phase>package</phase>
>>>             <goals>
>>>               <goal>jar</goal>
>>>             </goals>
>>>             <configuration>
>>>               <classifier>emma</classifier>
>>>               <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
>>>             </configuration>
>>>           </execution>
>>>         </executions>
>>>       </plugin>
>>> ...
>>> </build>
>>>
>>> That seems to give me instrumented and uninstrumented artifacts, but the
>>> bnd plugin seems to add emma as a bundle import even on the
>>> uninstrumented artifacts.  Is there a way to configure it to only add the
>>> emma dependency to the instrumented bundles?  Is there a better way to
>>> build instrumented bundles?
>>>
>>> In my search for ways to do this, I've found
>>> http://www.eclemma.org/research/instrumentingosgi/index.html is there a
>>> way to do something similar with Felix?
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>     
>
>   


Re: instrumenting bundles with emma

Posted by "D. Stuart Freeman" <st...@et.gatech.edu>.
That was going to be my next question :).  I was wondering whether it
would be better to make an emma bundle that exports the required classes,
or if I could do something like boot delegation and have the emma jar on
the classpath when I start sling.

On Thu, Jul 08, 2010 at 09:08:58PM -0400, Justin Edelson wrote:
> D. Stuart -
> 
> Question for you: once you get the bundles instrumented, how do you get
> them to resolve in Felix? I don't see an emma bundle which exports the
> right package.
> 
> Justin
> 
> On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
> > I'm trying to instrument some bundles with emma so that I can run
> > integration tests against them and get coverage stats out.
> > 
> > I've added the following to my project's base pom:
> > 
> > <build>
> > ...
> >       <plugin>
> >         <groupId>org.codehaus.mojo</groupId>
> >         <artifactId>emma-maven-plugin</artifactId>
> >         <version>1.0-alpha-2</version>
> >         <inherited>true</inherited>
> >         <executions>
> >           <execution>
> >             <phase>prepare-package</phase>
> >             <goals>
> >               <goal>instrument</goal>
> >             </goals>
> >           </execution>
> >         </executions>
> >       </plugin>
> >       <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-jar-plugin</artifactId>
> >         <executions>
> >           <execution>
> >             <id>emma-jar</id>
> >             <phase>package</phase>
> >             <goals>
> >               <goal>jar</goal>
> >             </goals>
> >             <configuration>
> >               <classifier>emma</classifier>
> >               <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
> >             </configuration>
> >           </execution>
> >         </executions>
> >       </plugin>
> > ...
> > </build>
> > 
> > That seems to give me instrumented and uninstrumented artifacts, but the
> > bnd plugin seems to add emma as a bundle import even on the
> > uninstrumented artifacts.  Is there a way to configure it to only add the
> > emma dependency to the instrumented bundles?  Is there a better way to
> > build instrumented bundles?
> > 
> > In my search for ways to do this, I've found
> > http://www.eclemma.org/research/instrumentingosgi/index.html is there a
> > way to do something similar with Felix?
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: instrumenting bundles with emma

Posted by Justin Edelson <ju...@gmail.com>.
D. Stuart -

Question for you: once you get the bundles instrumented, how do you get
them to resolve in Felix? I don't see an emma bundle which exports the
right package.

Justin

On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
> I'm trying to instrument some bundles with emma so that I can run
> integration tests against them and get coverage stats out.
> 
> I've added the following to my project's base pom:
> 
> <build>
> ...
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>emma-maven-plugin</artifactId>
>         <version>1.0-alpha-2</version>
>         <inherited>true</inherited>
>         <executions>
>           <execution>
>             <phase>prepare-package</phase>
>             <goals>
>               <goal>instrument</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-jar-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>emma-jar</id>
>             <phase>package</phase>
>             <goals>
>               <goal>jar</goal>
>             </goals>
>             <configuration>
>               <classifier>emma</classifier>
>               <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
> ...
> </build>
> 
> That seems to give me instrumented and uninstrumented artifacts, but the
> bnd plugin seems to add emma as a bundle import even on the
> uninstrumented artifacts.  Is there a way to configure it to only add the
> emma dependency to the instrumented bundles?  Is there a better way to
> build instrumented bundles?
> 
> In my search for ways to do this, I've found
> http://www.eclemma.org/research/instrumentingosgi/index.html is there a
> way to do something similar with Felix?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: instrumenting bundles with emma

Posted by "D. Stuart Freeman" <st...@et.gatech.edu>.
I've made the change to use the bundle plugin instead of the jar plugin.
But my uninstrumented launchpad still gives me:

  Exception in thread "main" java.lang.NoClassDefFoundError:
com/vladium/emma/rt/RT

On Thu, Jul 08, 2010 at 09:03:32PM -0400, Justin Edelson wrote:
> Sorry it has taken me a while to look into this since you posted your
> patch on sling-users.
> 
> There seems to be a bug in the emma plugin which causes the value of
> project.build.outputDirectory to be changed to
> target/generated-classes/emma/classes. AFAIK, this isn't supposed to be
> allowed, but I guess it is.
> 
> In any case, there's an easy enough work around - manually set the
> outputDirectory property of the bundle plugin. You also need to use the
> bundle plugin, not the jar plugin to package the instrumented bundle.
> 
> Here's what the updated patch to Sling's Commons JSON module looks like:
> http://codereview.appspot.com/1772041/patch/1/3
> 
> Justin
> 
> 
> On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
> > I'm trying to instrument some bundles with emma so that I can run
> > integration tests against them and get coverage stats out.
> > 
> > I've added the following to my project's base pom:
> > 
> > <build>
> > ...
> >       <plugin>
> >         <groupId>org.codehaus.mojo</groupId>
> >         <artifactId>emma-maven-plugin</artifactId>
> >         <version>1.0-alpha-2</version>
> >         <inherited>true</inherited>
> >         <executions>
> >           <execution>
> >             <phase>prepare-package</phase>
> >             <goals>
> >               <goal>instrument</goal>
> >             </goals>
> >           </execution>
> >         </executions>
> >       </plugin>
> >       <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-jar-plugin</artifactId>
> >         <executions>
> >           <execution>
> >             <id>emma-jar</id>
> >             <phase>package</phase>
> >             <goals>
> >               <goal>jar</goal>
> >             </goals>
> >             <configuration>
> >               <classifier>emma</classifier>
> >               <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
> >             </configuration>
> >           </execution>
> >         </executions>
> >       </plugin>
> > ...
> > </build>
> > 
> > That seems to give me instrumented and uninstrumented artifacts, but the
> > bnd plugin seems to add emma as a bundle import even on the
> > uninstrumented artifacts.  Is there a way to configure it to only add the
> > emma dependency to the instrumented bundles?  Is there a better way to
> > build instrumented bundles?
> > 
> > In my search for ways to do this, I've found
> > http://www.eclemma.org/research/instrumentingosgi/index.html is there a
> > way to do something similar with Felix?
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: instrumenting bundles with emma

Posted by Justin Edelson <ju...@gmail.com>.
Sorry it has taken me a while to look into this since you posted your
patch on sling-users.

There seems to be a bug in the emma plugin which causes the value of
project.build.outputDirectory to be changed to
target/generated-classes/emma/classes. AFAIK, this isn't supposed to be
allowed, but I guess it is.

In any case, there's an easy enough work around - manually set the
outputDirectory property of the bundle plugin. You also need to use the
bundle plugin, not the jar plugin to package the instrumented bundle.

Here's what the updated patch to Sling's Commons JSON module looks like:
http://codereview.appspot.com/1772041/patch/1/3

Justin


On 7/8/10 2:39 PM, D. Stuart Freeman wrote:
> I'm trying to instrument some bundles with emma so that I can run
> integration tests against them and get coverage stats out.
> 
> I've added the following to my project's base pom:
> 
> <build>
> ...
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>emma-maven-plugin</artifactId>
>         <version>1.0-alpha-2</version>
>         <inherited>true</inherited>
>         <executions>
>           <execution>
>             <phase>prepare-package</phase>
>             <goals>
>               <goal>instrument</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-jar-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>emma-jar</id>
>             <phase>package</phase>
>             <goals>
>               <goal>jar</goal>
>             </goals>
>             <configuration>
>               <classifier>emma</classifier>
>               <classesDirectory>${maven.build.dir}/generated-classes/emma/classes</classesDirectory>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
> ...
> </build>
> 
> That seems to give me instrumented and uninstrumented artifacts, but the
> bnd plugin seems to add emma as a bundle import even on the
> uninstrumented artifacts.  Is there a way to configure it to only add the
> emma dependency to the instrumented bundles?  Is there a better way to
> build instrumented bundles?
> 
> In my search for ways to do this, I've found
> http://www.eclemma.org/research/instrumentingosgi/index.html is there a
> way to do something similar with Felix?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org