ethz-asl/continuous_integration

Should c++ unit tests on Jenkins be compiled (per default) with assertions turned on? (currently they are not!)

Closed this issue · 4 comments

In the past we switched from Debug build to Release because some tests would run for too long in Debug build. Unfortunately compromises are not that easy.

So far I see the following options:

  1. introduce a specific macro to enable assertions in spite of NDEBUG. Something like ASSERTIONS_ON. Of course this would then not enable the c "assert" macro. (this can be kind of hacked for many cases, though)
  2. create a custom build type e.g. as described here http://stackoverflow.com/questions/11437692/how-to-add-a-custom-build-type-to-cmake-targetting-make. Should be possible via command line arguments.
  3. try to change the compiler flags for an existing build type but that seems to be troublesome as well (http://stackoverflow.com/questions/28732209/change-default-value-of-cmake-cxx-flags-debug-and-friends-in-cmake).

In any case we could add command line options for the continuous integration scripts such that the Jenkins configuration can switch between different testing modes. But difficult decision would then be if we should change the default from the current Release to something else ..

Any comments or votes?

I would vote for yes per default because a) assertions help finding bugs in the non assertion code and b) assertions can contain bugs (actually sometimes they do not even compile without somebody realizing for a while!)

Vote for yes!
Option 2) seems easiest, no?

Does ethz-asl/schweizer_messer#162 help for the 1st option?

@ethz-asl/lab-ci-admins @ethz-asl/continuous_integration, any objections against PR #68 (basically turn on the new cpp macro ALWAYS_ASSERT for all jenkins catkin builds) ?

(Together with ethz-asl/schweizer_messer#162 the PR #68 would solve this issue #67 for team EUROPA2 :) )

Closing this because PR #68 is merged in.
For the reference: a ALWAYS_ASSERT macro is defined for every normal catkin build thanks to PR #68 and the follow up PR #69.