[Code Coverage] running tests leads to huge stacktrace
2011-03-30 12:26:27 GMT
Hi Stefan, Any reason for the -war argument? This post covers testing & test coverage with Grails on Hudson (pre-dates the Jenkins fork): http://leanjavaengineering.wordpress.com/2010/09/09/grails-testing-in-hudson/ Regards, Robin -- View this message in context: http://grails.1312388.n4.nabble.com/Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3417930p3417981.html Sent from the Grails - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
I'm facing the same problem using just
Hi Stefan,
Any reason for the -war argument?
This post covers testing & test coverage with Grails on Hudson (pre-dates
the Jenkins fork):
http://leanjavaengineering.wordpress.com/2010/09/09/grails-testing-in-hudson/
Regards,
Robin
--
View this message in context: http://grails.1312388.n4.nabble.com/Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3417930p3417981.html
Sent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Code coverage 1.2 is definitely working for me with Grails 1.3.5. Just tested again with "grails test-app -coverage -xml" against a test application (available from https://github.com/rbramley/GroovyMag29). Will upgrade the Grails version when I get a chance later on to see what happens... -- View this message in context: http://grails.1312388.n4.nabble.com/Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3417930p3418227.html Sent from the Grails - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
I'm using 1.3.6...
Code coverage 1.2 is definitely working for me with Grails 1.3.5.
Just tested again with "grails test-app -coverage -xml" against a test
application (available from https://github.com/rbramley/GroovyMag29).
Will upgrade the Grails version when I get a chance later on to see what
happens...
--
View this message in context: http://grails.1312388.n4.nabble.com/Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3417930p3418227.htmlSent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Robin,
I'm using 1.3.6...This is the output I've got: https://gist.github.com/894526[]s,Lucas Frare Teixeira .·.
- lucastex <at> gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex
On Wed, Mar 30, 2011 at 11:27 AM, rbramley <robin <at> rbramley.com> wrote:Code coverage 1.2 is definitely working for me with Grails 1.3.5.
Just tested again with "grails test-app -coverage -xml" against a test
application (available from https://github.com/rbramley/GroovyMag29).
Will upgrade the Grails version when I get a chance later on to see what
happens...
--
View this message in context: http://grails.1312388.n4.nabble.com/Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3417930p3418227.htmlSent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
I usually have this kind of exception when one of the files (plugin or jar) is corrupted. Maybe you could try to remove the plugins and folders from your disk to let them be downloaded again, hoping they won't be corrupted?
Robin,That output was when i just ran the code as you can see.But then, the test runs normally, after that I get another exception, I think it is the same..But as I said before, the test reports gets generated.[]s,
Lucas Frare Teixeira .·.
- lucastex <at> gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex
On Wed, Mar 30, 2011 at 11:43 AM, Lucas F. A. Teixeira <lucastex <at> gmail.com> wrote:I'm using 1.3.6...This is the output I've got: https://gist.github.com/894526[]s,Lucas Frare Teixeira .·.
- lucastex <at> gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex
On Wed, Mar 30, 2011 at 11:27 AM, rbramley <robin <at> rbramley.com> wrote:Code coverage 1.2 is definitely working for me with Grails 1.3.5.
Just tested again with "grails test-app -coverage -xml" against a test
application (available from https://github.com/rbramley/GroovyMag29).
Will upgrade the Grails version when I get a chance later on to see what
happens...
--
View this message in context: http://grails.1312388.n4.nabble.com/Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3417930p3418227.htmlSent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Hi Antoine,
I usually have this kind of exception when one of the files (plugin or jar) is corrupted. Maybe you could try to remove the plugins and folders from your disk to let them be downloaded again, hoping they won't be corrupted?On Wed, Mar 30, 2011 at 4:56 PM, Lucas F. A. Teixeira <lucastex <at> gmail.com> wrote:Robin,That output was when i just ran the code as you can see.But then, the test runs normally, after that I get another exception, I think it is the same..But as I said before, the test reports gets generated.[]s,
Lucas Frare Teixeira .·.
- lucastex <at> gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex
On Wed, Mar 30, 2011 at 11:43 AM, Lucas F. A. Teixeira <lucastex <at> gmail.com> wrote:I'm using 1.3.6...This is the output I've got: https://gist.github.com/894526[]s,Lucas Frare Teixeira .·.
- lucastex <at> gmail.com
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex
On Wed, Mar 30, 2011 at 11:27 AM, rbramley <robin <at> rbramley.com> wrote:Code coverage 1.2 is definitely working for me with Grails 1.3.5.
Just tested again with "grails test-app -coverage -xml" against a test
application (available from https://github.com/rbramley/GroovyMag29).
Will upgrade the Grails version when I get a chance later on to see what
happens...
--
View this message in context: http://grails.1312388.n4.nabble.com/Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3417930p3418227.htmlSent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
After facing the same problem for weeks, I finally took time to investigate it. It looks like some plugins (such as the export plugin) have non-jar files in their lib dir. As the AntClassLoader is going through each of the files in the classpath, the AntClassLoader.getResourceURL() method is called for each of them, and if the resource is a valid file, it attempts to open it as a ZipFile. When java.util.zip.ZipFile throws the exception because the file is not a zip file, the stacktrace is printed to the screen, causing the ugly stack we see in the console. Because I don't have enough knowledge about the Ant classpath loading, my solution was to simply remove the TXT license files which the export plugin put into it's lib directory. I realize this is a hacky fix and the problem will crop up again when we upgrade the plugin. But for now, it'll get rid of the stack trace. I hope this helps, Mike Joyce -- View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3491065.html Sent from the Grails - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Hi Mike, thank you very much for posting this. In which context do you get this error concerning the export plugin? I would like to fix this issue, currently I'm thinking about where one should put the license files that are related to those jars. Ideally those files shouldn't be picked up, because they are nor jar files. Best regards, Andreas 2011/5/2 Mike Joyce <multimike <at> gmail.com>: > After facing the same problem for weeks, I finally took time to investigate > it. It looks like some plugins (such as the export plugin) have non-jar > files in their lib dir. As the AntClassLoader is going through each of the > files in the classpath, the AntClassLoader.getResourceURL() method is called > for each of them, and if the resource is a valid file, it attempts to open > it as a ZipFile. When java.util.zip.ZipFile throws the exception because the > file is not a zip file, the stacktrace is printed to the screen, causing the > ugly stack we see in the console. > > Because I don't have enough knowledge about the Ant classpath loading, my > solution was to simply remove the TXT license files which the export plugin > put into it's lib directory. I realize this is a hacky fix and the problem > will crop up again when we upgrade the plugin. But for now, it'll get rid of > the stack trace. > > I hope this helps, > > Mike Joyce > > -- > View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3491065.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Hi Andreas,
Hi Mike,
thank you very much for posting this. In which context do you get this
error concerning the export plugin?
I would like to fix this issue, currently I'm thinking about where one
should put the license files that are related to those jars.
Ideally those files shouldn't be picked up, because they are nor jar files.
Best regards,
Andreas
2011/5/2 Mike Joyce <multimike <at> gmail.com>:> After facing the same problem for weeks, I finally took time to investigate
> it. It looks like some plugins (such as the export plugin) have non-jar
> files in their lib dir. As the AntClassLoader is going through each of the
> files in the classpath, the AntClassLoader.getResourceURL() method is called
> for each of them, and if the resource is a valid file, it attempts to open
> it as a ZipFile. When java.util.zip.ZipFile throws the exception because the
> file is not a zip file, the stacktrace is printed to the screen, causing the
> ugly stack we see in the console.
>
> Because I don't have enough knowledge about the Ant classpath loading, my
> solution was to simply remove the TXT license files which the export plugin
> put into it's lib directory. I realize this is a hacky fix and the problem
> will crop up again when we upgrade the plugin. But for now, it'll get rid of
> the stack trace.
>
> I hope this helps,
>
> Mike Joyce
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3491065.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
My understanding is that the test classpath includes all of the plugin lib directories ($GRAILS_HOME/scripts/_GrailsClasspath.groovy; testClasspath() closure), and all of the files in it. When the code-coverage plugin initializes it's ant task, it needs to load the "tasks.properties" out of the cobertura jar file ($PROJECT/plugins/code-coverage-1.2.4/scripts/_Events.groovy; defineCoberturaPathAndTasks() ). The "java.util.zip.ZipException: error in opening zip file" stack trace is shown as Ant is looping through every file on the classpath and opening it to see if it contains the desired "tasks.properties". When it hits the license files that the export plugin has in the lib directory, we see the stack trace since they are not zip files (jars).
After digging looking through the AntClassLoader closer, it looks like they intended to call log() instead of e.printStackTrace() when this exception occurs. Infact, in v1.8.0 of ant, that catch block has already been fixed to use the proper log() instead of just e.printStackTrace()... so if ant v1.8.0 was being used, then we're be able to ignore the logs via log config.
Since I don't think ant 1.8.0 is planning to be brought into Grails, I think the best solution is to have the license files in the export plugin removed from the lib directory.
Mike
Hi Andreas,when looking at grails plugins in general authors tend to use a LICENSE.txt file in the plugins main directory. Some of them simply list all licences of all plugin artefacts in there.So you could either extend your LICENSE.txt or put the others (itext, odf, jexcelapi, opencsv, xercesimpl) aside. Just a suggestion. << The bug affects me too.As an alternative approach the code-coverage plugin could ignore those ;)Cheers,KostaOn Tue, May 3, 2011 at 5:53 PM, Andreas Schmitt <[hidden email]> wrote:Hi Mike,
thank you very much for posting this. In which context do you get this
error concerning the export plugin?
I would like to fix this issue, currently I'm thinking about where one
should put the license files that are related to those jars.
Ideally those files shouldn't be picked up, because they are nor jar files.
Best regards,
Andreas
2011/5/2 Mike Joyce <[hidden email]>:> After facing the same problem for weeks, I finally took time to investigate
> it. It looks like some plugins (such as the export plugin) have non-jar
> files in their lib dir. As the AntClassLoader is going through each of the
> files in the classpath, the AntClassLoader.getResourceURL() method is called
> for each of them, and if the resource is a valid file, it attempts to open
> it as a ZipFile. When java.util.zip.ZipFile throws the exception because the
> file is not a zip file, the stacktrace is printed to the screen, causing the
> ugly stack we see in the console.
>
> Because I don't have enough knowledge about the Ant classpath loading, my
> solution was to simply remove the TXT license files which the export plugin
> put into it's lib directory. I realize this is a hacky fix and the problem
> will crop up again when we upgrade the plugin. But for now, it'll get rid of
> the stack trace.
>
> I hope this helps,
>
> Mike Joyce
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3491065.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3494736.htmlIf you reply to this email, your message will be added to the discussion below:To unsubscribe from Re: [Code Coverage] running tests leads to huge stacktrace, click here.
A better fix would be for the classpath to ignore any text files in plugin
lib folders. Can be achieved with the following patch:
--- grails-1.3.7/scripts/_GrailsClasspath.groovy.orig Wed Feb 16 07:14:06
2011
+++ grails-1.3.7/scripts/_GrailsClasspath.groovy Sat May 28 23:14:36 2011
@@ -119,7 +119,7 @@
def pluginLibDirs = pluginSettings.pluginLibDirectories.findAll {
it.exists() }
for (pluginLib in pluginLibDirs) {
- fileset(dir: pluginLib.file.absolutePath)
+ fileset(dir: pluginLib.file.absolutePath, excludes:'**/*.txt')
}
}
Robin
------
Twitter: @rbramley
Blog: http://leanjavaengineering.wordpress.com
--
View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3558137.html
Sent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
This seems to solve the problem so thanks for the simple fix.
Anyone see any undesirable side effects to this?
A better fix would be for the classpath to ignore any text files in plugin
lib folders. Can be achieved with the following patch:
--- grails-1.3.7/scripts/_GrailsClasspath.groovy.orig Wed Feb 16 07:14:06
2011
+++ grails-1.3.7/scripts/_GrailsClasspath.groovy Sat May 28 23:14:36 2011
<at> <at> -119,7 +119,7 <at> <at>
def pluginLibDirs = pluginSettings.pluginLibDirectories.findAll {
it.exists() }
for (pluginLib in pluginLibDirs) {
- fileset(dir: pluginLib.file.absolutePath)
+ fileset(dir: pluginLib.file.absolutePath, excludes:'**/*.txt')
}
}
Robin
------
Twitter: <at> rbramley
Blog: http://leanjavaengineering.wordpress.com
--
View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3558137.htmlSent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
That is perfect for me.
Mike
This seems to solve the problem so thanks for the simple fix.
Anyone see any undesirable side effects to this?On Sat, May 28, 2011 at 4:21 PM, rbramley <[hidden email]> wrote:
A better fix would be for the classpath to ignore any text files in plugin
lib folders. Can be achieved with the following patch:
--- grails-1.3.7/scripts/_GrailsClasspath.groovy.orig Wed Feb 16 07:14:06
2011
+++ grails-1.3.7/scripts/_GrailsClasspath.groovy Sat May 28 23:14:36 2011
<at> <at> -119,7 +119,7 <at> <at>
def pluginLibDirs = pluginSettings.pluginLibDirectories.findAll {
it.exists() }
for (pluginLib in pluginLibDirs) {
- fileset(dir: pluginLib.file.absolutePath)
+ fileset(dir: pluginLib.file.absolutePath, excludes:'**/*.txt')
}
}
Robin
------
Twitter: <at> rbramley
Blog: http://leanjavaengineering.wordpress.com
--
View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3558137.htmlSent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
- Edhttp://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3564205.htmlIf you reply to this email, your message will be added to the discussion below:To unsubscribe from Re: [Code Coverage] running tests leads to huge stacktrace, click here.
Nice tweak,
but you can still run into the problem with other non-"zip-py" files.
E.g. the tomcat .1.3.7.2 plugin comes with a "ivy-1.0.xml" file, which obviously
results in the same problem.
A better fix would be for the classpath to ignore any text files in plugin
lib folders. Can be achieved with the following patch:
--- grails-1.3.7/scripts/_GrailsClasspath.groovy.orig Wed Feb 16 07:14:06
2011
+++ grails-1.3.7/scripts/_GrailsClasspath.groovy Sat May 28 23:14:36 2011
<at> <at> -119,7 +119,7 <at> <at>
def pluginLibDirs = pluginSettings.pluginLibDirectories.findAll {
it.exists() }
for (pluginLib in pluginLibDirs) {
- fileset(dir: pluginLib.file.absolutePath)
+ fileset(dir: pluginLib.file.absolutePath, excludes:'**/*.txt')
}
}
Robin
------
Twitter: <at> rbramley
Blog: http://leanjavaengineering.wordpress.com
--
View this message in context: http://grails.1312388.n4.nabble.com/Re-Code-Coverage-running-tests-leads-to-huge-stacktrace-tp3418003p3558137.htmlSent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
RSS Feed