-
Notifications
You must be signed in to change notification settings - Fork 217
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 #1440, Split up BinSemGetInfo() to avoid partial success returns #1480
base: main
Are you sure you want to change the base?
Conversation
src/os/shared/src/osapi-binsem.c
Outdated
@@ -249,7 +249,7 @@ | |||
* See description in API and header file for detail | |||
* | |||
*-----------------------------------------------------------------*/ | |||
int32 OS_BinSemGetInfo(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) | |||
int32 OS_BinSemGetName(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
src/os/shared/src/osapi-binsem.c
Outdated
* See description in API and header file for detail | ||
* | ||
*-----------------------------------------------------------------*/ | ||
int32 OS_BinSemGetCreator(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
src/os/shared/src/osapi-binsem.c
Outdated
* See description in API and header file for detail | ||
* | ||
*-----------------------------------------------------------------*/ | ||
int32 OS_BinSemGetValue(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
* ----------------------------------------------------------------- | ||
*/ | ||
void UT_DefaultHandler_OS_BinSemGetInfo(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) | ||
void UT_DefaultHandler_OS_BinSemGetName(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
* Default handler implementation for 'OS_BinSemGetCreator' stub | ||
* ----------------------------------------------------------------- | ||
*/ | ||
void UT_DefaultHandler_OS_BinSemGetCreator(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
if (status == OS_SUCCESS && | ||
UT_Stub_CopyToLocal(UT_KEY(OS_BinSemGetCreator), bin_prop, sizeof(*bin_prop)) < sizeof(*bin_prop)) |
Check warning
Code scanning / CodeQL
Side effect in a Boolean expression Warning
* ---------------------------------------------------- | ||
*/ | ||
int32 OS_BinSemGetInfo(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) | ||
int32 OS_BinSemGetName(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
* Generated stub function for OS_BinSemGetCreator() | ||
* ---------------------------------------------------- | ||
*/ | ||
int32 OS_BinSemGetCreator(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) |
Check notice
Code scanning / CodeQL
Long function without assertion Note
Pretty simple change-set, although the change is 'breaking' I guess, so has to wait for a major release? Note - there is a single reference to |
I recommend just deprecating the old API vs fully removing, then it doesn't have to be a major release (at least per the old rules I used). See other uses of |
Good point. Will update it. |
0e2d950
to
6459099
Compare
@skliper I'm not sure if I did the deprecation guards correctly, but do you know if it's possible or have the debug and release builds pass the tests given that the deprecated elements are only removed in the debug workflow?
Is it trying to run the same set of tests, but with and without the deprecated code? (that doesn't seem to make sense right) (I'm assuming we only upkeep tests for the non-deprecated code...) |
I'm not really following your full question, but I recommend only wrapping the old API in the omit deprecated ifndef not the new stuff. Then hopefully the tests would pass? |
6459099
to
f8855ab
Compare
@@ -466,6 +466,8 @@ | |||
return (OS_GenericBinSemTake_Impl(token, &ts)); | |||
} | |||
|
|||
#ifdef OSAL_OMIT_DEPRECATED |
Check notice
Code scanning / CodeQL
Conditional compilation Note
@@ -243,13 +243,45 @@ | |||
return return_code; | |||
} | |||
|
|||
#ifdef OSAL_OMIT_DEPRECATED |
Check notice
Code scanning / CodeQL
Conditional compilation Note
UtAssert_INT32_EQ(OS_BinSemCreate(NULL, "Test_Sem", 0, 0), OS_INVALID_POINTER); | ||
UtAssert_INT32_EQ(OS_BinSemCreate(&sem_id[0], NULL, 0, 0), OS_INVALID_POINTER); | ||
UtAssert_INT32_EQ(OS_BinSemGetInfo(sem_id[0], NULL), OS_INVALID_POINTER); | ||
|
||
// Initialize sem_id[0] to a valid value for the following NULL checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests were not passing on 1/4 builds without this addition (Debug, Ubuntu 22.04).
Somehow, it behaves differently with the sem_id[0] not being set to a valid value on that target on the preceding line. With the added code though, all builds are fine.
OK all good now - it wasn't building for me locally but that might have been a symptom of my own build command. Tests passing with a small addition as per the above comment. |
Checklist
Describe the contribution
BinSemGetInfo()
API into 3, allowing clear success/failure (or not implemented) for each.Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).
Tested locally to confirm no loss of coverage compared with the current main branch, and all lines/branches/functions in the new version are covered.
Expected behavior changes
Removes this source of 'partial success' which can be confusing and also increases complexity for dealing with the return for users calling into this API.
System(s) tested on
Debian 12 using the current main branch of cFS bundle.
Contributor Info
Avi Weiss @thnkslprpt