X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FCommon%2FMinimal%2FGenQTest.c;fp=FreeRTOS%2FDemo%2FCommon%2FMinimal%2FGenQTest.c;h=66be41733fdd976b7d4f65dc6786cd55bfd41e38;hb=cd1ad55ff8962389a69bcdcf56f129a017cd6bac;hp=4d146054c78ded76132729ce49bf0eb454a473bc;hpb=a22b3e5a2d0a093436bdfd5f78813e239f8e476b;p=freertos 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 );