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:
RichardBarry 2024-02-18 22:37:43 -08:00 committed by GitHub
parent 259e8de761
commit 8e8dad2b09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 147 additions and 140 deletions

View file

@ -177,7 +177,7 @@
if( xTaskAbortDelay( xBlockingTask ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Reset the priority to the normal controlling priority. */
@ -288,7 +288,7 @@
if( xReturned != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
/*-----------------------------------------------------------*/
@ -379,7 +379,7 @@
if( ulReturn != 0 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -393,7 +393,7 @@
if( ulReturn != 0 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -406,7 +406,7 @@
if( ulReturn != 0 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -442,7 +442,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -456,7 +456,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -469,7 +469,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -517,7 +517,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -531,7 +531,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -544,7 +544,7 @@
if( xReturn != 0x00 )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -584,7 +584,7 @@
if( xReturn != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Note the time before the delay so the length of the delay is known. */
@ -595,7 +595,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -609,7 +609,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -622,7 +622,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -660,7 +660,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -674,7 +674,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -687,7 +687,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -710,7 +710,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -724,7 +724,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );
@ -737,7 +737,7 @@
if( xReturn != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );
@ -755,7 +755,7 @@
/* The actual block time should not be less than the expected block time. */
if( xActualBlockTime < xExpectedBlockTime )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* The actual block time can be greater than the expected block time, as it
@ -763,7 +763,7 @@
* acceptable margin. */
if( xActualBlockTime > ( xExpectedBlockTime + xAllowableMargin ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
/*-----------------------------------------------------------*/
@ -785,7 +785,7 @@
xReturn = pdFAIL;
}
if( xErrorOccurred == pdTRUE )
if( xErrorOccurred != pdFALSE )
{
xReturn = pdFAIL;
}

View file

@ -184,13 +184,13 @@ static void prvTakeAndGiveInTheSameOrder( void )
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Take the semaphore that is shared with the slave. */
if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* This task now has the mutex. Unsuspend the slave so it too
@ -209,7 +209,7 @@ static void prvTakeAndGiveInTheSameOrder( void )
* task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Now wait a little longer than the time between ISR gives to also
@ -218,7 +218,7 @@ static void prvTakeAndGiveInTheSameOrder( void )
if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
xOkToGiveMutex = pdFALSE;
@ -227,13 +227,13 @@ static void prvTakeAndGiveInTheSameOrder( void )
* already held. */
if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Should still be at the priority of the slave task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Give back the ISR semaphore to ensure the priority is not
@ -241,12 +241,12 @@ static void prvTakeAndGiveInTheSameOrder( void )
* attempting to obtain) is still held. */
if( xSemaphoreGive( xISRMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Finally give back the shared mutex. This time the higher priority
@ -255,12 +255,12 @@ static void prvTakeAndGiveInTheSameOrder( void )
* suspended state again. */
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
#if ( INCLUDE_eTaskGetState == 1 )
@ -286,13 +286,13 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Take the semaphore that is shared with the slave. */
if( xSemaphoreTake( xMasterSlaveMutex, intsemNO_BLOCK ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* This task now has the mutex. Unsuspend the slave so it too
@ -311,7 +311,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Now wait a little longer than the time between ISR gives to also
@ -320,7 +320,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
if( xSemaphoreTake( xISRMutex, ( xInterruptGivePeriod * 2 ) ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
xOkToGiveMutex = pdFALSE;
@ -329,13 +329,13 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* already held. */
if( xSemaphoreTake( xISRMutex, intsemNO_BLOCK ) != pdFAIL )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Should still be at the priority of the slave task. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Give back the shared semaphore to ensure the priority is not disinherited
@ -343,7 +343,7 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* before this task runs again. */
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Should still be at the priority of the slave task as this task still
@ -351,19 +351,19 @@ static void prvTakeAndGiveInTheOppositeOrder( void )
* mechanism. */
if( uxTaskPriorityGet( NULL ) != intsemSLAVE_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Give back the ISR semaphore, which should result in the priority being
* disinherited as it was the last mutex held. */
if( xSemaphoreGive( xISRMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxTaskPriorityGet( NULL ) != intsemMASTER_PRIORITY )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Reset the mutex ready for the next round. */
@ -387,12 +387,12 @@ static void vInterruptMutexSlaveTask( void * pvParameters )
* state. */
if( xSemaphoreTake( xMasterSlaveMutex, portMAX_DELAY ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( xSemaphoreGive( xMasterSlaveMutex ) != pdPASS )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
}
}
@ -410,7 +410,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
/* Expect to start with the counting semaphore empty. */
if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Wait until it is expected that the interrupt will have filled the
@ -422,12 +422,12 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
/* Now it is expected that the counting semaphore is full. */
if( uxQueueMessagesWaiting( ( QueueHandle_t ) xISRCountingSemaphore ) != intsemMAX_COUNT )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
if( uxQueueSpacesAvailable( ( QueueHandle_t ) xISRCountingSemaphore ) != 0 )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
ulCountingSemaphoreLoops++;
@ -444,7 +444,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
if( xCount != intsemMAX_COUNT )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
/* Now raise the priority of this task so it runs immediately that the
@ -457,7 +457,7 @@ static void vInterruptCountingSemaphoreTask( void * pvParameters )
xSemaphoreTake( xISRCountingSemaphore, portMAX_DELAY );
xOkToGiveCountingSemaphore = pdFALSE;
/* Reset the priority so as not to disturbed other tests too much. */
/* Reset the priority so as not to disturb other tests too much. */
vTaskPrioritySet( NULL, tskIDLE_PRIORITY );
ulCountingSemaphoreLoops++;
@ -506,25 +506,32 @@ void vInterruptSemaphorePeriodicTest( void )
BaseType_t xAreInterruptSemaphoreTasksStillRunning( void )
{
static uint32_t ulLastMasterLoopCounter = 0, ulLastCountingSemaphoreLoops = 0;
BaseType_t xReturn;
/* If the demo tasks are running then it is expected that the loop counters
* will have changed since this function was last called. */
if( ulLastMasterLoopCounter == ulMasterLoops )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
ulLastMasterLoopCounter = ulMasterLoops;
if( ulLastCountingSemaphoreLoops == ulCountingSemaphoreLoops )
{
xErrorDetected = pdTRUE;
xErrorDetected = __LINE__;
}
ulLastCountingSemaphoreLoops = ulCountingSemaphoreLoops++;
/* Errors detected in the task itself will have latched xErrorDetected
* to true. */
if( xErrorDetected != pdFALSE )
{
xReturn = pdFALSE;
}
else
{
xReturn = pdTRUE;
}
return ( BaseType_t ) !xErrorDetected;
return xReturn;
}

View file

@ -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
{

View file

@ -152,7 +152,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* anything on the queue. */
if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* How long were we blocked for? */
@ -161,7 +161,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
if( xBlockedTime < xTimeToBlock )
{
/* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
@ -169,7 +169,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
/* Should not have blocked for longer than we requested,
* although we would not necessarily run as soon as we were
* unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -183,7 +183,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if configUSE_PREEMPTION == 0
@ -203,7 +203,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* anything on the queue. */
if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* How long were we blocked for? */
@ -212,7 +212,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
if( xBlockedTime < xTimeToBlock )
{
/* Should not have blocked for less than we requested. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
@ -220,7 +220,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
/* Should not have blocked for longer than we requested,
* although we would not necessarily run as soon as we were
* unblocked so a margin is allowed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -256,7 +256,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* but not execute as this task has higher priority. */
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now fill the queue again before the other task gets a chance to
@ -264,13 +264,13 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* full ourselves, and the other task have set xRunIndicator. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xRunIndicator == bktRUN_INDICATOR )
{
/* The other task should not have executed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Raise the priority of the other task so it executes and blocks
@ -283,7 +283,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
/* The other task should not have executed outside of the
* queue function. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Set the priority back down. */
@ -311,7 +311,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
}
@ -334,7 +334,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* wake but not execute as this task has higher priority. */
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now empty the queue again before the other task gets a chance to
@ -342,13 +342,13 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
* empty ourselves, and the other task would be suspended. */
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
if( xRunIndicator == bktRUN_INDICATOR )
{
/* The other task should not have executed. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Raise the priority of the other task so it executes and blocks
@ -361,7 +361,7 @@ static void vPrimaryBlockTimeTestTask( void * pvParameters )
{
/* The other task should not have executed outside of the
* queue function. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );
@ -411,7 +411,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
if( xQueueSend( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_FULL )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* How long were we inside the send function? */
@ -420,7 +420,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
if( xBlockedTime < bktTIME_TO_BLOCK )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
@ -428,7 +428,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
* soon as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Suspend ready for test 3. */
@ -447,7 +447,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
if( xQueueReceive( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_EMPTY )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
@ -455,7 +455,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
if( xBlockedTime < bktTIME_TO_BLOCK )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
@ -463,7 +463,7 @@ static void vSecondaryBlockTimeTestTask( void * pvParameters )
* as we unblocked. */
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xRunIndicator = bktRUN_INDICATOR;
@ -493,7 +493,7 @@ static void prvBasicDelayTests( void )
* to the other tests in this file. */
if( ( xPostTime - xPreTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now crude tests to check the vTaskDelayUntil() functionality. */
@ -510,7 +510,7 @@ static void prvBasicDelayTests( void )
if( ( xTaskGetTickCount() - xExpectedUnblockTime ) > ( bktTIME_TO_BLOCK + xAllowableMargin ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xPrimaryCycles++;
@ -522,7 +522,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Now delay a few ticks so repeating the above block period will not block for
@ -532,7 +532,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* This time block for longer than xPeriod before calling xTaskDelayUntil() so
@ -542,7 +542,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Catch up. */
@ -550,7 +550,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdTRUE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Again block for slightly longer than a period so ensure the time is in the
@ -560,7 +560,7 @@ static void prvBasicDelayTests( void )
if( xDidBlock != pdFALSE )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Reset to the original task priority ready for the other tests. */
@ -585,7 +585,7 @@ BaseType_t xAreBlockTimeTestTasksStillRunning( void )
xReturn = pdFAIL;
}
if( xErrorOccurred == pdTRUE )
if( xErrorOccurred != pdFALSE )
{
xReturn = pdFAIL;
}

View file

@ -1,2 +1,2 @@
This directory contains the implementation of the "common demo tasks". These
This directory contains the implementation of the "common demo tasks". These
are test tasks and demo tasks that are used by nearly all the demo applications.

View file

@ -144,7 +144,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* polling task. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
for( ux = 0; ux < recmuMAX_COUNT; ux++ )
@ -161,7 +161,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* flag will be set here. */
if( xSemaphoreTakeRecursive( xMutex, recmu15ms_DELAY ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Ensure the other task attempting to access the mutex (and the
@ -185,7 +185,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* as it too has a lower priority than this task. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if ( configUSE_PREEMPTION == 0 )
@ -197,7 +197,7 @@ static void prvRecursiveMutexControllingTask( void * pvParameters )
* should no longer be the mutex owner, so the next give should fail. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Keep count of the number of cycles this task has performed so a
@ -232,7 +232,7 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
{
/* Did not expect to execute until the controlling task was
* suspended. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -240,7 +240,7 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
* the polling task to obtain the mutex. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
xBlockingIsSuspended = pdTRUE;
@ -252,13 +252,13 @@ static void prvRecursiveMutexBlockingTask( void * pvParameters )
{
/* We should not leave the xSemaphoreTakeRecursive() function
* until the mutex was obtained. */
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* The controlling and blocking tasks should be in lock step. */
if( uxControllingCycles != ( UBaseType_t ) ( uxBlockingCycles + 1 ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
/* Keep count of the number of cycles this task has performed so a
@ -290,7 +290,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
/* Is the blocking task suspended? */
if( ( xBlockingIsSuspended != pdTRUE ) || ( xControllingIsSuspended != pdTRUE ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -321,7 +321,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
* be suspended. */
if( ( xBlockingIsSuspended == pdTRUE ) || ( xControllingIsSuspended == pdTRUE ) )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if ( INCLUDE_uxTaskPriorityGet == 1 )
@ -341,7 +341,7 @@ static void prvRecursiveMutexPollingTask( void * pvParameters )
/* Release the mutex, disinheriting the higher priority again. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
#if ( INCLUDE_uxTaskPriorityGet == 1 )
@ -371,7 +371,7 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the controlling task still cycling? */
if( uxLastControllingCycles == uxControllingCycles )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -381,7 +381,7 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the blocking task still cycling? */
if( uxLastBlockingCycles == uxBlockingCycles )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
@ -391,14 +391,14 @@ BaseType_t xAreRecursiveMutexTasksStillRunning( void )
/* Is the polling task still cycling? */
if( uxLastPollingCycles == uxPollingCycles )
{
xErrorOccurred = pdTRUE;
xErrorOccurred = __LINE__;
}
else
{
uxLastPollingCycles = uxPollingCycles;
}
if( xErrorOccurred == pdTRUE )
if( xErrorOccurred != pdFALSE )
{
xReturn = pdFAIL;
}