lundi 5 octobre 2015

Googletest does not find tests defined with TEST_F

We are building a C++ library for Android and iOS. We use gtest for unit tests. We have the following setup:

libMain.so <- contains our product
libtest.a <- contains the unit tests
test_executable <- contains google test code and the 2 libs. runs the tests

I push test_executable onto an android device and run it.

When I link them together with our library it does not find the tests declared in libtest.a (they are declared with TEST_F). It runs fine but the tests are omitted.

Our project is generated by gyp. If I add GENERATE_MASTER_OBJECT_FILE=YES and run them on iOS the tests get found. I read that GENERATE_MASTER_OBJECT_FILE is the same as adding '-r' to the linker flags. But on iOS our libMain is static. If I add '-r' to this setup it complains that '-r' does not work when linking with with a shared library.

It seems like I have to find a way to tell ld to expose the test symbols event tough it wants to hide them?

Aucun commentaire:

Enregistrer un commentaire