Template Function osrf_testing_tools_cpp::memory_tools::quickstart_gtest_setup

Function Documentation

template<typename ...Args>
bool osrf_testing_tools_cpp::memory_tools::quickstart_gtest_setup(Args&&... args)

Quickstart function for enabling memory tools when using with googletest.

This function will initialize memory tools, setup callbacks for unexpected calls to each memory function and make gtest fail (non-fatal, i.e. EXPECT and not ASSERT) if unexpected memory calls are made, and then enable in the current thread monitoring.

If you want monitoring in all threads you will need to enable that yourself.

After calling this, you can use the EXPECT_NO_MEMORY_OPERATIONS and related macros.

Even after this memory tools may not be working (if LD_PRELOAD was not used) or if you’re on an operating system that doesn’t support memory tools.

Parameters are forwarded to the QuickstartConfiguration class’s constructor.

Returns:

true if memory tools is working, and false if not