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

UT_CheckForOpenSockets prototype duplicated #901

Closed
skliper opened this issue Sep 22, 2020 · 2 comments · Fixed by #1085 or #1109
Closed

UT_CheckForOpenSockets prototype duplicated #901

skliper opened this issue Sep 22, 2020 · 2 comments · Fixed by #1085 or #1109
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Sep 22, 2020

Is your feature request related to a problem? Please describe.
Prototype defined in both cFE and OSAL.

/*****************************************************************************/
/**
** \brief Report and close any sockets found open
**
** \par Description
** Determine if any sockets are open; if so, close them. If UT_VERBOSE
** is defined then output the socket status to the test log file.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \returns
** This function does not return a value.
**
******************************************************************************/
void UT_CheckForOpenSockets(void);

https://github.com/nasa/osal/blob/f12d42ba58837a645d05eda3479d5f613ebad6c4/src/ut-stubs/utstub-helpers.h#L111-L115

Implemented here:
https://github.com/nasa/osal/blob/f12d42ba58837a645d05eda3479d5f613ebad6c4/src/ut-stubs/utstub-helpers.c#L195-L217

Also violation of magic number use in the implementation, and doesn't seem to actually do what it says (I don't see the close).

Describe the solution you'd like
Maybe remove if not useful? If not, at least use the correctly scoped prototype and remove the second definition.

Describe alternatives you've considered
None.

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper
Copy link
Contributor Author

skliper commented Sep 23, 2020

@jphickey - you aware of the logic behind why it was done this way?

@jphickey
Copy link
Contributor

@jphickey - you aware of the logic behind why it was done this way?

This was an ugly backdoor from long ago to mimic some logic in the SB test that would confirm that all OSAL queues were indeed cleaned up by the test case. Basically it just flags anything still open.

There is no need to close the open sockets in the current implementation. In a very old implementation, this was required because the sockets were quasi-real entities even in UT and not closing them would interfere with future tests. In the modern OSAL stubs just by resetting the UT state (which is done every test) you start with a clean slate every time.

Ideally there should be a better way to do this locally and only on tests that are related to cleanup. I can investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants