mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-17 10:17:45 -04:00
Update some tests to report error line numbers (#747)
* To assist debugging, update a subset of demos to store the line number on which an error is detected rather than just storing a boolean as to whether an error detected or not. * Correct return value of xAreInterruptSemaphoreTasksStillRunning() made incorrect by the prior commit. * Uncrustify: triggered by comment. --------- Co-authored-by: none <> Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Rahul Kar <karahulx@amazon.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
parent
259e8de761
commit
8e8dad2b09
6 changed files with 147 additions and 140 deletions
|
@ -362,7 +362,7 @@
|
|||
* items it is possible for the queue to hold at any one time, which equals the
|
||||
* queue length (in items, not bytes) multiplied by the size of each item. In this
|
||||
* case the queue will hold staticQUEUE_LENGTH_IN_ITEMS 64-bit items. See
|
||||
* https://www.FreeRTOS.org/Embedded-RTOS-Queues.html */
|
||||
* http://www.freertos.org/Embedded-RTOS-Queues.html */
|
||||
static uint8_t ucQueueStorageArea[ staticQUEUE_LENGTH_IN_ITEMS * sizeof( uint64_t ) ];
|
||||
|
||||
/* Create the queue. xQueueCreateStatic() has two more parameters than the
|
||||
|
@ -440,7 +440,7 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Ensure the semaphore passes a few sanity checks as a valid semaphore. */
|
||||
|
@ -466,7 +466,7 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Ensure the semaphore passes a few sanity checks as a valid semaphore. */
|
||||
|
@ -535,7 +535,7 @@
|
|||
* function expects it to be unavailable. */
|
||||
if( xSemaphoreTake( xSemaphore, staticDONT_BLOCK ) == pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
prvSanityCheckCreatedSemaphore( xSemaphore, staticBINARY_SEMAPHORE_MAX_COUNT );
|
||||
|
@ -563,12 +563,12 @@
|
|||
if( *puxVariableToIncrement == staticMAX_TIMER_CALLBACK_EXECUTIONS )
|
||||
{
|
||||
/* This is called from a timer callback so must not block. See
|
||||
* https://www.FreeRTOS.org/FreeRTOS-timers-xTimerStop.html */
|
||||
* http://www.FreeRTOS.org/FreeRTOS-timers-xTimerStop.html */
|
||||
xReturned = xTimerStop( xExpiredTimer, staticDONT_BLOCK );
|
||||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -615,7 +615,7 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS );
|
||||
|
@ -624,7 +624,7 @@
|
|||
* times, and then stopped itself. */
|
||||
if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Finished with the timer, delete it. */
|
||||
|
@ -634,7 +634,7 @@
|
|||
* command will have been sent even without a block time being used. */
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Just to show the check task that this task is still executing. */
|
||||
|
@ -658,21 +658,21 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
vTaskDelay( xTimerPeriod * staticMAX_TIMER_CALLBACK_EXECUTIONS );
|
||||
|
||||
if( uxVariableToIncrement != staticMAX_TIMER_CALLBACK_EXECUTIONS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
xReturned = xTimerDelete( xTimer, staticDONT_BLOCK );
|
||||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
#endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
|
||||
|
@ -757,13 +757,13 @@
|
|||
/* Check the task was created correctly, then delete the task. */
|
||||
if( xCreatedTask == NULL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
else if( eTaskGetState( xCreatedTask ) != eSuspended )
|
||||
{
|
||||
/* The created task had a higher priority so should have executed and
|
||||
* suspended itself by now. */
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -787,14 +787,14 @@
|
|||
|
||||
if( eTaskGetState( xCreatedTask ) != eSuspended )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
configASSERT( xReturned == pdPASS );
|
||||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
vTaskDelete( xCreatedTask );
|
||||
|
@ -856,7 +856,7 @@
|
|||
|
||||
if( xEventBits != ( EventBits_t ) 0 )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Some some bits, then read them back to check they are as expected. */
|
||||
|
@ -866,7 +866,7 @@
|
|||
|
||||
if( xEventBits != xFirstTestBits )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
xEventGroupSetBits( xEventGroup, xSecondTestBits );
|
||||
|
@ -875,7 +875,7 @@
|
|||
|
||||
if( xEventBits != ( xFirstTestBits | xSecondTestBits ) )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Finally try clearing some bits too and check that operation proceeds as
|
||||
|
@ -886,7 +886,7 @@
|
|||
|
||||
if( xEventBits != xSecondTestBits )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -907,12 +907,12 @@
|
|||
if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime )
|
||||
{
|
||||
/* Did not block on the semaphore as long as expected. */
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
if( xReturned != pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Should be possible to 'give' the semaphore up to a maximum of uxMaxCount
|
||||
|
@ -923,7 +923,7 @@
|
|||
|
||||
if( xReturned == pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -932,7 +932,7 @@
|
|||
|
||||
if( xReturned != pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
configASSERT( uxSemaphoreGetCount( xSemaphore ) == uxMaxCount );
|
||||
|
@ -945,7 +945,7 @@
|
|||
|
||||
if( xReturned == pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -957,12 +957,12 @@
|
|||
if( ( ( TickType_t ) ( xTaskGetTickCount() - xTickCount ) ) < xShortBlockTime )
|
||||
{
|
||||
/* Did not block on the semaphore as long as expected. */
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
if( xReturned != pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 );
|
||||
|
@ -983,7 +983,7 @@
|
|||
|
||||
if( xReturned != errQUEUE_EMPTY )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Now it should be possible to write to the queue staticQUEUE_LENGTH_IN_ITEMS
|
||||
|
@ -994,7 +994,7 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1003,7 +1003,7 @@
|
|||
|
||||
if( xReturned != errQUEUE_FULL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Now read back from the queue to ensure the data read back matches that
|
||||
|
@ -1014,12 +1014,12 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
if( ullRead != ull )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1028,7 @@
|
|||
|
||||
if( xReturned != errQUEUE_EMPTY )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@
|
|||
|
||||
if( xReturned != pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
|
||||
/* Now it should be possible to take the mutex a number of times. */
|
||||
|
@ -1056,7 +1056,7 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1068,7 +1068,7 @@
|
|||
|
||||
if( xReturned != pdPASS )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1077,7 +1077,7 @@
|
|||
|
||||
if( xReturned != pdFAIL )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -1089,7 +1089,7 @@
|
|||
|
||||
if( uxCycleCounter == uxLastCycleCounter )
|
||||
{
|
||||
xErrorOccurred = pdTRUE;
|
||||
xErrorOccurred = __LINE__;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue