Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include possibility of covering of boot-classpath #49

Merged
merged 2 commits into from
May 22, 2014
Merged

Conversation

marchof
Copy link
Member

@marchof marchof commented May 19, 2014

Many projects are runnig some of theirs parts in boot classapth for various reasons.
Right now jacoco is exuding boot classpath explicitly.

I think it is worthy to include possibility to cover also bootclassapth, however with strong documentation (as some parts, eg jacoco or java.lang must be excluded otherwise fatal error or endless loop occure )and especially with "use on your own risk" :)

For my own purposes I have added this behaviour to jacoco -
http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20121127/ba8f6a1e/xboot-0001.patch (for reasons - http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-November/020984.html) .
This proof of concept is very simple, it s adding new agent switch xboot=true/false default si false, and let user to include/exclude what he needs. Then it is just not excluding the boot classapth.

I think this improvement can be fast-done one and will bring enormous benefits. From above proof-of-concept i can confirm it is working, as I have successfully covered several Xbootclassapth misusing projects.

@judovana
Copy link
Author

This feature - implemented as mentioned here http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20121127/ba8f6a1e/xboot-0001.patch - is now used by icedtea webin daily build and coverage of bootclasses is working pretty fine.

I would like to point out that some classes have to be excluded. Eg icedtea-web run have this restrictions:
http://icedtea.classpath.org/hg/icedtea-web/file/1fe2a4f7981f/Makefile.am#l71 - 73.

Imho It is really important to mention that many classes must be excluded form processing: eg jacoco:java.lang.:java.reflect.:java.util.:sun.reflect. are imho enough, But one may need to make more precise exclusion.

Loking forward to have this interesting feature in head!

Best regards and tahnk you for your amazing work!

@judovana
Copy link
Author

hi!

This issue is old, provided with full patch - http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20121127/ba8f6a1e/xboot.patch - and still wonted. I need to recompile jacoco on my own after every update (yours or one of depndences)

If you give me access, I will merge it to trunk. Otherwise, please, can we move wit this?

@marchof
Copy link
Member

marchof commented May 13, 2014

@judovana Ok, I'll create a pull request from your patch for review this week.

BTW you can create a pull request yourself -- no access needed. But I'll take care.

@judovana
Copy link
Author

Thank you very much! If it will be awesome.

New configuration option for the JaCoCo agent includebootstrapclasses to
also instrument classes from the bootstrap class loader.
@marchof
Copy link
Member

marchof commented May 19, 2014

@judovana I attached a pull request to this issue. Please feel free to comment on it.

  • The attribute is called includebootstrapclasses
  • various tests addesd
  • documentation added

@judovana
Copy link
Author

Hi!

I have checked a changeset and it looks ok. (I have no yet tried an build) 
I'm looking forward to see it working!

Just for curiosity - when is planned next release?

Thank yu very much!

Mgr. Jiri Vanek
judovana@email.cz

---------- Původní zpráva ----------
Od: Marc R. Hoffmann notifications@github.com
Komu: jacoco/jacoco jacoco@noreply.github.com
Datum: 19. 5. 2014 21:47:06
Předmět: Re: [jacoco] Include possibility of covering of boot-classpath (#
49)

"

@judovana(https://github.com/judovana) I attached a pull request to this
issue. Please feel free to comment on it.

  • The attribute is called includebootstrapclasses
  • various tests addesd
  • documentation added


Reply to this email directly or view it on GitHub
(#49 (comment)).

"

* instrumented. Use this feature with caution, it needs heavy
* includes/excludes tuning.
*
* @parameter property="jacoco.includebootstrapclasses"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marchof I believe that property name should be "jacoco.includeBootstrapClasses" in order to be consistent with naming of other properties

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we are in this file, maybe tuning of " it needs heavy includes/excludes
tuning."   to contain examples of

69
(http://icedtea.classpath.org/hg/icedtea-web/file/22761e42d5b3/Makefile.am#l69)
export JACOCO_BASE_EXCLUDE=org.junit.:junit.

70
(http://icedtea.classpath.org/hg/icedtea-web/file/22761e42d5b3/Makefile.am#l70)
export JACOCO_ADVANCED_EXCLUDE=:jacoco:java.lang.:java.reflect.:java.
util.:sun.reflect.

from (http://icedtea.classpath.org/hg/icedtea-web/file/22761e42d5b3/
Makefile.am#l69)

may be worthy.

Eg.: "it needs heavy includes/excludes. Most commonly excluded classes are :
jacoco:java.lang.:java.reflect.:java.util.:sun.reflect.. Also the
tesengine itself mostly needs excluding. Eg for junit it is list of org.
junit.:junit."

Just unblocking nit pick.

thank you again for push request!

J

---------- Původní zpráva ----------
Od: Evgeny Mandrikov notifications@github.com
Komu: jacoco/jacoco jacoco@noreply.github.com
Datum: 20. 5. 2014 11:23:08
Předmět: Re: [jacoco] Include possibility of covering of boot-classpath (#
49)

"

In jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java:

@@ -73,6 +73,14 @@
/
String exclClassLoaders;
/
*

  • * Specifies whether also classes from the bootstrap classloader should be
  • * instrumented. Use this feature with caution, it needs heavy
  • * includes/excludes tuning.
  • *
  • * @parameter property="jacoco.includebootstrapclasses"

@marchof(https://github.com/marchof) I believe that property name should be
"jacoco.includeBootstrapClasses" in order to be consistent with naming of
other properties


Reply to this email directly or view it on GitHub
(https://github.com/jacoco/jacoco/pull/49/files#r12834237).

"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@judovana I didn't understand your comment fully:

  1. how it relates to my comment about property "jacoco.includebootstrapclasses" ?
  2. what do you want to do with excludes? There is already a way to specify them. Or you want to have some sensible defaults?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@judovana oh, sorry, "morning effect", got it - you want to update JavaDoc and mention some sensible defaults

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes :)

@Godin
Copy link
Member

Godin commented May 20, 2014

@marchof what about addition of integration test for Maven Plugin to cover newly introduced property?

Consistent and shorter naming.
@judovana
Copy link
Author

Please note, unless you are covering JDK itself, you mostly need to excluded classes: :jacoco:java.lang.:java.reflect.:java.util.:sun.reflect.. Also the tesengine itself mostly needs excluding. Eg for junit it is list of org.junit.:junit."

@marchof
Copy link
Member

marchof commented May 21, 2014

@Godin Of course integration tests would be nice. I added one for the Ant task. The tricky part is that you need to inspect the exec file and see whether classes from the bootclasspath have actually been instrumented.

@Godin
Copy link
Member

Godin commented May 22, 2014

@marchof For Maven integration tests we already use BeanShell and can use Groovy, so it seems possible to look into content of exec. But why not - for the time being we can go ahead without this.

@marchof
Copy link
Member

marchof commented May 22, 2014

@Godin So good to merge?

marchof added a commit that referenced this pull request May 22, 2014
Include possibility of covering of boot-classpath
@marchof marchof merged commit e7528a5 into master May 22, 2014
@marchof marchof deleted the issue-49 branch May 22, 2014 17:17
@jacoco jacoco locked and limited conversation to collaborators Jan 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants