cyclus/cyclus — pull request #911 by scopatz (2014-05-27 01:46:37+00:00)
Title: Clang Fix & Gtest Update

This PR implements a fix for the cyclus cli when built with clang on linux for linking to gtest. The essence of the fix is that when gtest code is dynamically linked in - even when it is completely ignored - creates some (likely static) test framework objects. When the SO is unloaded, these objects are destroyed and their destructors are called, which in turn tries to delete other objects. This is bad if you never constructed them in the first place!

So this PR simply makes sure that gtest is initialized with no arguments prior to doing anything else in the main() function. Note that the RUN_ALL_TESTS() function is *not* called. This should have minimal performance impact as it really is just setting up some empty objects so that they can be torn down safely later. This fix is implemented in such a way that it is only compiled and linked in iff we happen to be on clang and linux.

I figured this one out by noting that the unit tests still ran even though the cli was borking. Furthermore, it turns out that the gtest_main file only has a handful of real lines, one of which is a print.

Lastly, somewhat sheepishly, this PR includes an update to Gtest v1.7.0. We should be updating GTest as we go so this is likely somewhat overdue.

On my machine, all cyclus & cycamore unit, integration, and regression tests pass for clang and gcc.