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

Black Box Unit Tests Do Not Ensure Resources Are Cleaned Up Between Tests #197

Closed
skliper opened this issue Sep 30, 2019 · 3 comments · Fixed by #948 or #956
Closed

Black Box Unit Tests Do Not Ensure Resources Are Cleaned Up Between Tests #197

skliper opened this issue Sep 30, 2019 · 3 comments · Fixed by #948 or #956
Assignees
Labels
enhancement unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Sep 30, 2019

Unit tests should utilize a SetUp and TearDown approach to ensure each test runs in an expected and known configuration.

The TearDown function needs to ensure that all test objects and resources have been deallocated and cleanup.

@skliper skliper self-assigned this Sep 30, 2019
@skliper
Copy link
Contributor Author

skliper commented Sep 30, 2019

Imported from trac issue 174. Created by sstrege on 2016-08-08T15:44:40, last modified: 2019-08-14T14:11:46

@skliper skliper removed their assignment Sep 30, 2019
@skliper
Copy link
Contributor Author

skliper commented Dec 3, 2020

ut_assert now has UtTest_AddStartup and UtTest_AddTeardown to support setup and teardown. Action to close this issue is to scrub unit tests to confirm cleaning up.

@skliper skliper added the unit-test Tickets related to the OSAL unit testing (functional and/or coverage) label Dec 3, 2020
@skliper skliper added this to the 6.0.0 milestone Dec 3, 2020
@jphickey
Copy link
Contributor

jphickey commented Apr 2, 2021

One potential issue here is that we don't have the equivalent teardown function for e.g. OS_API_Init(). Once we set up OSAL it is expected to remain set up until a reboot. While all user-created objects in OSAL can be deleted, the OSAL itself and its internal objects cannot be cleaned up via the current API.

If the intent is to allow multiple tests to be run on system like VxWorks, without a reboot in between, then we'll likely need to implement #871 to allow this to happen.

Otherwise all user objects can be easily cleaned up by making sure every test program has a Teardown function that invokes OS_DeleteAllObjects() (this shouldn't be a big deal to implement).

jphickey added a commit to jphickey/osal that referenced this issue Apr 7, 2021
Invoke OS_API_Teardown to reset state for next test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants