Skip to content
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

Adding support of googletest / googlemock #83689

Open
anobli opened this issue Jan 8, 2025 · 1 comment
Open

Adding support of googletest / googlemock #83689

anobli opened this issue Jan 8, 2025 · 1 comment
Labels
area: Test Framework Issues related not to a particular test, but to the framework instead RFC Request For Comments: want input from the community

Comments

@anobli
Copy link
Contributor

anobli commented Jan 8, 2025

Introduction

Zephyr already provide an awesome test suite that work very well with C but seems more limited with C++.
It would be great having googletest and googlemock available in Zephyr for testing complex C++ libraries or applications.

Problem description

I guess the major issue is mocking a C++ class is not easily doable and is quite limited with the current test suite.
In addition, gmock and gtest are widely used, supporting it in zephyr would simplify writing C++ tests.

Proposed change

Create a googletest external module that could be used to write tests using gmock and gtest.

Proposed change (Detailed)

I would to update googletest to support Zephyr, update it to make it an external module.
I guess that Zephyr OS support itself should accepted upstream, not sure about the external module changes so we may have to fork googletest.
I would also adds some unit tests example written with gtest to demonstrate how using it with twister, and also, to make sure the test suite is working correctly.
There is also some changes to do in gtest harness (I need to check if this still the case on master) . I am not sure why, it was not able to parse the tests output.

Dependencies

This would add a new component, googletest to zephyr. I think we could make it optional since I think it should only downloaded if this is actually used by a project. Ideally, all the required changes in googletest would be upstream. If this is not the case, we may to fork it.

Alternatives

I have looked for some alternatives for testing / mocking C++ code but I have not found anything already supported by Zephyr.
In addition, I am working on projects already using it.

@anobli anobli added the RFC Request For Comments: want input from the community label Jan 8, 2025
Copy link

github-actions bot commented Jan 8, 2025

Hi @anobli! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

@henrikbrixandersen henrikbrixandersen added the area: Test Framework Issues related not to a particular test, but to the framework instead label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Test Framework Issues related not to a particular test, but to the framework instead RFC Request For Comments: want input from the community
Projects
Status: No status
Development

No branches or pull requests

2 participants