Skip to content

Add some assertions and coverage exceptions to queue.c #273

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

Merged

Conversation

paulbartell
Copy link
Contributor

@paulbartell paulbartell commented Mar 5, 2021

Add some assertions and coverage exceptions to queue.c

Description

  • Correct some typos in queue.c
  • Assert that the semaphore handle passed into xQueueGetMutexHolder is not NULL.
  • Add assertions to check when invalid parameters are passed into Queue Registry related functions.
  • Add a configASSERT when vQueueAddToRegistry is called but the queue registry is full.
  • Add LCOV_BRANCH coverage exception for a configASSERT on pxQueueSetContainer with a condition that is unreachable.
  • Add an LCOV_BRANCH exception for the check that sizeof( StaticQueue_t ) == sizeof( Queue_t )
  • Run uncrustify

Test Steps

Only assertions and comments have been changed. This should be verified by inspection.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@paulbartell paulbartell force-pushed the pbartell/fixup-queue-assertions branch 2 times, most recently from 2b07d2d to 8fe0864 Compare March 5, 2021 19:52
( void ) xSize; /* Keeps lint quiet when configASSERT() is not defined. */

/* This assertion cannot be branch covered in unit tests */
configASSERT( xSize == sizeof( Queue_t ) ); /* LCOV_EXCL_BR_LINE */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really a job for _Static_assert (C11).

@paulbartell paulbartell force-pushed the pbartell/fixup-queue-assertions branch from 8fe0864 to 676ce01 Compare March 5, 2021 19:57
@paulbartell paulbartell marked this pull request as ready for review March 5, 2021 20:13
@paulbartell paulbartell requested a review from a team as a code owner March 5, 2021 20:13
@@ -2723,6 +2727,9 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
UBaseType_t ux;

configASSERT( xQueue );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will result in users with configASSERT enabled not being able to add a NULL queue handle to the queue registry.

@paulbartell paulbartell merged commit 18d4ba9 into FreeRTOS:main Mar 6, 2021
@paulbartell paulbartell deleted the pbartell/fixup-queue-assertions branch March 6, 2021 02:46
mbruno-xmos pushed a commit to xmos/FreeRTOS-Kernel that referenced this pull request Mar 9, 2021
* main:
  Add some assertions and coverage exceptions to queue.c (FreeRTOS#273)
  Moved git-secrets check to a different workflow (FreeRTOS#271)
  Comment: fix code comment for xTaskAbortDelay (FreeRTOS#272)
  Added git-secrets check to Github Actions (FreeRTOS#270)
  fixed documentation for ulTaskNotifyTake() and ulTaskNotifyTakeIndexed() (FreeRTOS#269)
  Add description for vTaskList (FreeRTOS#206)
  Support allocating stack from separate heap (FreeRTOS#267)
  Update python version to 3.7.10 (FreeRTOS#265)
  Update URL in history.txt (FreeRTOS#259)
  Remove unmatched braces in MessageBuffer pre tags (FreeRTOS#256)
  Check: improve verbosity of url verifier (FreeRTOS#260)
  Update issue templates
  incorporate updates from common (FreeRTOS#255)
  Typos (FreeRTOS#248)
  Delete gitattributes (FreeRTOS#253)
  Fix typo in comment in task.h (FreeRTOS#244)
  Fix Github checks after move from master to main (FreeRTOS#246)
mbruno-xmos pushed a commit to xmos/FreeRTOS-Kernel that referenced this pull request Mar 9, 2021
* feature/xcore:
  Add some assertions and coverage exceptions to queue.c (FreeRTOS#273)
  Moved git-secrets check to a different workflow (FreeRTOS#271)
  Comment: fix code comment for xTaskAbortDelay (FreeRTOS#272)
  Added git-secrets check to Github Actions (FreeRTOS#270)
  fixed documentation for ulTaskNotifyTake() and ulTaskNotifyTakeIndexed() (FreeRTOS#269)
  Add description for vTaskList (FreeRTOS#206)
  Support allocating stack from separate heap (FreeRTOS#267)
  Update python version to 3.7.10 (FreeRTOS#265)
  Update URL in history.txt (FreeRTOS#259)
  Remove unmatched braces in MessageBuffer pre tags (FreeRTOS#256)
  Check: improve verbosity of url verifier (FreeRTOS#260)
  Update issue templates
  incorporate updates from common (FreeRTOS#255)
  Typos (FreeRTOS#248)
  Delete gitattributes (FreeRTOS#253)
  Fix typo in comment in task.h (FreeRTOS#244)
  Fix Github checks after move from master to main (FreeRTOS#246)
mbruno-xmos pushed a commit to xmos/FreeRTOS-Kernel that referenced this pull request Mar 9, 2021
* main:
  Add some assertions and coverage exceptions to queue.c (FreeRTOS#273)
  Moved git-secrets check to a different workflow (FreeRTOS#271)
  Comment: fix code comment for xTaskAbortDelay (FreeRTOS#272)
  Added git-secrets check to Github Actions (FreeRTOS#270)
  fixed documentation for ulTaskNotifyTake() and ulTaskNotifyTakeIndexed() (FreeRTOS#269)
  Add description for vTaskList (FreeRTOS#206)
  Support allocating stack from separate heap (FreeRTOS#267)
  Update python version to 3.7.10 (FreeRTOS#265)
  Update URL in history.txt (FreeRTOS#259)
  Remove unmatched braces in MessageBuffer pre tags (FreeRTOS#256)
  Check: improve verbosity of url verifier (FreeRTOS#260)
  Update issue templates
  incorporate updates from common (FreeRTOS#255)
  Typos (FreeRTOS#248)
  Delete gitattributes (FreeRTOS#253)
  Fix typo in comment in task.h (FreeRTOS#244)
  Fix Github checks after move from master to main (FreeRTOS#246)
mbruno-xmos pushed a commit to xmos/FreeRTOS-Kernel that referenced this pull request Mar 9, 2021
* feature/xcore:
  Add some assertions and coverage exceptions to queue.c (FreeRTOS#273)
  Moved git-secrets check to a different workflow (FreeRTOS#271)
  Comment: fix code comment for xTaskAbortDelay (FreeRTOS#272)
  Added git-secrets check to Github Actions (FreeRTOS#270)
  fixed documentation for ulTaskNotifyTake() and ulTaskNotifyTakeIndexed() (FreeRTOS#269)
  Add description for vTaskList (FreeRTOS#206)
  Support allocating stack from separate heap (FreeRTOS#267)
  Update python version to 3.7.10 (FreeRTOS#265)
  Update URL in history.txt (FreeRTOS#259)
  Remove unmatched braces in MessageBuffer pre tags (FreeRTOS#256)
  Check: improve verbosity of url verifier (FreeRTOS#260)
  Update issue templates
  incorporate updates from common (FreeRTOS#255)
  Typos (FreeRTOS#248)
  Delete gitattributes (FreeRTOS#253)
  Fix typo in comment in task.h (FreeRTOS#244)
  Fix Github checks after move from master to main (FreeRTOS#246)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants