Functional Testing

I am trying to write tests for a new module. I have been able to successfully write and run unit tests, but the functional tests do not compile. During linking, I get this error:

/home/jonathan/Testing/px4-autopilot/platforms/posix/src/px4/common/px4_daemon/pxh.cpp:119: error: undefined reference to 'list_builtins(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int (*)(int, char**), std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int (*)(int, char**)> > >&)'
collect2: error: ld returned 1 exit status
make[4]: *** [src/modules/test/CMakeFiles/functional-test.dir/build.make:118: functional-test] Error 1
make[3]: *** [CMakeFiles/Makefile2:15413: src/modules/test/CMakeFiles/functional-test.dir/all] Error 2
make[3]: *** Waiting for unfinished jobs....

This error still occurs even when all of the code does pretty much nothing. Here is a minimal reproducible example.

modules/test/test.h

namespace my_tests {
    class MyClass {
    public:
        void MyFunction();
        int param;
    };
}

modules/test/test.cpp

#include "test.h"

namespace my_tests {
    MyClass::MyFunction() { param = 10; }
}

testTest.cpp

#include <gtest/gtest.h>
#include <test/test.h>

using namespace my_tests;

class MyClassTest : public ::testing::Test, public MyClass {
public:
};

TEST_F(MyClassTest, FirstTest) {
    ASSERT_EQ(0,0);
}

CMakeLists.txt

px4_add_library(TestLib test.cpp)
px4_add_functional_gtest(SRC testTest.cpp LIBS TestLib)

The other functional tests that come with the code work fine, but I can’t find the difference between my code and that code.

It seems that the code must call hrt_absolute_time(); at some point. I’m not sure why this is the case or when it must be called by, but adding a constructor to MyClass that makes this call allows the code to compile.

modules/test/test.cpp

#include "test.h"
#include <drivers/drv_hrt.h>

namespace my_tests {
    MyClass::MyClass() {
        hrt_absolute_time();
    }
}

Does anyone know why this call is required in order for to avoid the linker errors that I mentioned in the original post? The errors are very obscure and I don’t see why adding this function call resolves those issues.