From cd1ad55ff8962389a69bcdcf56f129a017cd6bac Mon Sep 17 00:00:00 2001 From: rtel Date: Wed, 14 Mar 2018 15:58:47 +0000 Subject: [PATCH] Import the code coverage test additions from the (unpublished) Visual Studio project to the (published) MingW/Eclipse project. Update the MingW/Eclipse project to add a code coverage build configuration in addition to the existing Debug build configuration. Update StreamBufferDemo.c so functions are called directly, rather than via configASSERT(), so their code coverage can be measured when configASSERT() is not defined. In the Win32 port, replace the call to TerminateProcess() in vPortEndScheduler() with exit( 0 ) - which triggers the writing of the code coverage data to the disk. Fix bug in ucStreamBufferGetStreamBufferType() - which is only used by the Percepio trace tool. Update the line within vTaskStartScheduler() that was setting xTickCount to 0 to instead set it to configINITIAL_TICK_COUNT. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2534 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../Demo/Common/Minimal/EventGroupsDemo.c | 25 +- FreeRTOS/Demo/Common/Minimal/GenQTest.c | 22 +- .../Demo/Common/Minimal/StaticAllocation.c | 3 +- .../Demo/Common/Minimal/StreamBufferDemo.c | 162 ++--- FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo | Bin 59904 -> 54272 bytes FreeRTOS/Demo/WIN32-MingW/.cproject | 4 +- FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h | 42 +- .../WIN32-MingW/code_coverage_additions.c | 594 ++++++++++++++++++ FreeRTOS/Demo/WIN32-MingW/main.c | 55 +- FreeRTOS/Demo/WIN32-MingW/main_full.c | 21 +- FreeRTOS/Source/portable/MSVC-MingW/port.c | 3 +- FreeRTOS/Source/queue.c | 4 +- FreeRTOS/Source/stream_buffer.c | 2 +- FreeRTOS/Source/tasks.c | 4 +- 14 files changed, 817 insertions(+), 124 deletions(-) create mode 100644 FreeRTOS/Demo/WIN32-MingW/code_coverage_additions.c diff --git a/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c b/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c index 22b7fb81d..abd72e878 100644 --- a/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c +++ b/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c @@ -78,6 +78,7 @@ that synchronise with the xEventGroupSync() function. */ /* A block time of zero simply means "don't block". */ #define ebDONT_BLOCK ( 0 ) +#define ebONE_TICK ( ( TickType_t ) 1 ) /* A 5ms delay. */ #define ebSHORT_DELAY pdMS_TO_TICKS( ( TickType_t ) 5 ) @@ -281,7 +282,29 @@ EventBits_t uxSynchronisationBit, uxReturned; /* Set the bit that indicates this task is at the synchronisation point. The first time this is done the 'test master' task has a lower priority than this task so this task will get to the sync point before - the set bits task. */ + the set bits task - test this by first calling xEventGroupSync() with + a zero block time, and a block time that is too short for the other + task, before calling again with a max delay - the first two calls should + return before the rendezvous completes, the third only after the + rendezvous is complete. */ + uxReturned = xEventGroupSync( xEventGroup, /* The event group used for the synchronisation. */ + uxSynchronisationBit, /* The bit to set in the event group to indicate this task is at the sync point. */ + ebALL_SYNC_BITS,/* The bits to wait for - these bits are set by the other tasks taking part in the sync. */ + ebDONT_BLOCK ); /* The maximum time to wait for the sync condition to be met before giving up. */ + + /* No block time was specified, so as per the comments above, the + rendezvous is not expected to have completed yet. */ + configASSERT( ( uxReturned & ebALL_SYNC_BITS ) != ebALL_SYNC_BITS ); + + uxReturned = xEventGroupSync( xEventGroup, /* The event group used for the synchronisation. */ + uxSynchronisationBit, /* The bit to set in the event group to indicate this task is at the sync point. */ + ebALL_SYNC_BITS, /* The bits to wait for - these bits are set by the other tasks taking part in the sync. */ + ebONE_TICK ); /* The maximum time to wait for the sync condition to be met before giving up. */ + + /* A short block time was specified, so as per the comments above, the + rendezvous is not expected to have completed yet. */ + configASSERT( ( uxReturned & ebALL_SYNC_BITS ) != ebALL_SYNC_BITS ); + uxReturned = xEventGroupSync( xEventGroup, /* The event group used for the synchronisation. */ uxSynchronisationBit, /* The bit to set in the event group to indicate this task is at the sync point. */ ebALL_SYNC_BITS,/* The bits to wait for - these bits are set by the other tasks taking part in the sync. */ diff --git a/FreeRTOS/Demo/Common/Minimal/GenQTest.c b/FreeRTOS/Demo/Common/Minimal/GenQTest.c index 4d146054c..66be41733 100644 --- a/FreeRTOS/Demo/Common/Minimal/GenQTest.c +++ b/FreeRTOS/Demo/Common/Minimal/GenQTest.c @@ -433,11 +433,20 @@ QueueHandle_t xQueue; /* The tests in this function are very similar, the slight variations are for code coverage purposes. */ - /* Take the mutex. It should be available now. */ + /* Take the mutex. It should be available now. Check before and after + taking that the holder is reported correctly. */ + if( xSemaphoreGetMutexHolder( xMutex ) != NULL ) + { + xErrorDetected = pdTRUE; + } if( xSemaphoreTake( xMutex, intsemNO_BLOCK ) != pdPASS ) { xErrorDetected = pdTRUE; } + if( xSemaphoreGetMutexHolder( xMutex ) != xTaskGetCurrentTaskHandle() ) + { + xErrorDetected = pdTRUE; + } /* This task's priority should be as per that assigned when the task was created. */ @@ -524,8 +533,17 @@ QueueHandle_t xQueue; vTaskDelay( genqSHORT_BLOCK ); } - /* Give the semaphore back ready for the next test. */ + /* Give the semaphore back ready for the next test. Check the mutex + holder before and after using the "FromISR" version for code coverage. */ + if( xSemaphoreGetMutexHolderFromISR( xMutex ) != xTaskGetCurrentTaskHandle() ) + { + xErrorDetected = pdTRUE; + } xSemaphoreGive( xMutex ); + if( xSemaphoreGetMutexHolderFromISR( xMutex ) != NULL ) + { + xErrorDetected = pdTRUE; + } configASSERT( xErrorDetected == pdFALSE ); diff --git a/FreeRTOS/Demo/Common/Minimal/StaticAllocation.c b/FreeRTOS/Demo/Common/Minimal/StaticAllocation.c index 013503a7b..dc5c85407 100644 --- a/FreeRTOS/Demo/Common/Minimal/StaticAllocation.c +++ b/FreeRTOS/Demo/Common/Minimal/StaticAllocation.c @@ -695,8 +695,7 @@ StaticEventGroup_t xEventGroupBuffer; /* Create the event group. xEventGroupCreateStatic() has an extra parameter than the normal xEventGroupCreate() API function. The parameter is a pointer to the StaticEventGroup_t structure that will hold the event group - structure. If the parameter is passed as NULL then the structure will be - allocated dynamically, just as if xEventGroupCreate() had been called. */ + structure. */ xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer ); /* The event group handle should equal the static event group structure diff --git a/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c b/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c index a0cdda6c4..8250b13d9 100644 --- a/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c +++ b/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c @@ -92,6 +92,10 @@ static void prvEchoServer( void *pvParameters ); static void prvNonBlockingReceiverTask( void *pvParameters ); static void prvNonBlockingSenderTask( void *pvParameters ); +/* Performs an assert() like check in a way that won't get removed when +performing a code coverage analysis. */ +static void prvCheckExpectedState( BaseType_t xState ); + /* * A task that creates a stream buffer with a specific trigger level, then * receives a string from an interrupt (the RTOS tick hook) byte by byte to @@ -151,6 +155,10 @@ accidentally read out of the buffer. */ static const char *pc55ByteString = "One two three four five six seven eight nine ten eleven"; static const char *pc54ByteString = "01234567891abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ"; +/* Used to log the status of the tests contained within this file for reporting +to a monitoring task ('check' task). */ +static BaseType_t xErrorStatus = pdPASS; + /*-----------------------------------------------------------*/ void vStartStreamBufferTasks( void ) @@ -188,6 +196,16 @@ StreamBufferHandle_t xStreamBuffer; } /*-----------------------------------------------------------*/ +static void prvCheckExpectedState( BaseType_t xState ) +{ + configASSERT( xState ); + if( xState == pdFAIL ) + { + xErrorStatus = pdFAIL; + } +} +/*-----------------------------------------------------------*/ + static void prvSingleTaskTests( StreamBufferHandle_t xStreamBuffer ) { size_t xReturned, xItem, xExpectedSpace; @@ -213,15 +231,15 @@ UBaseType_t uxOriginalPriority; /* Nothing has been added or removed yet, so expect the free space to be exactly as created. */ xExpectedSpace = xStreamBufferSpacesAvailable( xStreamBuffer ); - configASSERT( xExpectedSpace == sbSTREAM_BUFFER_LENGTH_BYTES ); - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xExpectedSpace == sbSTREAM_BUFFER_LENGTH_BYTES ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); /* The buffer is 30 bytes long. 6 5 byte messages should fit before the buffer is completely full. */ for( xItem = 0; xItem < xMax6ByteMessages; xItem++ ) { - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); /* Generate recognisable data to write to the buffer. This is just ascii characters that shows which loop iteration the data was written @@ -235,27 +253,23 @@ UBaseType_t uxOriginalPriority; xReturned = xStreamBufferSendFromISR( xStreamBuffer, ( void * ) pucData, x6ByteLength, NULL ); } taskEXIT_CRITICAL(); - configASSERT( xReturned == x6ByteLength ); - ( void ) xReturned; /* In case configASSERT() is not defined. */ + prvCheckExpectedState( xReturned == x6ByteLength ); /* The space in the buffer will have reduced by the amount of user data written into the buffer. */ xExpectedSpace -= x6ByteLength; xReturned = xStreamBufferSpacesAvailable( xStreamBuffer ); - configASSERT( xReturned == xExpectedSpace ); - ( void ) xReturned; /* In case configASSERT() is not defined. */ + prvCheckExpectedState( xReturned == xExpectedSpace ); xReturned = xStreamBufferBytesAvailable( xStreamBuffer ); /* +1 as it is zero indexed. */ - configASSERT( xReturned == ( ( xItem + 1 ) * x6ByteLength ) ); - ( void ) xReturned; /* In case configASSERT() is not defined. */ + prvCheckExpectedState( xReturned == ( ( xItem + 1 ) * x6ByteLength ) ); } /* Now the buffer should be full, and attempting to add anything will should fail. */ - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); xReturned = xStreamBufferSend( xStreamBuffer, ( void * ) pucData, sizeof( pucData[ 0 ] ), sbDONT_BLOCK ); - configASSERT( xReturned == 0 ); - ( void ) xReturned; /* In case configASSERT() is not defined. */ + prvCheckExpectedState( xReturned == 0 ); /* Adding with a timeout should also fail after the appropriate time. The priority is temporarily boosted in this part of the test to keep the @@ -266,12 +280,9 @@ UBaseType_t uxOriginalPriority; xReturned = xStreamBufferSend( xStreamBuffer, ( void * ) pucData, sizeof( pucData[ 0 ] ), xBlockTime ); xTimeAfterCall = xTaskGetTickCount(); vTaskPrioritySet( NULL, uxOriginalPriority ); - configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) >= xBlockTime ); - configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) < ( xBlockTime + xAllowableMargin ) ); - configASSERT( xReturned == 0 ); /* In case configASSERT() is not defined. */ - ( void ) xTimeAfterCall; - ( void ) xTimeBeforeCall; - + prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) >= xBlockTime ); + prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) < ( xBlockTime + xAllowableMargin ) ); + prvCheckExpectedState( xReturned == 0 ); /* The buffer is now full of data in the form "000000", "111111", etc. Make sure the data is read out as expected. */ @@ -290,24 +301,24 @@ UBaseType_t uxOriginalPriority; xReturned = xStreamBufferReceiveFromISR( xStreamBuffer, ( void * ) pucReadData, x6ByteLength, NULL ); } taskEXIT_CRITICAL(); - configASSERT( xReturned == x6ByteLength ); + prvCheckExpectedState( xReturned == x6ByteLength ); /* Does the data read out match that expected? */ - configASSERT( memcmp( ( void * ) pucData, ( void * ) pucReadData, x6ByteLength ) == 0 ); + prvCheckExpectedState( memcmp( ( void * ) pucData, ( void * ) pucReadData, x6ByteLength ) == 0 ); /* The space in the buffer will have increased by the amount of user data removed from the buffer. */ xExpectedSpace += x6ByteLength; xReturned = xStreamBufferSpacesAvailable( xStreamBuffer ); - configASSERT( xReturned == xExpectedSpace ); + prvCheckExpectedState( xReturned == xExpectedSpace ); xReturned = xStreamBufferBytesAvailable( xStreamBuffer ); - configASSERT( xReturned == ( sbSTREAM_BUFFER_LENGTH_BYTES - xExpectedSpace ) ); + prvCheckExpectedState( xReturned == ( sbSTREAM_BUFFER_LENGTH_BYTES - xExpectedSpace ) ); } /* The buffer should be empty again. */ - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); xExpectedSpace = xStreamBufferSpacesAvailable( xStreamBuffer ); - configASSERT( xExpectedSpace == sbSTREAM_BUFFER_LENGTH_BYTES ); + prvCheckExpectedState( xExpectedSpace == sbSTREAM_BUFFER_LENGTH_BYTES ); /* Reading with a timeout should also fail after the appropriate time. The priority is temporarily boosted in this part of the test to keep the @@ -317,9 +328,9 @@ UBaseType_t uxOriginalPriority; xReturned = xStreamBufferReceive( xStreamBuffer, ( void * ) pucReadData, x6ByteLength, xBlockTime ); xTimeAfterCall = xTaskGetTickCount(); vTaskPrioritySet( NULL, uxOriginalPriority ); - configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) >= xBlockTime ); - configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) < ( xBlockTime + xAllowableMargin ) ); - configASSERT( xReturned == 0 ); + prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) >= xBlockTime ); + prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) < ( xBlockTime + xAllowableMargin ) ); + prvCheckExpectedState( xReturned == 0 ); /* In the next loop 17 bytes are written to then read out on each @@ -333,38 +344,38 @@ UBaseType_t uxOriginalPriority; in. */ memset( ( void * ) pucData, ( ( int ) '0' ) + ( int ) xItem, x17ByteLength ); xReturned = xStreamBufferSend( xStreamBuffer, ( void * ) pucData, x17ByteLength, sbDONT_BLOCK ); - configASSERT( xReturned == x17ByteLength ); + prvCheckExpectedState( xReturned == x17ByteLength ); /* The space in the buffer will have reduced by the amount of user data written into the buffer. */ xReturned = xStreamBufferSpacesAvailable( xStreamBuffer ); - configASSERT( xReturned == xExpectedSpace ); + prvCheckExpectedState( xReturned == xExpectedSpace ); xReturned = xStreamBufferBytesAvailable( xStreamBuffer ); - configASSERT( xReturned == x17ByteLength ); - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( xReturned == x17ByteLength ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdFALSE ); /* Read the 17 bytes out again. */ xReturned = xStreamBufferReceive( xStreamBuffer, ( void * ) pucReadData, x17ByteLength, sbDONT_BLOCK ); - configASSERT( xReturned == x17ByteLength ); + prvCheckExpectedState( xReturned == x17ByteLength ); /* Does the data read out match that expected? */ - configASSERT( memcmp( ( void * ) pucData, ( void * ) pucReadData, x17ByteLength ) == 0 ); + prvCheckExpectedState( memcmp( ( void * ) pucData, ( void * ) pucReadData, x17ByteLength ) == 0 ); /* Full buffer space available again. */ xReturned = xStreamBufferSpacesAvailable( xStreamBuffer ); - configASSERT( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); + prvCheckExpectedState( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); xReturned = xStreamBufferBytesAvailable( xStreamBuffer ); - configASSERT( xReturned == 0 ); - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xReturned == 0 ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); } /* Fill the buffer with one message, check it is full, then read it back again and check the correct data is received. */ xStreamBufferSend( xStreamBuffer, ( const void * ) pc55ByteString, sbSTREAM_BUFFER_LENGTH_BYTES, sbDONT_BLOCK ); xStreamBufferReceive( xStreamBuffer, ( void * ) pucFullBuffer, sbSTREAM_BUFFER_LENGTH_BYTES, sbDONT_BLOCK ); - configASSERT( memcmp( pc55ByteString, pucFullBuffer, sbSTREAM_BUFFER_LENGTH_BYTES ) == 0 ); + prvCheckExpectedState( memcmp( pc55ByteString, pucFullBuffer, sbSTREAM_BUFFER_LENGTH_BYTES ) == 0 ); /* Fill the buffer one bytes at a time. */ for( xItem = 0; xItem < sbSTREAM_BUFFER_LENGTH_BYTES; xItem++ ) @@ -375,23 +386,23 @@ UBaseType_t uxOriginalPriority; } /* The buffer should now be full. */ - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); /* Read the message out in one go, even though it was written in individual bytes. Try reading much more data than is actually available to ensure only the available bytes are returned (otherwise this read will write outside of the memory allocated anyway!). */ xReturned = xStreamBufferReceive( xStreamBuffer, pucFullBuffer, sbSTREAM_BUFFER_LENGTH_BYTES * ( size_t ) 2, sbRX_TX_BLOCK_TIME ); - configASSERT( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); - configASSERT( memcmp( ( const void * ) pc54ByteString, ( const void * ) pucFullBuffer, sbSTREAM_BUFFER_LENGTH_BYTES ) == 0 ); + prvCheckExpectedState( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); + prvCheckExpectedState( memcmp( ( const void * ) pc54ByteString, ( const void * ) pucFullBuffer, sbSTREAM_BUFFER_LENGTH_BYTES ) == 0 ); /* Now do the opposite, write in one go and read out in single bytes. */ xReturned = xStreamBufferSend( xStreamBuffer, ( const void * ) pc55ByteString, sbSTREAM_BUFFER_LENGTH_BYTES, sbRX_TX_BLOCK_TIME ); - configASSERT( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdFALSE ); - configASSERT( xStreamBufferBytesAvailable( xStreamBuffer ) == sbSTREAM_BUFFER_LENGTH_BYTES ); - configASSERT( xStreamBufferSpacesAvailable( xStreamBuffer ) == 0 ); + prvCheckExpectedState( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( xStreamBufferBytesAvailable( xStreamBuffer ) == sbSTREAM_BUFFER_LENGTH_BYTES ); + prvCheckExpectedState( xStreamBufferSpacesAvailable( xStreamBuffer ) == 0 ); /* Read from the buffer one byte at a time. */ for( xItem = 0; xItem < sbSTREAM_BUFFER_LENGTH_BYTES; xItem++ ) @@ -399,10 +410,10 @@ UBaseType_t uxOriginalPriority; /* Block time is only for test coverage, the task should never actually block here. */ xStreamBufferReceive( xStreamBuffer, ( void * ) pucFullBuffer, sizeof( char ), sbRX_TX_BLOCK_TIME ); - configASSERT( pc55ByteString[ xItem ] == pucFullBuffer[ 0 ] ); + prvCheckExpectedState( pc55ByteString[ xItem ] == pucFullBuffer[ 0 ] ); } - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); /* Try writing more bytes than there is space. */ vTaskPrioritySet( NULL, configMAX_PRIORITIES - 1 ); @@ -410,23 +421,23 @@ UBaseType_t uxOriginalPriority; xReturned = xStreamBufferSend( xStreamBuffer, ( const void * ) pc54ByteString, sbSTREAM_BUFFER_LENGTH_BYTES * ( size_t ) 2, xMinimalBlockTime ); xTimeAfterCall = xTaskGetTickCount(); vTaskPrioritySet( NULL, uxOriginalPriority ); - configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) >= xMinimalBlockTime ); - configASSERT( ( xTimeAfterCall - xTimeBeforeCall ) < ( xMinimalBlockTime + xAllowableMargin ) ); - configASSERT( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) >= xMinimalBlockTime ); + prvCheckExpectedState( ( xTimeAfterCall - xTimeBeforeCall ) < ( xMinimalBlockTime + xAllowableMargin ) ); + prvCheckExpectedState( xReturned == sbSTREAM_BUFFER_LENGTH_BYTES ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdFALSE ); /* No space now though. */ xReturned = xStreamBufferSend( xStreamBuffer, ( const void * ) pc54ByteString, sbSTREAM_BUFFER_LENGTH_BYTES * ( size_t ) 2, xMinimalBlockTime ); - configASSERT( xReturned == 0 ); + prvCheckExpectedState( xReturned == 0 ); /* Ensure data was written as expected even when there was an attempt to write more than was available. This also tries to read more bytes than are available. */ xReturned = xStreamBufferReceive( xStreamBuffer, ( void * ) pucFullBuffer, xFullBufferSize, xMinimalBlockTime ); - configASSERT( memcmp( ( const void * ) pucFullBuffer, ( const void * ) pc54ByteString, sbSTREAM_BUFFER_LENGTH_BYTES ) == 0 ); - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); + prvCheckExpectedState( memcmp( ( const void * ) pucFullBuffer, ( const void * ) pc54ByteString, sbSTREAM_BUFFER_LENGTH_BYTES ) == 0 ); + prvCheckExpectedState( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); + prvCheckExpectedState( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); /* Clean up with data in the buffer to ensure the tests that follow don't see the data (the data should be discarded). */ @@ -458,12 +469,12 @@ const size_t xStringLength = strlen( pc54ByteString ); /* Attempt to send right up to the end of the string. */ xBytesActuallySent = xStreamBufferSend( xStreamBuffer, ( const void * ) &( pc54ByteString[ xNextChar ] ), xBytesToSend, sbDONT_BLOCK ); - configASSERT( xBytesActuallySent <= xBytesToSend ); + prvCheckExpectedState( xBytesActuallySent <= xBytesToSend ); /* Move the index up the string to the next character to be sent, wrapping if the end of the string has been reached. */ xNextChar += xBytesActuallySent; - configASSERT( xNextChar <= xStringLength ); + prvCheckExpectedState( xNextChar <= xStringLength ); if( xNextChar == xStringLength ) { @@ -565,7 +576,7 @@ BaseType_t xNonBlockingReceiveError = pdFALSE; /* Make sure a change in priority does not inadvertently result in an invalid array index. */ - configASSERT( uxIndex < sbNUMBER_OF_ECHO_CLIENTS ); + prvCheckExpectedState( uxIndex < sbNUMBER_OF_ECHO_CLIENTS ); /* Avoid compiler warnings about unused parameters. */ ( void ) pvParameters; @@ -601,12 +612,12 @@ BaseType_t xNonBlockingReceiveError = pdFALSE; /* Attempt to send right up to the end of the string. */ xBytesActuallySent = xStreamBufferSend( xStreamBuffer, ( const void * ) &( pc55ByteString[ xNextChar ] ), xBytesToSend, xTicksToWait ); - configASSERT( xBytesActuallySent <= xBytesToSend ); + prvCheckExpectedState( xBytesActuallySent <= xBytesToSend ); /* Move the index up the string to the next character to be sent, wrapping if the end of the string has been reached. */ xNextChar += xBytesActuallySent; - configASSERT( xNextChar <= xStringLength ); + prvCheckExpectedState( xNextChar <= xStringLength ); if( xNextChar == xStringLength ) { @@ -661,7 +672,7 @@ BaseType_t xNonBlockingReceiveError = pdFALSE; } while( xReceivedLength == 0 ); /* Ensure the received string matches the expected string. */ - configASSERT( memcmp( ( void * ) cRxString, ( const void * ) &( pc55ByteString[ xNextChar ] ), xReceivedLength ) == 0 ); + prvCheckExpectedState( memcmp( ( void * ) cRxString, ( const void * ) &( pc55ByteString[ xNextChar ] ), xReceivedLength ) == 0 ); /* Move the index into the string up to the end of the bytes received so far - wrapping if the end of the string has been @@ -743,7 +754,7 @@ EchoStreamBuffers_t *pxStreamBuffers = ( EchoStreamBuffers_t * ) pvParameters; memset( pcStringReceived, 0x00, sbSTREAM_BUFFER_LENGTH_BYTES ); xStreamBufferReceive( pxStreamBuffers->xEchoServerBuffer, ( void * ) pcStringReceived, xSendLength, portMAX_DELAY ); - configASSERT( strcmp( pcStringToSend, pcStringReceived ) == 0 ); + prvCheckExpectedState( strcmp( pcStringToSend, pcStringReceived ) == 0 ); /* Maintain a count of the number of times this code executes so a check task can determine if this task is still functioning as @@ -787,9 +798,8 @@ const TickType_t xTicksToBlock = pdMS_TO_TICKS( 350UL ); /* Don't expect to receive anything yet! */ xTimeOnEntering = xTaskGetTickCount(); xReceivedLength = xStreamBufferReceive( xStreamBuffers.xEchoClientBuffer, ( void * ) pcReceivedString, sbSTREAM_BUFFER_LENGTH_BYTES, xTicksToBlock ); - configASSERT( ( xTaskGetTickCount() - xTimeOnEntering ) >= xTicksToBlock ); - configASSERT( xReceivedLength == 0 ); - ( void ) xTimeOnEntering; + prvCheckExpectedState( ( xTaskGetTickCount() - xTimeOnEntering ) >= xTicksToBlock ); + prvCheckExpectedState( xReceivedLength == 0 ); /* Now the stream buffers have been created the echo client task can be created. If this server task has the higher priority then the client task @@ -815,7 +825,7 @@ const TickType_t xTicksToBlock = pdMS_TO_TICKS( 350UL ); xReceivedLength = xStreamBufferReceive( xStreamBuffers.xEchoClientBuffer, ( void * ) pcReceivedString, sbSTREAM_BUFFER_LENGTH_BYTES, xTicksToBlock ); /* Should always receive data as a delay was used. */ - configASSERT( xReceivedLength > 0 ); + prvCheckExpectedState( xReceivedLength > 0 ); /* Echo the received data back to the client. */ xStreamBufferSend( xStreamBuffers.xEchoServerBuffer, ( void * ) pcReceivedString, xReceivedLength, portMAX_DELAY ); @@ -946,13 +956,13 @@ BaseType_t xAreStreamBufferTasksStillRunning( void ) static uint32_t ulLastEchoLoopCounters[ sbNUMBER_OF_ECHO_CLIENTS ] = { 0 }; static uint32_t ulLastNonBlockingRxCounter = 0; static uint32_t ulLastInterruptTriggerCounter = 0; -BaseType_t xReturn = pdPASS, x; +BaseType_t x; for( x = 0; x < sbNUMBER_OF_ECHO_CLIENTS; x++ ) { if( ulLastEchoLoopCounters[ x ] == ulEchoLoopCounters[ x ] ) { - xReturn = pdFAIL; + xErrorStatus = pdFAIL; } else { @@ -962,7 +972,7 @@ BaseType_t xReturn = pdPASS, x; if( ulNonBlockingRxCounter == ulLastNonBlockingRxCounter ) { - xReturn = pdFAIL; + xErrorStatus = pdFAIL; } else { @@ -971,7 +981,7 @@ BaseType_t xReturn = pdPASS, x; if( ulLastInterruptTriggerCounter == ulInterruptTriggerCounter ) { - xReturn = pdFAIL; + xErrorStatus = pdFAIL; } else { @@ -986,7 +996,7 @@ BaseType_t xReturn = pdPASS, x; { if( ulLastSenderLoopCounters[ x ] == ulSenderLoopCounters[ x ] ) { - xReturn = pdFAIL; + xErrorStatus = pdFAIL; } else { @@ -996,7 +1006,7 @@ BaseType_t xReturn = pdPASS, x; } #endif /* configSUPPORT_STATIC_ALLOCATION */ - return xReturn; + return xErrorStatus; } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo b/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo index bb4718846ff2e2ac0118868b0a9b0feb09583b50..b50bd108f3bff098878054c2487aef0cdf7d5402 100644 GIT binary patch delta 3665 zcmd5;du)@}760yMJJ^YnIEh0O5*#NXAp}E=30Ve#7-B-(Ao3)nDeWAx6j1Xb7&a%F za9NP52?6n`My1l1=_FL~Nd3{4@mQS(rmB08DhQaGF~Pd_kFl+l(oINY+3(n&ql7ZC zPWxlm`uUuD?)}a=_uPBVy}oN2-wDkT8{ORzpJtMzSV@vJz(1#^ra&YCJWXAB+3&ay z3BTN)U^+iGvf{#+aA3e$MZI#bY!UQ#dB6CCyqYS#5%PS14rLbXI{@aViTFc{116z0 z+SmfO9LN^{%ol+s12JlU9_SL4F90kL0MOm+IOpTz9h|+n$-?Zq3=wZ!aHBomAYJagxd0w%~)2OyUl+!)!)9Fvm7=8?VHV_X?4%ViSPiIVR zQzxW=ZU=S%X&lHw_nL4V9iiEAe8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