mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-15 17:27:46 -04:00
Add tests to cover https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/435 (#768)
Add tests to cover https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/435 This ensures that the coverage does not go down with the PR https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/435. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
parent
26dcb22052
commit
89938537bc
3 changed files with 47 additions and 7 deletions
|
@ -673,3 +673,32 @@ void test_xSemaphoreTake_blocking_success_locked_low_prio_pending( void )
|
|||
|
||||
vQueueDelete( xSemaphore );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test xSemaphoreGiveFromISR on a semaphore that is locked
|
||||
* @coverage xQueueGiveFromISR
|
||||
*/
|
||||
void test_macro_xSemaphoreGiveFromISR_locked( void )
|
||||
{
|
||||
SemaphoreHandle_t xSemaphore = xSemaphoreCreateCounting( 2, 0 );
|
||||
|
||||
/* Set private lock counters */
|
||||
vSetQueueRxLock( xSemaphore, queueLOCKED_UNMODIFIED );
|
||||
vSetQueueTxLock( xSemaphore, queueLOCKED_UNMODIFIED );
|
||||
|
||||
vFakePortAssertIfInterruptPriorityInvalid_Ignore();
|
||||
uxTaskGetNumberOfTasks_IgnoreAndReturn( 1 );
|
||||
|
||||
TEST_ASSERT_EQUAL( pdTRUE, xSemaphoreGiveFromISR( xSemaphore, NULL ) );
|
||||
TEST_ASSERT_EQUAL( pdTRUE, xSemaphoreGiveFromISR( xSemaphore, NULL ) );
|
||||
|
||||
/* Verify that the cRxLock counter has not changed */
|
||||
TEST_ASSERT_EQUAL( queueLOCKED_UNMODIFIED, cGetQueueRxLock( xSemaphore ) );
|
||||
|
||||
/* Verify that the cTxLock counter has only been incremented by one
|
||||
* even after 2 calls to xQueueSendFromISR because there is only
|
||||
* one task in the system as returned from uxTaskGetNumberOfTasks. */
|
||||
TEST_ASSERT_EQUAL( queueLOCKED_UNMODIFIED + 1, cGetQueueTxLock( xSemaphore ) );
|
||||
|
||||
vSemaphoreDelete( xSemaphore );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue