You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Vemund Østgaard (JIRA)" <ji...@apache.org> on 2008/02/21 16:39:20 UTC

[jira] Created: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
-------------------------------------------------------------------------------------

                 Key: DERBY-3445
                 URL: https://issues.apache.org/jira/browse/DERBY-3445
             Project: Derby
          Issue Type: Improvement
          Components: Build tools
            Reporter: Vemund Østgaard
            Assignee: Vemund Østgaard


It is a bit tricky to use EMMA to measure code coverage for the derby testing.

Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.

It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572160#action_12572160 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

I extracted the portions of the patch needed to fix DERBY-3153 and attached it to that issue.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-testspecific-diff
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572416#action_12572416 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

About DERBY-3153:

- The additions of junit.jar to the classpath of the <junit> tasks were also to make it easier to run with ant 1.7. This didn't work with 1.6.5, but with 1.7 it means you don't have to add junit.jar to your classpath when running ant or put it in ants lib/ directory:

+ <!-- ant 1.7 finds junit.jar if it is on the classpath of the <junit> task -->
+ <pathelement location="${junit}"/>

- There were a few changes in 3445-testspecific-diff that were specifically for running with ant 1.7 as well, so running with only the changes in the patch that was added to DERBY-3153 you will probably see a few errors in those tests.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-testspecific-diff
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren updated DERBY-3445:
--------------------------------------

    Fix Version/s: 10.4.1.3

Majority of commits were before 10.4 branch creation.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>             Fix For: 10.4.1.3
>
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12584579#action_12584579 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

> Thinking a little more I'm not sure the network server removing its security manager is a good idea. It would allow any code in shutdown hooks to have free use of the jvm.

I'm pondering more about how to best solve this issue. How about having some way of triggering this behavior, a property or something else, that would only be used for the purpose of testing with EMMA? If property X is set, the network server removes the security manager right before doing shutdown, but only in the case were it has installed a security manager itself with the default policy.

What is the view on adding such an interface (property or similar) to the product, which is only intended for testing purposes?


> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572614#action_12572614 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

+ <!-- ant 1.7 finds junit.jar if it is on the classpath of the <junit> task -->
+ <pathelement location="${junit}"/> 

Does this cause problems with ant 1.6?

I run with junit in my ant's lib folder, solves all the issues.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583713#action_12583713 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

> A better long term solution would be to allow a set of policies to be added into the network server's default set. E.g. could add this policy file emma.policy:
> 
> grant codebase "... path to emma jars" {
>    // permissions needed
> }
> 
> java -jar derbyrun.jar server -additionalPolicy emma.policy start
> 
> This would then be logically added into the permission set that Derby installs automatically.

As far as I understand your suggestion is to add a new option to the network server (-additionalPolicy, or something along those lines). This new option would then only have an effect if the network server is started in a way that causes it to install its own default security policy. The effect would then be to merge the contents of the default policy file (server.policy) with whatever policy file is added with the new argument (emma.policy) into a new file, and then set the java.security.policy property to point to this file before installing a SecurityManager. 

Would this be a feature added just to be able to test the product with EMMA, or do you think of other use cases as well?
Real users would be able to put a policy file under ${user.home}/.java.policy or just set -Djava.security.policy, so I guess they wouldn't have a need for it. 


> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574532#action_12574532 ] 

dyret edited comment on DERBY-3445 at 3/3/08 6:45 AM:
---------------------------------------------------------------

I would like to commit 3445-singletest-diff as well, but I can't figure out how to run junit-single or  emma-single (or any other junit target for that matter), so I'll wait until the wiki page becomes available.

      was (Author: dyret):
    I would like to commit 3445-singletest-diff as well, but I can't figure out how to run neither the junit-single or the emma-single target (or any other junit target for that matter), so I'll wait until the wiki page becomes available.
  
> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586716#action_12586716 ] 

Dyre Tjeldvoll commented on DERBY-3445:
---------------------------------------

I'm trying to follow the discussion here, but I'm not quite sure if the latest comments (after 31/Mar) affect the 3445-emma-clean-fix-diff patch or not. If they do, I suggest removing 'patch-available' from this issue.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586734#action_12586734 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

The 3445-emma-clean-fix is unrelated to the discussions, so that patch should still be committed I think.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dyre Tjeldvoll updated DERBY-3445:
----------------------------------

    Derby Info:   (was: [Patch Available])

Patch file: 3445-emma-clean-fix-diff
Committed revision 645859.


> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard updated DERBY-3445:
-----------------------------------

    Attachment: 3445-emma-clean-fix-diff

Attaching a patch "3445-emma-clean-fix-diff" with a one-line fix for the <emma-clean> target, so it doesn't fail when there is no directory to remove.

About the missing link to sources. Yes, I have been compiling with debug=true (and sane=true). I tried with debug=false, and saw the following written by emma-report:

   [report] not all instrumented classes were compiled with source file
   [report] debug data: no sources will be embedded in the report.
   [report] line coverage requested in a report of type [html] but
   [report] not all instrumented classes were compiled with line number
   [report] debug data: this column will be removed from the report.

This report did not contain any links to the source, so it seems that you must compile with debug=true to get this.

I'll add a note about this to the wikipage.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576251#action_12576251 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

You are correct, emma tries to read and write to the coverage.ec file at system exit (and read ${user.dir} but I guess that may be allowed by the default policy).

I have no better suggestions for a solution, other than what you suggest. I guess the network server only needs to remove the security manager if it is being shut down and is running as a separate process (about to exit).

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575102#action_12575102 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

In the build output twhen running emma-all here is something a little strange though I have no idea if it's a problem or not.

The junit-jdbc4 target produces the message:

  EMMA: collecting runtime coverage data ...

but the junit-core target does not.

Just seems strange.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575098#action_12575098 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

Thanks Vemund, I was able to get code coverage running very easily now using the emma-all target.

With the previous EMMA reports I was able to click down through the HTML report to an individual file and see which specific blocks had not been covered, I think with coloured source code. With the report I just generated using emma-all I was not able to see this information. The lowest level was the coverage breakdown by method.

Anyone any idea what needs to be done to get the source code level information?


> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard updated DERBY-3445:
-----------------------------------

    Attachment: 3445-testspecific-diffv2
                3445-general-diffv2

Attaching new versions of the two patches that I think addresses Dans first comment on the addition of permissions to derby.jar. 

The changes are that I have added a property "emma.enabled" to each EMMA-related permission so that they will be ignored if that property is not set. The property is set to an empty string by the SecurityManagerSetup if emma.jar is in the classpath.

I tried granting the permissions to the whole stack, but then at least one test broke because of that as it got permission to something it wasn't supposed to.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard updated DERBY-3445:
-----------------------------------

    Attachment: 3445-singletest-diff
                3445-SysinfoLocaleTest-diff

Thank you all for the comments and suggestions, I've added two more patches based on the feedback.

3445-SysinfoLocaleTest-diff has a fix for the bug pointed out by Dan.

3445-singletest-diff is a response to Thomas' wish for a way to run a single test with EMMA using ant.
- Added a task <junit-single> which is in turn used by a task <emma-single>. Both need the property derby.junit.testclass set to some classname that will be attempted run as a junit test/suite.

So, doing: 
"ant emma-single -Dderby.junit.testclass=org.apache.derbyTesting.functionTests.tests.tools.SysinfoLocaleTest" 
should run that particular test with codecoverage.

I also changed my use of ${junit} to ${javatools.dir}/junit.jar, as the first property is set in tools/ant/extrapath.properties and those properties are only loaded for compilation and not when just running a junit test.

I'll write up some information on what you need to test with EMMA and how to use the new junit and emma targets, probably on monday. I guess I will add some info to the junit wiki page and perhaps a new page for EMMA, and add some more explanations to the build.xml file.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575987#action_12575987 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

There's a minor issue in that if the network server is run as a separate process then I don't think it can write out the coverage information due to the default policy file.
I see these errors now that by default spawning a process network server prints out any stderr.

Not sure what a solution is, maybe the server should remove the security manager when it shuts down?

I'm seeing exceptions like this:
    [junit] java.security.AccessControlException: Access denied (java.io.FilePermission coverage.ec read)
    [junit]     at java.security.AccessController.checkPermission(AccessController.java:104)
    [junit]     at java.lang.SecurityManager.checkPermission(SecurityManager.java:547)
    [junit]     at java.lang.SecurityManager.checkRead(SecurityManager.java:886)
    [junit]     at java.io.File.exists(File.java:726)
    [junit]     at com.vladium.emma.data.DataFactory.persist(DataFactory.java:525)
    [junit]     at com.vladium.emma.data.DataFactory.persist(DataFactory.java:86)
    [junit]     at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(RTCoverageDataPersister.java:54)
    [junit]     at com.vladium.emma.rt.RTExitHook.run(RTExitHook.java:32)
    [junit]     at java.lang.Thread.run(Thread.java:801)
    [junit] Exception in thread "EMMA shutdown handler thread" java.lang.RuntimeException: EMMA failed to dump coverage data: java.security.AccessControlException: Access denied (java.io.FilePermission coverage.ec read)
    [junit]     at com.vladium.emma.rt.RTCoverageDataPersister.dumpCoverageData(RTCoverageDataPersister.java:71)
    [junit]     at com.vladium.emma.rt.RTExitHook.run(RTExitHook.java:32)
    [junit]     at java.lang.Thread.run(Thread.java:801)

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Thomas Nielsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573382#action_12573382 ] 

Thomas Nielsen commented on DERBY-3445:
---------------------------------------

It would be great if targets for running emma with a single test were added too, not just for junit-all. But that could be solved in another commit.

To enable something like
> ant emma-instrumentation
> java junit.textui.TestRunner org.apache....theTestIWantToRun
> ant emma-report-singletest

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578721#action_12578721 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

Doesn't the <junit-all>, <junit-core>, <junit-jdbc4>, etc. behave in the same way as <junit-single> by not causing the build to fail if a test fails? At least I cannot from the code see that there is any difference. None of these targets have something like:

  	<fail if="tests.failed">Tests Failed!</fail>

>From my reading only the <junit-html>, the <junit-*-codeline-jars> and the <emma-*> targets do this.

If all the junit targets were changed to cause build failure if a test fails, then targets like <junitreport> would abort without producing a report if there is a test failure? The same would be true if running with emma, no coverage reports, at least thats what happened when I tested it with <emma-single>. I don't know if it is possible to get ant to proceed with the next task even if one it depends on fails?

Maybe a solution here would be to add a <junit-single-report> target to be the equivalent of the <junitreport> target, which would then build a report after the test is run and cause a build failure if the test/suite fails? The <junit-single-report> target can be used when it is important to get test failure translated to build failure, while the <junit-single> target would remain to be used by <emma-single> and <junit-single-report> or directly if you are not concerned about the build failure problem.


> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575174#action_12575174 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

Latest patch  (singletest-codeline) applied - revision 633690 - Thanks Vemund.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573469#action_12573469 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

v2 patches mostly committed Revision: 632125 - Thanks Vemund.

I did not commit the change to SysinfoLocaleTest as it causes the test to fail if emma jars are not in the classpath.

Seems that ant junit-all continued to work with ant 1.6, I didn't perform a whole run, apart form SysinfoLocaleTest  it didn't look as though the changes would cause any failures.

I didn't test it with EMMA.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard updated DERBY-3445:
-----------------------------------

    Derby Info: [Patch Available]

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-testspecific-diff
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574532#action_12574532 ] 

Dyre Tjeldvoll commented on DERBY-3445:
---------------------------------------

I would like to commit 3445-singletest-diff as well, but I can't figure out how to run neither the junit-single or the emma-single target (or any other junit target for that matter), so I'll wait until the wiki page becomes available.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard updated DERBY-3445:
-----------------------------------

    Attachment: 3445-testspecific-diff
                3445-general-diff

I've made a patch that I think makes it a lot easier to run codecoverage measurements with the junit suites using EMMA and ant 1.7. Just download emma.jar and emma_ant.jar and place them under tools/java/ and everything should work, at least with ant 1.7.

I have put the general changes in a patchfile named 3445-general-diff. The changes in this patch are:
- A lot of new permissions in derby_tests.policy, both for EMMA writing to its coverage.ec file, and for running junit from ant with ant version 1.7 which writes to some temporary files.
- SecurityManagerSetup now sets a new property "derbyTesting.emma" to the location of emma.jar. This is used in the policy files to grant permissions to emma.jar, without having to know where it will be placed by the person running the test.
- Several new tasks are added to build.xml for running tests with EMMA. The most important one is emma-report, which instruments your jar-files and places the instrumented copies under jars/emma/, and then runs the junit task <junit-all> before it creates three sets of coverage reports (txt, xml and html) linked to the derby source files. I've adapted the old <junit-all> task to work with EMMA and ant 1.7.
- Added properties for emma.jar and emma_ant.jar in tools/ant/extrapath.properties. If you 

I have made some test-specific changes as well, and put them in a separate pathfile named 3445-testspecific-diff. These changes are:
- Extra permissions in SecurityPolicyReloadingTest.initial.policy, NetworkServerControlApiTest.policy and ServerPropertiesTest.policy to get these tests to run with EMMA and ant 1.7.
- Added emma.jar to classpath for classloader used in SysinfoLocaleTest.java.
- Added property emma.verbosity.level=silent to commandline used in SecureServerTest.java.


This is a first step to make it easier to run with EMMA. Going forward, it might be useful to improve the emma-tasks in build.xml to be able to run codecoverage experiments with the classes in addition to the jars and to integrate with the other junit-tasks as well.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-testspecific-diff
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572126#action_12572126 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

I forgot to mention that the patches I have uploaded also address the problem seen in DERBY-3153, it didn't seem very useful to try to filter out the changes that were relevant for that report as some of them were just as relevant for this one. So, if these patches get committed I believe DERBY-3153 can be closed as well.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-testspecific-diff
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575131#action_12575131 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

Thanks again Dan for following up on this. Some answers to your comments:

- I'll fix the <emma-clean> target so it doesn't fail if there is no folder there.

