Skip to content

Commit

Permalink
Add CMock test case for vTaskResume (FreeRTOS#1111)
Browse files Browse the repository at this point in the history
* Add Cmock test case for updates in vTaskResume API introduced in Kernel PR#865.

* Update Kernel submodule pointer

---------

Co-authored-by: Rahul Kar <[email protected]>
  • Loading branch information
Moral-Hao and kar-rahul-aws authored Nov 7, 2023
1 parent f60dd88 commit 55d07da
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
31 changes: 31 additions & 0 deletions FreeRTOS/Test/CMock/tasks/tasks_1_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ void setUp( void )
uxSchedulerSuspended = ( UBaseType_t ) 0;
is_first_task = true;
created_tasks = 0;
critical_section_counter = 0;

py_operation = dummy_operation;
}
Expand Down Expand Up @@ -2546,6 +2547,36 @@ void test_vTaskResume_fail_task_ready( void )
ASSERT_PORT_YIELD_WITHIN_API_NOT_CALLED();
}

void test_vTaskResume_fail_task_waiting_notify( void )
{
UBaseType_t uxIndexToNotify = 2;
TaskHandle_t task_handle;

create_task_priority = 3;
task_handle = create_task();
create_task_priority = 5;
create_task();
ptcb = task_handle;
ptcb->ucNotifyState[ uxIndexToNotify ] = taskWAITING_NOTIFICATION;
/* Expectations */
/* prvTaskIsTaskSuspended */
listIS_CONTAINED_WITHIN_ExpectAndReturn( &xSuspendedTaskList,
&ptcb->xStateListItem,
pdTRUE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &xPendingReadyList,
&ptcb->xEventListItem,
pdFALSE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( NULL,
&ptcb->xEventListItem,
pdTRUE );
/* API Call */
vTaskResume( task_handle ); /* not current tcb */
/* Validations */
ASSERT_PORT_YIELD_WITHIN_API_NOT_CALLED();

ptcb->ucNotifyState[ uxIndexToNotify ] = taskWAITING_NOTIFICATION;
}

void test_vTaskResume_fail_task_event_list_not_orphan( void )
{
TaskHandle_t task_handle;
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license: "MIT"

dependencies:
- name: "FreeRTOS-Kernel"
version: "5281427a9"
version: "0640b2e48"
repository:
type: "git"
url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git"
Expand Down

0 comments on commit 55d07da

Please sign in to comment.