From 4a9d4b27781fe5a437eeb73f1a0989b7ebd4ee79 Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Wed, 12 Apr 2023 18:14:51 +0800 Subject: [PATCH 1/6] Add priority inherit and disinerit test cases --- .../multiple_priorities_no_timeslice_utest.c | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c index 139f7253296..01d13f44f67 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c @@ -3184,3 +3184,121 @@ void test_task_yield_run_equal_priority_new_task( void ) /* The new task TN+1 should runs on core 0. */ verifySmpTask( &xTaskHandles[ i ], eRunning, 0 ); } + +void test_task_priority_inherit_disinherit( void ) +{ + TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; + uint32_t i; + + /* Create 1 high priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); + + /* Create N - 1 Medium priority task. */ + for( i = 1; i < configNUMBER_OF_CORES; i++ ) + { + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 2, &xTaskHandles[ i ] ); + } + + /* Create 1 low priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 1, &xTaskHandles[ i ] ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Verify the high and medium priority tasks running. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eRunning, i ); + } + + /* Verify the low priority task is ready. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eReady, -1 ); + + /* Assuming the low priority is helding a mutex. */ + xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld = 1; + + /* Low priority task inherit current core task priority, which is the high priority task. */ + taskENTER_CRITICAL(); + { + xTaskPriorityInherit( xTaskHandles[ configNUMBER_OF_CORES ] ); + } + taskEXIT_CRITICAL(); + + /* Verify that the low priority task is running on last core. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); + + /* Disinherit low priority task after timeout to it's original priority. */ + taskENTER_CRITICAL(); + { + xTaskPriorityDisinherit( xTaskHandles[ configNUMBER_OF_CORES ] ); + } + taskEXIT_CRITICAL(); + + /* Verify the high and medium priority tasks running. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eRunning, i ); + } + + /* Verify that the low priority task is ready. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eReady, -1 ); +} + +void test_task_priority_inherit_disinherit_timeout( void ) +{ + TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; + uint32_t i; + + /* Create 1 high priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); + + /* Create N - 1 Medium priority task. */ + for( i = 1; i < configNUMBER_OF_CORES; i++ ) + { + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 2, &xTaskHandles[ i ] ); + } + + /* Create 1 low priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 1, &xTaskHandles[ i ] ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Verify the high and medium priority tasks running. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eRunning, i ); + } + + /* Verify the low priority task is ready. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eReady, -1 ); + + /* Assuming the low priority is helding a mutex. */ + xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld = 1; + + /* Low priority task inherit current core task priority, which is the high priority task. */ + taskENTER_CRITICAL(); + { + xTaskPriorityInherit( xTaskHandles[ configNUMBER_OF_CORES ] ); + } + taskEXIT_CRITICAL(); + + /* Verify that the low priority task is running on last core. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); + + /* Disinherit low priority task after timeout to it's original priority. */ + taskENTER_CRITICAL(); + { + vTaskPriorityDisinheritAfterTimeout( xTaskHandles[ configNUMBER_OF_CORES ], 1 ); + } + taskEXIT_CRITICAL(); + + /* Verify the high and medium priority tasks running. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eRunning, i ); + } + + /* Verify that the low priority task is ready. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eReady, -1 ); +} From fdf5cbd83ac99b04fa7318826c24c9f72041fead Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Fri, 14 Apr 2023 11:39:31 +0800 Subject: [PATCH 2/6] Add the test cases in single priority no timeslice test group --- .../multiple_priorities_no_timeslice_utest.c | 84 +++++++- .../single_priority_no_timeslice_utest.c | 198 ++++++++++++++++++ 2 files changed, 280 insertions(+), 2 deletions(-) diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c index 01d13f44f67..f898567539f 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c @@ -3185,6 +3185,45 @@ void test_task_yield_run_equal_priority_new_task( void ) verifySmpTask( &xTaskHandles[ i ], eRunning, 0 ); } +/** + * @brief AWS_IoT-FreeRTOS_SMP_TC- + * Task can inherit or disinherit other higher priority task. This test verify that + * lower priority task will be selected to run when it inherit a higher priorirty task. + * The lower priority will be switched out when it disinherits higher priority task. + * + * #define configRUN_MULTIPLE_PRIORITIES 1 + * #define configUSE_TIME_SLICING 0 + * #define configNUMBER_OF_CORES (N > 1) + * + * This test can be run with FreeRTOS configured for any number of cores greater + * than 1. + * + * Tasks are created prior to starting the scheduler + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Ready State – Ready State – Ready State – Ready + * + * After calling vTaskStartScheduler() + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Running State – Running State – Ready + * + * Assuming task TN+1 is holding a mutex. Task TN+1 inherits task T1's priority + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 3 + * State – Running State – Running State – Ready State – Running + * uxMutexesHeld - 1 + * + * Task TN+1 disinherits task T1's priority. + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Running State – Running State – Ready + * uxMutexesHeld - 0 + */ void test_task_priority_inherit_disinherit( void ) { TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; @@ -3214,7 +3253,7 @@ void test_task_priority_inherit_disinherit( void ) /* Verify the low priority task is ready. */ verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eReady, -1 ); - /* Assuming the low priority is helding a mutex. */ + /* Assuming the low priority task is holding a mutex. */ xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld = 1; /* Low priority task inherit current core task priority, which is the high priority task. */ @@ -3234,6 +3273,9 @@ void test_task_priority_inherit_disinherit( void ) } taskEXIT_CRITICAL(); + /* Verify the mutex held count is decreased. */ + TEST_ASSERT_EQUAL( 0U, xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld ); + /* Verify the high and medium priority tasks running. */ for( i = 0; i < configNUMBER_OF_CORES; i++ ) { @@ -3244,6 +3286,44 @@ void test_task_priority_inherit_disinherit( void ) verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eReady, -1 ); } +/** + * @brief AWS_IoT-FreeRTOS_SMP_TC- + * Task can inherit or disinherit other higher priority task. This test verify that + * lower priority task will be selected to run when it inherit a higher priorirty task. + * The lower priority will be switched out when it is disinherited by higher priority + * task due to timeout. + * + * #define configRUN_MULTIPLE_PRIORITIES 1 + * #define configUSE_TIME_SLICING 0 + * #define configNUMBER_OF_CORES (N > 1) + * + * This test can be run with FreeRTOS configured for any number of cores greater + * than 1. + * + * Tasks are created prior to starting the scheduler + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Ready State – Ready State – Ready State – Ready + * + * After calling vTaskStartScheduler() + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Running State – Running State – Ready + * + * Assuming task TN+1 is holding a mutex. Task TN+1 inherits task T1's priority + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 3 + * State – Running State – Running State – Ready State – Running + * + * Task TN+1 is disinherited by Task T1 due to timeout + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Running State – Running State – Ready + */ void test_task_priority_inherit_disinherit_timeout( void ) { TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; @@ -3273,7 +3353,7 @@ void test_task_priority_inherit_disinherit_timeout( void ) /* Verify the low priority task is ready. */ verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eReady, -1 ); - /* Assuming the low priority is helding a mutex. */ + /* Assuming the low priority task is holding a mutex. */ xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld = 1; /* Low priority task inherit current core task priority, which is the high priority task. */ diff --git a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c index a5ae7fd1b89..667b56d6de0 100644 --- a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c @@ -2326,3 +2326,201 @@ void test_task_block_all_cores_equal_priority_block_running( void ) /* Verify task T0 is now in the ready state */ verifySmpTask( &xTaskHandles[ 0 ], eReady, -1 ); } + +/** + * @brief AWS_IoT-FreeRTOS_SMP_TC- + * Task can inherit or disinherit other higher priority task. This test verify that + * lower priority task will be selected to run when it inherit a higher priorirty task. + * The lower priority will be switched out when it disinherits higher priority task. + * + * #define configRUN_MULTIPLE_PRIORITIES 1 + * #define configUSE_TIME_SLICING 0 + * #define configNUMBER_OF_CORES (N > 1) + * + * This test can be run with FreeRTOS configured for any number of cores greater + * than 1. + * + * Tasks are created prior to starting the scheduler + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Ready State – Ready State – Ready State – Ready + * + * After calling vTaskStartScheduler() + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Ready State – Ready State – Ready + * + * Assuming task TN+1 is holding a mutex. Task TN+1 inherits task T1's priority + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 3 + * State – Running State – Ready State – Ready State – Running + * uxMutexesHeld - 1 + * + * Task TN+1 disinherits task T1's priority. + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Ready State – Ready State – Ready + * uxMutexesHeld - 0 + */ +void test_task_priority_inherit_disinherit( void ) +{ + TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; + uint32_t i; + + /* Create 1 high priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); + + /* Create N - 1 Medium priority task. */ + for( i = 1; i < configNUMBER_OF_CORES; i++ ) + { + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 2, &xTaskHandles[ i ] ); + } + + /* Create 1 low priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 1, &xTaskHandles[ i ] ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Verify the high priority task is running. */ + verifySmpTask( &xTaskHandles[ 0 ], eRunning, 0 ); + + /* Verify the medium and low priority tasks are ready. */ + for( i = 1; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eReady, -1 ); + } + + /* Assuming the low priority task is holding a mutex. */ + xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld = 1; + + /* Low priority task inherit current core task priority, which is the high priority task. */ + taskENTER_CRITICAL(); + { + xTaskPriorityInherit( xTaskHandles[ configNUMBER_OF_CORES ] ); + } + taskEXIT_CRITICAL(); + + /* Verify that the low priority task is running on last core. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); + + /* Disinherit low priority task after timeout to it's original priority. */ + taskENTER_CRITICAL(); + { + xTaskPriorityDisinherit( xTaskHandles[ configNUMBER_OF_CORES ] ); + } + taskEXIT_CRITICAL(); + + /* Verify the mutex held count is decreased. */ + TEST_ASSERT_EQUAL( 0U, xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld ); + + /* Verify the high priority task is running. */ + verifySmpTask( &xTaskHandles[ 0 ], eRunning, 0 ); + + /* Verify the medium and low priority tasks are ready. */ + for( i = 1; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eReady, -1 ); + } +} + +/** + * @brief AWS_IoT-FreeRTOS_SMP_TC- + * Task can inherit or disinherit other higher priority task. This test verify that + * lower priority task will be selected to run when it inherit a higher priorirty task. + * The lower priority will be switched out when it is disinherited by higher priority + * task due to timeout. + * + * #define configRUN_MULTIPLE_PRIORITIES 0 + * #define configUSE_TIME_SLICING 0 + * #define configNUMBER_OF_CORES (N > 1) + * + * This test can be run with FreeRTOS configured for any number of cores greater + * than 1. + * + * Tasks are created prior to starting the scheduler + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Ready State – Ready State – Ready State – Ready + * + * After calling vTaskStartScheduler() + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Ready State – Ready State – Ready + * + * Assuming task TN+1 is holding a mutex. Task TN+1 inherits task T1's priority + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 3 + * State – Running State – Ready State – Ready State – Running + * + * Task TN+1 is disinherited by Task T1 due to timeout + * + * Task (T1) Task (T2) Task (TN) Task (TN + 1) + * Priority – 3 Priority – 2 Priority – 2 Priority – 1 + * State – Running State – Ready State – Ready State – Ready + */ +void test_task_priority_inherit_disinherit_timeout( void ) +{ + TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; + uint32_t i; + + /* Create 1 high priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); + + /* Create N - 1 Medium priority task. */ + for( i = 1; i < configNUMBER_OF_CORES; i++ ) + { + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 2, &xTaskHandles[ i ] ); + } + + /* Create 1 low priority task. */ + xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 1, &xTaskHandles[ i ] ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Verify the high priority task is running. */ + verifySmpTask( &xTaskHandles[ 0 ], eRunning, 0 ); + + /* Verify the medium and low priority tasks are ready. */ + for( i = 1; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eReady, -1 ); + } + + /* Assuming the low priority task is holding a mutex. */ + xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld = 1; + + /* Low priority task inherit current core task priority, which is the high priority task. */ + taskENTER_CRITICAL(); + { + xTaskPriorityInherit( xTaskHandles[ configNUMBER_OF_CORES ] ); + } + taskEXIT_CRITICAL(); + + /* Verify that the low priority task is running on last core. */ + verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); + + /* Disinherit low priority task after timeout to it's original priority. */ + taskENTER_CRITICAL(); + { + vTaskPriorityDisinheritAfterTimeout( xTaskHandles[ configNUMBER_OF_CORES ], 1 ); + } + taskEXIT_CRITICAL(); + + /* Verify the high priority task is running. */ + verifySmpTask( &xTaskHandles[ 0 ], eRunning, 0 ); + + /* Verify the medium and low priority tasks are ready. */ + for( i = 1; i < ( configNUMBER_OF_CORES + 1 ); i++ ) + { + verifySmpTask( &xTaskHandles[ i ], eReady, -1 ); + } +} From ee57094f7f5438de86e3b1968dbe770f0798d66d Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Fri, 14 Apr 2023 12:33:46 +0800 Subject: [PATCH 3/6] Update kernel submodule --- FreeRTOS/Source | 2 +- .../multiple_priorities_no_timeslice_utest.c | 6 +++--- .../single_priority_no_timeslice_utest.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/FreeRTOS/Source b/FreeRTOS/Source index b051d241e46..8c067d61276 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit b051d241e46ca1fdb5fe6e86c3170464588bc32d +Subproject commit 8c067d612760a25f526f5888410de613bd2aaf53 diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c index f898567539f..2ca21148ecf 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c @@ -3186,7 +3186,7 @@ void test_task_yield_run_equal_priority_new_task( void ) } /** - * @brief AWS_IoT-FreeRTOS_SMP_TC- + * @brief AWS_IoT-FreeRTOS_SMP_TC-106 * Task can inherit or disinherit other higher priority task. This test verify that * lower priority task will be selected to run when it inherit a higher priorirty task. * The lower priority will be switched out when it disinherits higher priority task. @@ -3287,7 +3287,7 @@ void test_task_priority_inherit_disinherit( void ) } /** - * @brief AWS_IoT-FreeRTOS_SMP_TC- + * @brief AWS_IoT-FreeRTOS_SMP_TC-107 * Task can inherit or disinherit other higher priority task. This test verify that * lower priority task will be selected to run when it inherit a higher priorirty task. * The lower priority will be switched out when it is disinherited by higher priority @@ -3318,7 +3318,7 @@ void test_task_priority_inherit_disinherit( void ) * Priority – 3 Priority – 2 Priority – 2 Priority – 3 * State – Running State – Running State – Ready State – Running * - * Task TN+1 is disinherited by Task T1 due to timeout + * Task TN+1 is disinherited by task T1 due to timeout * * Task (T1) Task (T2) Task (TN) Task (TN + 1) * Priority – 3 Priority – 2 Priority – 2 Priority – 1 diff --git a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c index 667b56d6de0..13ba9dc640d 100644 --- a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c @@ -2328,7 +2328,7 @@ void test_task_block_all_cores_equal_priority_block_running( void ) } /** - * @brief AWS_IoT-FreeRTOS_SMP_TC- + * @brief AWS_IoT-FreeRTOS_SMP_TC-108 * Task can inherit or disinherit other higher priority task. This test verify that * lower priority task will be selected to run when it inherit a higher priorirty task. * The lower priority will be switched out when it disinherits higher priority task. @@ -2429,7 +2429,7 @@ void test_task_priority_inherit_disinherit( void ) } /** - * @brief AWS_IoT-FreeRTOS_SMP_TC- + * @brief AWS_IoT-FreeRTOS_SMP_TC-109 * Task can inherit or disinherit other higher priority task. This test verify that * lower priority task will be selected to run when it inherit a higher priorirty task. * The lower priority will be switched out when it is disinherited by higher priority @@ -2460,7 +2460,7 @@ void test_task_priority_inherit_disinherit( void ) * Priority – 3 Priority – 2 Priority – 2 Priority – 3 * State – Running State – Ready State – Ready State – Running * - * Task TN+1 is disinherited by Task T1 due to timeout + * Task TN+1 is disinherited by task T1 due to timeout * * Task (T1) Task (T2) Task (TN) Task (TN + 1) * Priority – 3 Priority – 2 Priority – 2 Priority – 1 From c269d47add47a9881272b470be1514c2caf9c09a Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Fri, 14 Apr 2023 16:59:39 +0800 Subject: [PATCH 4/6] Adding the coverage test for priority inherit and disinherit --- ...g_multiple_priorities_no_timeslice_utest.c | 198 ++++++++++++++++++ 1 file changed, 198 insertions(+) diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c index b878720932d..fc70b348f70 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c @@ -3899,6 +3899,103 @@ void test_coverage_xTaskPriorityInherit_task_uxpriority_greater( void ) TEST_ASSERT_EQUAL( xTaskTCBs[ 1 ].xStateListItem.pvContainer, &pxReadyTasksLists[ xTaskTCBs[ 1 ].uxPriority ] ); } +/** + * @brief xTaskPriorityInherit - task is already running. + * A running task inherit a high priority task. Verify that the priority is raised. + * + * Coverage + * @code{c} + * ... + * if( taskTASK_IS_RUNNING( pxMutexHolderTCB ) != pdTRUE ) + * { + * prvYieldForTask( pxMutexHolderTCB ); + * } + * @endcode + * ( taskTASK_IS_RUNNING( pxMutexHolderTCB ) != pdTRUE ) is false. + */ +void test_coverage_xTaskPriorityInherit_task_is_running( void ) +{ + TCB_t xTaskTCBs[ configNUMBER_OF_CORES ] = { NULL }; + uint32_t i; + + /* Setup the variables and structure. */ + /* Create high priority task on core 1 ~ N-1. */ + for( i = 0; i < ( configNUMBER_OF_CORES - 1 ); i++ ) + { + vCreateStaticTestTask( &xTaskTCBs[ i ], + 2, + i, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 2 ]; + listINSERT_END( &pxReadyTasksLists[ 2 ], &xTaskTCBs[ i ].xStateListItem ); + pxCurrentTCBs[ i ] = &xTaskTCBs[ i ]; + } + + /* Create a low priority task on last core. */ + vCreateStaticTestTask( &xTaskTCBs[ i ], + 1, + i, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 1 ]; + listINSERT_END( &pxReadyTasksLists[ 1 ], &xTaskTCBs[ i ].xStateListItem ); + pxCurrentTCBs[ i ] = &xTaskTCBs[ i ]; + + /* API call. */ + xTaskPriorityInherit( &xTaskTCBs[ ( configNUMBER_OF_CORES - 1 ) ] ); + + /* Validation. */ + /* Verify the priority of the task is raised. */ + TEST_ASSERT_EQUAL( 2, xTaskTCBs[ ( configNUMBER_OF_CORES - 1 ) ].uxPriority ); +} + +/** + * @brief xTaskPriorityInherit - task is of invalid running state. + * A running task inherit a high priority task. Verify that the priority is raised. + * + * Coverage + * @code{c} + * ... + * if( taskTASK_IS_RUNNING( pxMutexHolderTCB ) != pdTRUE ) + * { + * prvYieldForTask( pxMutexHolderTCB ); + * } + * @endcode + * ( taskTASK_IS_RUNNING( pxMutexHolderTCB ) != pdTRUE ) is true. + */ +void test_coverage_xTaskPriorityInherit_task_invalid_state( void ) +{ + TCB_t xTaskTCBs[ configNUMBER_OF_CORES + 1 ] = { NULL }; + uint32_t i; + + /* Setup the variables and structure. */ + /* Create high priority task on core 1 ~ N-1. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + vCreateStaticTestTask( &xTaskTCBs[ i ], + 2, + i, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 2 ]; + listINSERT_END( &pxReadyTasksLists[ 2 ], &xTaskTCBs[ i ].xStateListItem ); + pxCurrentTCBs[ i ] = &xTaskTCBs[ i ]; + } + + /* Create a low priority task on last core. */ + vCreateStaticTestTask( &xTaskTCBs[ i ], + 1, + configNUMBER_OF_CORES, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 1 ]; + listINSERT_END( &pxReadyTasksLists[ 1 ], &xTaskTCBs[ i ].xStateListItem ); + + /* API call. */ + xTaskPriorityInherit( &xTaskTCBs[ configNUMBER_OF_CORES ] ); + + /* Validation. */ + /* The task in pending ready list should not in any event list now. */ + TEST_ASSERT_EQUAL( 2, xTaskTCBs[ configNUMBER_OF_CORES ].uxPriority ); +} + /** * @brief xTaskPriorityDisinherit - restore priority after inheriting the priority of the mutex holder * @@ -4039,6 +4136,56 @@ void test_coverage_xTaskPriorityDisinherit_task_uxpriority_greater( void ) TEST_ASSERT_EQUAL( xTaskTCBs[ 1 ].xStateListItem.pvContainer, &pxReadyTasksLists[ xTaskTCBs[ 1 ].uxPriority ] ); } +/** + * @brief xTaskPriorityDisinherit - task is of invalid running state. + * The task disinherits a high priority task. Verify that the priority of the disinherited + * task is dropped to base priority. + * + * Coverage + * @code{c} + * ... + * if( taskTASK_IS_RUNNING( pxTCB ) == pdTRUE ) + * { + * prvYieldCore( pxTCB->xTaskRunState ); + * } + * @endcode + * ( taskTASK_IS_RUNNING( pxTCB ) == pdTRUE ) is false. + */ +void test_coverage_xTaskPriorityDisinherit_task_invalid_state( void ) +{ + TCB_t xTaskTCBs[ configNUMBER_OF_CORES + 1 ] = { NULL }; + uint32_t i; + + /* Setup the variables and structure. */ + /* Create high priority task on core 1 ~ N-1. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + vCreateStaticTestTask( &xTaskTCBs[ i ], + 2, + i, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 2 ]; + listINSERT_END( &pxReadyTasksLists[ 2 ], &xTaskTCBs[ i ].xStateListItem ); + } + + /* Create a low priority task on last core. */ + vCreateStaticTestTask( &xTaskTCBs[ i ], + 2, + configNUMBER_OF_CORES, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 2 ]; + listINSERT_END( &pxReadyTasksLists[ 2 ], &xTaskTCBs[ i ].xStateListItem ); + xTaskTCBs[ i ].uxMutexesHeld = 1; + xTaskTCBs[ i ].uxBasePriority = 1; + + /* API call. */ + xTaskPriorityDisinherit( &xTaskTCBs[ configNUMBER_OF_CORES ] ); + + /* Validation. */ + /* The priority of the task is dropped to base priority. */ + TEST_ASSERT_EQUAL( xTaskTCBs[ i ].uxBasePriority, xTaskTCBs[ configNUMBER_OF_CORES ].uxPriority ); +} + /** * @brief xTaskPriorityDisinheritAfterTimeout - restore priority after inheriting the priority of the mutex holder * @@ -4173,6 +4320,57 @@ void test_coverage_xTaskPriorityDisinheritAfterTimeout_task_uxpriority_greater( TEST_ASSERT_EQUAL( xTaskTCBs[ 1 ].xStateListItem.pvContainer, &pxReadyTasksLists[ xTaskTCBs[ 1 ].uxPriority ] ); } +/** + * @brief vTaskPriorityDisinheritAfterTimeout - task is of invalid running state. + * The task disinherit a high priority task due to high priority task timeout. Verify + * that the priority of the disinherited task is dropped to uxHighestPriorityWaitingTask. + * + * Coverage + * @code{c} + * ... + * if( taskTASK_IS_RUNNING( pxTCB ) == pdTRUE ) + * { + * prvYieldCore( pxTCB->xTaskRunState ); + * } + * @endcode + * ( taskTASK_IS_RUNNING( pxTCB ) == pdTRUE ) is false. + */ +void test_coverage_vTaskPriorityDisinheritAfterTimeout_task_invalid_state( void ) +{ + TCB_t xTaskTCBs[ configNUMBER_OF_CORES + 1 ] = { NULL }; + uint32_t i; + UBaseType_t uxHighestPriorityWaitingTask = 2; + + /* Setup the variables and structure. */ + /* Create high priority task on core 1 ~ N-1. */ + for( i = 0; i < configNUMBER_OF_CORES; i++ ) + { + vCreateStaticTestTask( &xTaskTCBs[ i ], + 3, + i, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 3 ]; + listINSERT_END( &pxReadyTasksLists[ 3 ], &xTaskTCBs[ i ].xStateListItem ); + } + + /* Create a low priority task on last core. */ + vCreateStaticTestTask( &xTaskTCBs[ i ], + 1, + configNUMBER_OF_CORES, + pdFALSE ); + xTaskTCBs[ i ].xStateListItem.pxContainer = &pxReadyTasksLists[ 1 ]; + listINSERT_END( &pxReadyTasksLists[ 1 ], &xTaskTCBs[ i ].xStateListItem ); + xTaskTCBs[ i ].uxMutexesHeld = 1; + xTaskTCBs[ i ].uxBasePriority = 1; + + /* API call. */ + vTaskPriorityDisinheritAfterTimeout( &xTaskTCBs[ configNUMBER_OF_CORES ], uxHighestPriorityWaitingTask ); + + /* Validation. */ + /* The priority of the task is dropped to uxHighestPriorityWaitingTask. */ + TEST_ASSERT_EQUAL( uxHighestPriorityWaitingTask, xTaskTCBs[ configNUMBER_OF_CORES ].uxPriority ); +} + /** * @brief uxTaskGetSystemState - array size is less than current task number. * From 37fc638d3b5be56317faa111539ce75b3d8943a3 Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Mon, 17 Apr 2023 11:58:55 +0800 Subject: [PATCH 5/6] Add coverage test for prvSearchForNameWithinSingleList --- ...g_multiple_priorities_no_timeslice_utest.c | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c index fc70b348f70..3cef20d12b6 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/covg_multiple_priorities_no_timeslice_utest.c @@ -81,6 +81,7 @@ extern void vTaskExitCritical( void ); extern void vTaskExitCriticalFromISR( UBaseType_t uxSavedInterruptStatus ); extern void prvCheckTasksWaitingTermination( void ); extern void prvDeleteTCB( TCB_t * pxTCB ); +extern TCB_t * prvSearchForNameWithinSingleList( List_t * pxList, const char pcNameToQuery[] ); /* ============================== Global VARIABLES ============================== */ TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES ] = { NULL }; @@ -4455,3 +4456,158 @@ void test_coverage_uxTaskGetSystemState_valid_run_time_param( void ) vPortFreeStack( xTaskTCB.pxStack ); UnityMalloc_EndTest(); } + +/** + * @brief prvSearchForNameWithinSingleList - search empty list + * + * Verify NULL pointer should be returned when list is empty. + * + * Coverage + * @code{c} + * if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 ) + * { + * ... + * } + * @endcode + * ( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 ) is false. + */ +void test_coverage_prvSearchForNameWithinSingleList_empty_list( void ) +{ + List_t xList; + TCB_t xTaskTCB; + TCB_t *pReturnedTCB; + + /* Setup variables. */ + memset( &xList, 0, sizeof( List_t ) ); + memset( &xTaskTCB, 0, sizeof( TCB_t ) ); + + vListInitialise( &xList ); + + /* API call. */ + pReturnedTCB = prvSearchForNameWithinSingleList( &xList, "TAKS_NOT_EXIST" ); + + /* Validation. */ + TEST_ASSERT_EQUAL( NULL, pReturnedTCB ); +} + +/** + * @brief prvSearchForNameWithinSingleList - task found in the list + * + * Verify that task should be found in the list. + * + * Coverage + * @code{c} + * if( pxReturn != NULL ) + * { + * break; + * } + * @endcode + * ( pxReturn != NULL ) is true. + */ +void test_coverage_prvSearchForNameWithinSingleList_task_found( void ) +{ + List_t xList; + TCB_t xTaskTCB; + TCB_t *pReturnedTCB; + + /* Setup variables. */ + memset( &xList, 0, sizeof( List_t ) ); + memset( &xTaskTCB, 0, sizeof( TCB_t ) ); + strncpy( xTaskTCB.pcTaskName, "TASK_EXIST", configMAX_TASK_NAME_LEN ); + + vListInitialise( &xList ); + + vCreateStaticTestTask( &xTaskTCB, + 1, + -1, + pdFALSE ); + + listINSERT_END( &xList, &xTaskTCB.xStateListItem ); + + /* API call. */ + pReturnedTCB = prvSearchForNameWithinSingleList( &xList, "TASK_EXIST" ); + + /* Validation. */ + TEST_ASSERT_EQUAL( &xTaskTCB, pReturnedTCB ); +} + +/** + * @brief prvSearchForNameWithinSingleList - task not found in the list + * + * Verify that NULL pointer should be returned when task with different name in the list. + * + * Coverage + * @code{c} + * if( cNextChar != pcNameToQuery[ x ] ) + * { + * xBreakLoop = pdTRUE; + * } + * @endcode + * ( cNextChar != pcNameToQuery[ x ] ) is true. + */ +void test_coverage_prvSearchForNameWithinSingleList_task_not_found( void ) +{ + List_t xList; + TCB_t xTaskTCB; + TCB_t *pReturnedTCB; + + /* Setup variables. */ + memset( &xList, 0, sizeof( List_t ) ); + memset( &xTaskTCB, 0, sizeof( TCB_t ) ); + + vListInitialise( &xList ); + + vCreateStaticTestTask( &xTaskTCB, + 1, + -1, + pdFALSE ); + strncpy( xTaskTCB.pcTaskName, "TASK_EXIST", configMAX_TASK_NAME_LEN ); + + listINSERT_END( &xList, &xTaskTCB.xStateListItem ); + + /* API call. */ + pReturnedTCB = prvSearchForNameWithinSingleList( &xList, "TAKS_NOT_EXIST" ); + + /* Validation. */ + TEST_ASSERT_EQUAL( NULL, pReturnedTCB ); +} + +/** + * @brief prvSearchForNameWithinSingleList - task name too long + * + * Verify that NULL pointer should be returned when task with name longer than configMAX_TASK_NAME_LEN. + * + * Coverage + * @code{c} + * for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configMAX_TASK_NAME_LEN; x++ ) + * { + * } + * @endcode + * ( x < ( UBaseType_t ) configMAX_TASK_NAME_LEN ) is false. + */ +void test_coverage_prvSearchForNameWithinSingleList_long_task_name( void ) +{ + List_t xList; + TCB_t xTaskTCB; + TCB_t *pReturnedTCB; + + /* Setup variables. */ + memset( &xList, 0, sizeof( List_t ) ); + memset( &xTaskTCB, 0, sizeof( TCB_t ) ); + memcpy( xTaskTCB.pcTaskName, "TASK_EXIST12", configMAX_TASK_NAME_LEN ); + + vListInitialise( &xList ); + + vCreateStaticTestTask( &xTaskTCB, + 1, + -1, + pdFALSE ); + + listINSERT_END( &xList, &xTaskTCB.xStateListItem ); + + /* API call. */ + pReturnedTCB = prvSearchForNameWithinSingleList( &xList, "TASK_EXIST12" ); + + /* Validation. */ + TEST_ASSERT_EQUAL( NULL, pReturnedTCB ); +} From c357970be4cba798ff409fefe4c820b3af842764 Mon Sep 17 00:00:00 2001 From: Ching-Hsin Lee Date: Wed, 19 Apr 2023 14:37:30 +0800 Subject: [PATCH 6/6] Add priority check --- .../multiple_priorities_no_timeslice_utest.c | 18 ++++++++++++++++++ .../single_priority_no_timeslice_utest.c | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c index 2ca21148ecf..700b83e0691 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice/multiple_priorities_no_timeslice_utest.c @@ -3228,6 +3228,7 @@ void test_task_priority_inherit_disinherit( void ) { TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; uint32_t i; + TaskStatus_t xTaskDetails; /* Create 1 high priority task. */ xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); @@ -3263,6 +3264,10 @@ void test_task_priority_inherit_disinherit( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 3, xTaskDetails.xHandle->uxPriority ); + /* Verify that the low priority task is running on last core. */ verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); @@ -3273,6 +3278,10 @@ void test_task_priority_inherit_disinherit( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 1, xTaskDetails.xHandle->uxPriority ); + /* Verify the mutex held count is decreased. */ TEST_ASSERT_EQUAL( 0U, xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld ); @@ -3328,6 +3337,7 @@ void test_task_priority_inherit_disinherit_timeout( void ) { TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; uint32_t i; + TaskStatus_t xTaskDetails; /* Create 1 high priority task. */ xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); @@ -3363,6 +3373,10 @@ void test_task_priority_inherit_disinherit_timeout( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 3, xTaskDetails.xHandle->uxPriority ); + /* Verify that the low priority task is running on last core. */ verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); @@ -3373,6 +3387,10 @@ void test_task_priority_inherit_disinherit_timeout( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 1, xTaskDetails.xHandle->uxPriority ); + /* Verify the high and medium priority tasks running. */ for( i = 0; i < configNUMBER_OF_CORES; i++ ) { diff --git a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c index 13ba9dc640d..ceca6c00776 100644 --- a/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c +++ b/FreeRTOS/Test/CMock/smp/single_priority_no_timeslice/single_priority_no_timeslice_utest.c @@ -2370,6 +2370,7 @@ void test_task_priority_inherit_disinherit( void ) { TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; uint32_t i; + TaskStatus_t xTaskDetails; /* Create 1 high priority task. */ xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); @@ -2405,6 +2406,10 @@ void test_task_priority_inherit_disinherit( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 3, xTaskDetails.xHandle->uxPriority ); + /* Verify that the low priority task is running on last core. */ verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); @@ -2415,6 +2420,10 @@ void test_task_priority_inherit_disinherit( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 1, xTaskDetails.xHandle->uxPriority ); + /* Verify the mutex held count is decreased. */ TEST_ASSERT_EQUAL( 0U, xTaskHandles[ configNUMBER_OF_CORES ]->uxMutexesHeld ); @@ -2470,6 +2479,7 @@ void test_task_priority_inherit_disinherit_timeout( void ) { TaskHandle_t xTaskHandles[ configNUMBER_OF_CORES + 1 ] = { NULL }; uint32_t i; + TaskStatus_t xTaskDetails; /* Create 1 high priority task. */ xTaskCreate( vSmpTestTask, "SMP Task", configMINIMAL_STACK_SIZE, NULL, 3, &xTaskHandles[ 0 ] ); @@ -2505,6 +2515,10 @@ void test_task_priority_inherit_disinherit_timeout( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 3, xTaskDetails.xHandle->uxPriority ); + /* Verify that the low priority task is running on last core. */ verifySmpTask( &xTaskHandles[ configNUMBER_OF_CORES ], eRunning, ( configNUMBER_OF_CORES - 1 ) ); @@ -2515,6 +2529,10 @@ void test_task_priority_inherit_disinherit_timeout( void ) } taskEXIT_CRITICAL(); + /* Verify the priority has been changed */ + vTaskGetInfo( xTaskHandles[ configNUMBER_OF_CORES ], &xTaskDetails, pdTRUE, eInvalid ); + TEST_ASSERT_EQUAL( 1, xTaskDetails.xHandle->uxPriority ); + /* Verify the high priority task is running. */ verifySmpTask( &xTaskHandles[ 0 ], eRunning, 0 );