- The difference in output when running the <junit-jdbc4> target is (I'm guessing) because I didn't set emma.verbosity.level=silent for this target, as there was no tests that failed because of emma output. This property is set for the <junit-core> target, so no output from emma there.

- You should have been able to click down to the source code level, at least that worked when I tested this out in my sandbox. The <emma-report> target sets this:

               <sourcepath>
                    <pathelement path="${derby.client.src.dir}" />
                    <pathelement path="${derby.demo.src.dir}" />
                    <pathelement path="${derby.drda.src.dir}" />
                    <pathelement path="${derby.engine.src.dir}" />
                    <pathelement path="${derby.shared.src.dir}" />
                    <pathelement path="${derby.storeless.src.dir}" />
                    <pathelement path="${derby.tools.src.dir}" />
                </sourcepath>

which is supposed to take care of that. Hmm, what is written during the <emma-report> target in your run? When I run <emma-all> I see a lot of output as emma scans through my source and creates the reports.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574553#action_12574553 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

Thank you Dyre!

I've started on a wiki page here: http://wiki.apache.org/db-derby/CodeCoverageWithEMMA

Hopefully that has enough information for you to use the emma targets.

The junit-single target works the same way as the junit-all and junit-simple targets. They all require you to set the classpath to point to your Derby classes or jars. If you are using ant 1.6.5 you must also have junit.jar and ant-junit.jar in your classpath. I don't have this problem with ant 1.7.

To configure the classpath when running junit targets I have been using the property derby.junit.classpath. I guess you can just set your CLASSPATH env var as well, or use the -lib option for ant, I haven't tried.

When you use the emma targets (emma-single and emma-all) you don't have to worry about the classpath, this is overridden by the emma targets. You have to download emma.jar and emma_ant.jar (in addition to junit.jar) and place them under tools/java/ in your sandbox. You must build your jars as usual, either sane or insane, and then you can use the emma targets.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574553#action_12574553 ] 

vemund edited comment on DERBY-3445 at 3/3/08 7:34 AM:
----------------------------------------------------------------

Thank you Dyre!

I've started on a wiki page here: http://wiki.apache.org/db-derby/CodeCoverageWithEMMA

Hopefully that has enough information for you to use the emma targets.

The junit-single target works the same way as the junit-all and junit-system-mini targets. They all require you to set the classpath to point to your Derby classes or jars. If you are using ant 1.6.5 you must also have junit.jar and ant-junit.jar in your classpath. I don't have this problem with ant 1.7.

To configure the classpath when running junit targets I have been using the property derby.junit.classpath. I guess you can just set your CLASSPATH env var as well, or use the -lib option for ant, I haven't tried.

When you use the emma targets (emma-single and emma-all) you don't have to worry about the classpath, this is overridden by the emma targets. You have to download emma.jar and emma_ant.jar (in addition to junit.jar) and place them under tools/java/ in your sandbox. You must build your jars as usual, either sane or insane, and then you can use the emma targets.

      was (Author: vemund):
    Thank you Dyre!

I've started on a wiki page here: http://wiki.apache.org/db-derby/CodeCoverageWithEMMA

Hopefully that has enough information for you to use the emma targets.

The junit-single target works the same way as the junit-all and junit-simple targets. They all require you to set the classpath to point to your Derby classes or jars. If you are using ant 1.6.5 you must also have junit.jar and ant-junit.jar in your classpath. I don't have this problem with ant 1.7.

To configure the classpath when running junit targets I have been using the property derby.junit.classpath. I guess you can just set your CLASSPATH env var as well, or use the -lib option for ant, I haven't tried.

When you use the emma targets (emma-single and emma-all) you don't have to worry about the classpath, this is overridden by the emma targets. You have to download emma.jar and emma_ant.jar (in addition to junit.jar) and place them under tools/java/ in your sandbox. You must build your jars as usual, either sane or insane, and then you can use the emma targets.
  
> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574529#action_12574529 ] 

Dyre Tjeldvoll commented on DERBY-3445:
---------------------------------------

I can confirm that SysinfoLocaleTest runs OK with this patch applied.

Patch file: 3445-SysinfoLocaleTest-diff
Committed revision 633101.



> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard updated DERBY-3445:
-----------------------------------

    Derby Info: [Patch Available]

Seems I forgot to tick the patch available box when I uploaded the patch for emma-clean: 3445-emma-clean-fix-diff

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576300#action_12576300 ] 

djd edited comment on DERBY-3445 at 3/7/08 9:52 AM:
----------------------------------------------------------------------

Thinking a little more I'm not sure the network server removing its security manager is a good idea. It would allow any code in shutdown hooks to have free use of the jvm.

A better long term solution would be to allow a set of policies to be added into the network server's default set. E.g. could add this policy file  emma.policy:

grant codebase "... path to emma jars" {
   // permissions needed
}

java -jar derbyrun.jar server -additionalPolicy emma.policy start

This would then be logically added into the permission set that Derby installs automatically.

      was (Author: djd):
    Thinking a little more I'm not sure the network server removing its security manager is a good idea. It would allow any code in shutdown hooks to have free use of the jvm.

A better long term solution would be to allow a set of policies to be added into the network server's default set. E.g. could add this policy file:

grant codebase "... path to emma jars" {
   // permissions needed
}

This would then be logically added into the permission set that Derby installs automatically.
  
> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575167#action_12575167 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

On the source code level, are you compiling with debug=true?
I see messages of the form package [yyy] contains class [xxx.class] without full debug info.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard resolved DERBY-3445.
------------------------------------

    Resolution: Fixed

I don't  plan to spend more time on this issue. To clearly separate the work that has been completed as part of this issue from what has not, I have created two new Jira reports related to running tests with EMMA to cover work that I think would be useful to do: DERBY-3647 and DERBY-3648.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573459#action_12573459 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

Won't the changes to SysinfoLocaleTest make the test fail if the tests are run without EMMA jars in the classpath, which is the typical case?

     private static void runSysinfo() throws Exception {
         final String className = "org.apache.derby.tools.sysinfo";
+        final String emmaClassName = "com.vladium.emma.EMMAException";
         URL[] urls = {
             Class.forName(className).getProtectionDomain().
+                    getCodeSource().getLocation(),
+            Class.forName(emmaClassName).getProtectionDomain().
                     getCodeSource().getLocation()
         };


> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dyre Tjeldvoll updated DERBY-3445:
----------------------------------

    Derby Info:   (was: [Patch Available])

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Optional permissions in policy files

Posted by Vemund Ostgaard <Ve...@Sun.COM>.
Based on Dans suggestions to fix an issue with my patch for DERBY-3445, 
I read up a bit more on policy files and discovered a feature that can 
be used to make parts of the policy file optional. Since I didn't know 
about this feature myself, I thought I'd share it with the community, as 
I think it could be useful if you are trying to figure out how to get a 
test to run with the security manager.

I found the following details on property expansion in policy files 
here: 
http://java.sun.com/j2se/1.4.2/docs/guide/security/PolicyFiles.html#PropertyExp 


---
Also note: If a property can't be expanded in a grant entry, permission 
entry, or keystore entry, that entry is ignored. For example, if the 
system property "foo" is not defined and you have:

    grant codeBase "${foo}" {
      permission ...;
      permission ...;
    };

then all the permissions in this grant entry are ignored. If you have

    grant {
      permission Foo "${foo}";
      permission Bar;
    };

then only the "permission Foo..." entry is ignored. And finally, if you 
have

    keystore "${foo}";

then the keystore entry is ignored.
---

So, if you have some permission you want to be used only in special 
circumstances, it can be controlled for instance by using a property 
that is either not set (disabled) or set to an empty string (enabled). 
Adding this property to some part of the permissions you want to be 
optional means that these permissions are enabled when the property is 
set and ignored if the property is not set. Since the property is just 
set to an empty string, the permission itself is not affected in any way 
by the property.

Vemund

Daniel John Debrunner (JIRA) wrote:
>     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572140#action_12572140 ] 
>
> Daniel John Debrunner commented on DERBY-3445:
> ----------------------------------------------
>
> It's a concern that permissions are always granted to derby.jar, even though they are only needed if performing code coverage with EMMA.
> This creates an opportunity where Derby code could unknowingly start to depend on those permissions.
>
> These permissions are as follows, are they needed for all code in the stack, or just a subset?
>
> +    // These permissions are needed when testing code instrumented with EMMA.
> +    permission java.util.PropertyPermission "user.dir", "read";
> +    permission java.io.FilePermission "${user.dir}${/}coverage.ec", "read";
> +    permission java.lang.RuntimePermission "writeFileDescriptor";
>
> A work-around may be to add separate sections in the policy file, e.g. if these permissions are only needed for a subset of jars then:
>
>  grant codebase "${emmaActive}/derby.jar" {
>    permission java.util.PropertyPermission "user.dir", "read";
>    permission java.io.FilePermission "${user.dir}${/}coverage.ec", "read";
>    permission java.lang.RuntimePermission "writeFileDescriptor";
> };
>
> then emmaActive is only set when running code coverage with EMMA. It possible a similar trick could be done if they are needed for all code,
> something that resolves to:
>  grant  {
>    permission java.util.PropertyPermission "user.dir", "read";
>    permission java.io.FilePermission "${user.dir}${/}coverage.ec", "read";
>    permission java.lang.RuntimePermission "writeFileDescriptor";
> };
>
> if and only if some emma property is set


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572140#action_12572140 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

It's a concern that permissions are always granted to derby.jar, even though they are only needed if performing code coverage with EMMA.
This creates an opportunity where Derby code could unknowingly start to depend on those permissions.

These permissions are as follows, are they needed for all code in the stack, or just a subset?

+    // These permissions are needed when testing code instrumented with EMMA.
+    permission java.util.PropertyPermission "user.dir", "read";
+    permission java.io.FilePermission "${user.dir}${/}coverage.ec", "read";
+    permission java.lang.RuntimePermission "writeFileDescriptor";

A work-around may be to add separate sections in the policy file, e.g. if these permissions are only needed for a subset of jars then:

 grant codebase "${emmaActive}/derby.jar" {
   permission java.util.PropertyPermission "user.dir", "read";
   permission java.io.FilePermission "${user.dir}${/}coverage.ec", "read";
   permission java.lang.RuntimePermission "writeFileDescriptor";
};

then emmaActive is only set when running code coverage with EMMA. It possible a similar trick could be done if they are needed for all code,
something that resolves to:
 grant  {
   permission java.util.PropertyPermission "user.dir", "read";
   permission java.io.FilePermission "${user.dir}${/}coverage.ec", "read";
   permission java.lang.RuntimePermission "writeFileDescriptor";
};

if and only if some emma property is set.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-testspecific-diff
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Manjula Kutty (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573463#action_12573463 ] 

Manjula Kutty commented on DERBY-3445:
--------------------------------------

Like Dan suggested, Can you please upload and readme file for how to use Emma with your changes? 

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575032#action_12575032 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

The target emma-clean fails if the folder to be removed does not exist, this causes problems with scripts that always attempt to do an emma-clean before running tests.
(junit-clean succeeds if there is nothing to clean up)

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Dyre Tjeldvoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574571#action_12574571 ] 

Dyre Tjeldvoll commented on DERBY-3445:
---------------------------------------

Patch file: 3445-singletest-diff
Committed revision 633135.

Thank you for the patch Vemund. Yes, I did get it to work. I was using ant 1.7, but I also needed to set ANT_HOME to ant 1.7. And, as you point out, I needed to set the classpath manually. I was a bit surprised by this as I had expected it to use classes or jars by default, and let you override as necessary. Setting it explicitly works fine, though.

I even ran CacheSessionDataTest with emma and could confirm that all methods (except toString()) in the class I added for DERBY-3192 (PiggyBackSessionData) had been executed. Nice!




> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576300#action_12576300 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

Thinking a little more I'm not sure the network server removing its security manager is a good idea. It would allow any code in shutdown hooks to have free use of the jvm.

A better long term solution would be to allow a set of policies to be added into the network server's default set. E.g. could add this policy file:

grant codebase "... path to emma jars" {
   // permissions needed
}

This would then be logically added into the permission set that Derby installs automatically.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572905#action_12572905 ] 

Vemund Østgaard commented on DERBY-3445:
----------------------------------------

I haven't found any problems with this change and ant 1.6. My experience with ant 1.6 is that to get things to work you need to use one of the workarounds described here: http://ant.apache.org/faq.html#delegating-classloader-1.6:

   1.  put all external libraries you need in CLASSPATH as well this is not what you want, otherwise you wouldn't have found this FAQ entry.
   2. put all external libraries you need in ANT_HOME/lib or .ant/lib. This probably still isn't what you want, but you might reconsider the .ant/lib option.
   3. Always start Ant with the -lib command line switch and point to your external libraries (or the directories holding them).
   4. remove the class that loads the external library from the coreloader.

So, basically my change has no effect with ant 1.6, it neither helps nor harms as far as I can understand. I am able to test with ant 1.6 if I for instance use the -lib option with ant.

If you are using ant 1.7 with my patch you just need to have junit.jar under your tools/java/ directory where the ant properties expect it to be. In my work environment that is a better solution than the various workarounds for ant 1.6.



> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Vemund Østgaard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vemund Østgaard updated DERBY-3445:
-----------------------------------

    Attachment: 3445-singletest-codeline-jars-diff

Another patch with two small changes:

1. Some explanation in the build.xml file for how the emma-targets are to be used. 

2. A new target 'junit-single-codeline-jars' which mirrors the 'junit-all-codeline-jars' and 'junit-system-mini-codeline-jars' targets. This target sets the classpath to your compiled jarfiles and runs 'junit-single', so if you don't want to set the classpath manually this target could be used.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by Vemund Ostgaard <Ve...@Sun.COM>.
Bryan Pendleton wrote:
> > As a follow on patch it would be great to have comments explaining the
> > new emma targets in the top-level build.xml file including a quick
> > summary of how to use them.
I've added some comments explaining how to use the new targets in a 
patch I uploaded today.
> >
> > E.g. what does one need to download (versions etc.), where does it 
> get put.
>
> Alternatively, or perhaps in addition, this seems worthy of a page
> in our wiki, similar to the very useful page on how to run the junit 
> targets.
I've added a wiki page as well, here: 
http://wiki.apache.org/db-derby/CodeCoverageWithEMMA

I hope the explanations make sense.

Vemund

Re: [jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by Bryan Pendleton <bp...@amberpoint.com>.
 > As a follow on patch it would be great to have comments explaining the
 > new emma targets in the top-level build.xml file including a quick
 > summary of how to use them.
 >
 > E.g. what does one need to download (versions etc.), where does it get put.

Alternatively, or perhaps in addition, this seems worthy of a page
in our wiki, similar to the very useful page on how to run the junit targets.

thanks,

bryan


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573458#action_12573458 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

As a follow on patch it would be great to have comments explaining the new emma targets in the top-level build.xml file including a quick summary of how to use them.

E.g. what does one need to download (versions etc.), where does it get put.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-general-diff, 3445-general-diffv2, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3445) Make it easier to use the EMMA tool to measure the code coverage of the Derby testing

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577982#action_12577982 ] 

Daniel John Debrunner commented on DERBY-3445:
----------------------------------------------

When running junit-single, if the test fails the build is successful, it should fail.

> Make it easier to use the EMMA tool to measure the code coverage of the Derby testing
> -------------------------------------------------------------------------------------
>
>                 Key: DERBY-3445
>                 URL: https://issues.apache.org/jira/browse/DERBY-3445
>             Project: Derby
>          Issue Type: Improvement
>          Components: Build tools
>            Reporter: Vemund Østgaard
>            Assignee: Vemund Østgaard
>         Attachments: 3445-emma-clean-fix-diff, 3445-general-diff, 3445-general-diffv2, 3445-singletest-codeline-jars-diff, 3445-singletest-diff, 3445-SysinfoLocaleTest-diff, 3445-testspecific-diff, 3445-testspecific-diffv2
>
>
> It is a bit tricky to use EMMA to measure code coverage for the derby testing.
> Modifications must be made to the source both to avoid problems with the SecurityManager and individual tests. It would be good if these modifcations could be done once and for all so that it was easier for anyone to run the tests with EMMA.
> It would also be good to have ant tasks that would make it even easier to run the tests with EMMA.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.