-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google tests run twice #31027
Comments
There is another piece of information I came across, which I also do not understand why is it happening, and for which I think it is a pre-requisite for C++ configs to work. In in test/prj.conf file, instead of having
I put
and try to build that, I get the following output: And I cannot figure out why is always |
Are you using |
One likely cause: Zephyr initializes C++ static objects during the kernel startup code, rather than when the C runtime infrastructure iterates over them before starting. If gtest uses static objects (probably does) then they may be being initialized twice, which might cause them to run twice. I don't think gtest is likely to work well with C++ in Zephyr, where C++ is not a first-class citizen. |
Yes, I am using |
If that works, yes. I've never used |
I'm going to close this, because there's a workaround even though the use of gtest with Zephyr and C++ isn't really supported. If there are objections it can be re-opened as a low-priority enhancement. |
@mejtejt I am trying to integrate |
Describe the bug
I am unit testing my C++ code with google test framework in Zephyr. When, inside of the tests folder prj.conf file, I enable
CONFIG_CPLUSPLUS=y
CONFIG_LIB_CPLUSPLUS=y
tests are executed twice.
Expected behavior
I want tests to run once.
Logs and console output
The following screen shot represents the structure of my project:
The following is the content of CMakeLists.txt file in test folder.
At this point, prj.conf file in test folder is empty. Running the tests results in the following output:
However, when in test prj.conf file, I add
tests are executed twice:
I cannot figure out what is the root cause of this behavior. Is -gtest_repeat=2 set somehow? I don't know really how to debug this and find the reason. Any help is greatly appreciated.
Thanks.
The text was updated successfully, but these errors were encountered: