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
FreeRTOS linux port and GoogleTest #45
Comments
I am interesting in using this project in the same way - testing a FreeRTOS codebase on Linux using the port. Did you find a solution to this issue? |
There was an extensive conversation regarding vTaskEndScheduler() a while back. The summary is that this is a limitation of FreeRTOS itself. FreeRTOS never really expects that vTaskEndScheduler() will actually be called, which makes sense if you've ever coded a small embedded system. Reference: |
I actually have found a solution. Here the code: Please note that I have just manually copied the code from an offline machine, it could contains typos (if you find them, please leave a comment). I have built that "alternative" gtest_main for FreeRTOS based on a discussion thread I had found online (unfortunately I have lost the link to the discussion). I can tell you that with the latest GCC/Posix port it works very well IF:
Link to the POSIX port I am using: |
Thanks Marco, that looks very promising! Only 2 typos: |
@matt-duke I'm very sorry for the late answer, I've completely forgot to answer your message. First of all thanks for pointing out those typos, I've fixed the gist. |
Closing because this is not a FreeRTOS add-on issue. This is a known issue with FreeRTOS itself. |
Hello,
I have added your posix port to my codebase because I wanted to do some TDD using GoogleTest.
The first test runs just fine: at the end of the unit tests I can destroy all my tasks and call vTaskEndSheduler().
The problem is that vTaskEndSheduler(), beside stopping the scheduler, it also destroys some variables statically initialized (a pair of mutexes and something else). I've tried to add a new function to initialize again the static variables declared in port.c with the idea of calling it at the beginning of each unit test, without success.
As workaround I could use the GoogleTest --filter functionality to execute each test in a dedicated process, but I don't like this option a lot.
Any idea?
Thanks,
Marco
The text was updated successfully, but these errors were encountered: