You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Alex Huang <Al...@citrix.com> on 2013/06/12 02:17:55 UTC

Please run with assert on when you're developing...

Hi All,

CloudStack code have many asserts to guarantee code is written correctly for the developers.  I recently realized that since we've converted to maven, we no longer run with assert on as developers.  It is very important that we do because it will find problems for you during load time and run time.

To run with assert on, you can add "-ea" to MAVEN_DEBUG_OPTS.  

I tried this recently and there are many places that are asserting.  Please do a run and fix what you can.

Thanks.

--Alex

RE: Please run with assert on when you're developing...

Posted by Alex Huang <Al...@citrix.com>.
Some (ok one) have asked me what is MAVEN_DEBUG_OPTS.  That's my bad for not being clear.

Adding "-ea" to MAVEN_OPTS will cause assert to be on for maven and maven's plugins as well.  That means during clean, install stages, you might hit some weird asserts (according to others experience on the web).

So what I did is added it to the script mvnDebug which utilizes MAVEN_DEBUG_OPTS.  When I run jetty:run, I always use mvnDebug which sets up the debug port for the jvm and with this change also run in assert mode.  You always want to use mvnDebug for your own testing of the server anyways because you can easily attach for debugging purposes.

The drawback to doing it this way is that the unit tests that are ran during the install stage do not hit asserts.  (I think but haven't confirmed yet.)

--Alex

> -----Original Message-----
> From: Alex Huang [mailto:Alex.Huang@citrix.com]
> Sent: Tuesday, June 11, 2013 5:18 PM
> To: dev@cloudstack.apache.org
> Subject: Please run with assert on when you're developing...
> 
> Hi All,
> 
> CloudStack code have many asserts to guarantee code is written correctly for
> the developers.  I recently realized that since we've converted to maven, we
> no longer run with assert on as developers.  It is very important that we do
> because it will find problems for you during load time and run time.
> 
> To run with assert on, you can add "-ea" to MAVEN_DEBUG_OPTS.
> 
> I tried this recently and there are many places that are asserting.  Please do a
> run and fix what you can.
> 
> Thanks.
> 
> --Alex

Re: Please run with assert on when you're developing...

Posted by John Burwell <jb...@basho.com>.
+100
On Jun 11, 2013, at 8:17 PM, Alex Huang <Al...@citrix.com> wrote:

> Hi All,
> 
> CloudStack code have many asserts to guarantee code is written correctly for the developers.  I recently realized that since we've converted to maven, we no longer run with assert on as developers.  It is very important that we do because it will find problems for you during load time and run time.
> 
> To run with assert on, you can add "-ea" to MAVEN_DEBUG_OPTS.  
> 
> I tried this recently and there are many places that are asserting.  Please do a run and fix what you can.
> 
> Thanks.
> 
> --Alex