testing::InitGoogleTest() before calling RUN_ALL_TESTS() #4151
Unanswered
ivanwagner
asked this question in
Community Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear all,
I have a test application which relies on Zephyr (RTOS) and I run all my unit tests using gtest.
The main function looks like the following:
This is done because the application entry point is not under my control and but I can fetch CLI arguments by calling native_get_test_cmd_line_args.
At this point I need to elaborate the args in order to give gtest what he expects. In fact the Zephyr application has its own args but there is a flag called -testargs where you actually append everything which is related for the tests. I've noticed that to make gtest_filter arg work, gtest looks for it after arg position 0. For this reason I rewrite the args passed to gtest prepending "test".
The final exe is called like this:
./zephyr -testargs gtest_filter=*
I am getting the following notice after executing:
IMPORTANT NOTICE - DO NOT IGNORE:
This test program did NOT call testing::InitGoogleTest() before calling RUN_ALL_TESTS(). This is INVALID. Soon Google Test will start to enforce the valid usage. Please fix it ASAP, or IT WILL START TO FAIL.
How should I fix this? In fact I do call InitGoogleTest before RUN_ALL_TESTS as shown in the above example.
Thank you for the support
Ivan
Beta Was this translation helpful? Give feedback.
All reactions