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

Fix #550, add function groups to ut assert #554

Merged

Conversation

jphickey
Copy link
Contributor

@jphickey jphickey commented Aug 5, 2020

Describe the contribution

Clean up and Refactor the internal list storage structures to support having multiple list heads/groups. Define a separate list/group for setup, normal test, and teardown.

The existing UtTest_Add() routine maps to the normal test group. Added a UtTest_AddSetup() and UtTest_AddTeardown() routine that maps to the setup and teardown group, respectively.

The existing UtTest_Run() routine then merges the groups and executes the full suite of tests.

This allows separate, dynamic registration of test setup and teardown routines which are executed before and after the normal test routine, which can create and delete any global/common test prerequisites.

Fixes #550

Testing performed
Build and run all unit tests
Update a unit test to additionally register separate setup and teardown functions and confirm that these are always run first and last, respectively.

Expected behavior changes
Test programs may now register global setup and teardown routines.

System(s) tested on
Ubuntu 20.04

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

Clean up and Refactor the internal list storage structures to support
having multiple list heads/groups.  Define a separate list/group for
setup, normal test, and teardown.

The existing UtTest_Add() routine maps to the normal test group.
Added a UtTest_AddSetup() and UtTest_AddTeardown() routine that maps
to the setup and teardown group, respectively.

The existing UtTest_Run() routine then merges the groups and executes
the full suite of tests.

This allows separate, dynamic registration of test setup and teardown
routines which are executed before and after the normal test routine,
which can create and delete any global/common test prerequisites.
@jphickey jphickey marked this pull request as ready for review August 5, 2020 14:41
@jphickey jphickey added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Aug 5, 2020
@astrogeco astrogeco added this to the 6.0.0 milestone Aug 5, 2020
@astrogeco
Copy link
Contributor

CCB 2020-08-05 APPROVED

@astrogeco astrogeco added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) labels Aug 12, 2020
@astrogeco astrogeco changed the base branch from main to integration-candidate August 14, 2020 00:12
@astrogeco astrogeco merged commit 23b225c into nasa:integration-candidate Aug 14, 2020
@skliper
Copy link
Contributor

skliper commented Aug 24, 2020

@jphicky Could this have caused UT_AddSubTests to no longer execute? I haven't dug in yet, but my subtests are no longer running.

@jphickey
Copy link
Contributor Author

I just checked the latest bundle and ran the SB unit tests (which are the only ones I know that use the UT_AddSubTest wrapper) and confirmed they all seem to be running fine.

Note that "subtest" is nothing more than a wrapper around the normal UtTest_Add with a naming convention. Unless there is an issue/bug regarding the name handling?

I did notice that it is doing a strdup which is no longer necessary - which is a memory leak that could be plugged now.

@jphickey jphickey deleted the fix-550-utassert-groups branch December 3, 2020 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add UtTest_Teardown() to ut_assert
3 participants