static void prvTestAbortingQueueSend( void );\r
static void prvTestAbortingStreamBufferReceive( void );\r
\r
+/*\r
+ * Performs a few tests to cover code paths not otherwise covered by the continuous\r
+ * tests.\r
+ */\r
+static void prvPerformSingleTaskTests( void );\r
+\r
/*\r
* Checks the amount of time a task spent in the Blocked state is within the\r
* expected bounds.\r
TickType_t xTimeAtStart;\r
const TickType_t xStartMargin = 2UL;\r
\r
+/* Used to control whether to use xTaskAbortDelay() or xTaskAbortDelayFromISR() so\r
+both are used with all the tests. */\r
+BaseType_t xUseFromISRVersion = pdFALSE, xHigherPriorityTaskWoken;\r
+\r
/* Just to remove compiler warnings. */\r
( void ) pvParameters;\r
\r
raise the priority of the controlling task to that of the blocking\r
task to minimise discrepancies. */\r
vTaskPrioritySet( NULL, abtBLOCKING_PRIORITY );\r
+\r
vTaskDelay( xMaxBlockTime + xHalfMaxBlockTime + xStartMargin );\r
- if( xTaskAbortDelay( xBlockingTask ) != pdPASS )\r
+\r
+ /* For test coverage sometimes xTaskAbortDelay() is used and sometimes\r
+ xTaskAbortDelayFromISR() is used. */\r
+ if( xUseFromISRVersion == pdFALSE )\r
{\r
- xErrorOccurred = pdTRUE;\r
+ if( xTaskAbortDelay( xBlockingTask ) != pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+ /* For test coverage, sometimes xHigherPriorityTaskWoken is used, and\r
+ sometimes NULL is used. */\r
+\r
+ if( ( xControllingCycles % 2 ) == 0 )\r
+ {\r
+ if( xTaskAbortDelayFromISR( xBlockingTask, &xHigherPriorityTaskWoken ) != pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( xTaskAbortDelayFromISR( xBlockingTask, NULL ) != pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ }\r
+\r
+ /* The tasks have the same priority so xHigherPriorityTaskWoken should\r
+ never get set. */\r
+ if( xHigherPriorityTaskWoken != pdFALSE )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
}\r
\r
/* Reset the priority to the normal controlling priority. */\r
\r
/* To indicate this task is still executing. */\r
xControllingCycles++;\r
+\r
+ if( ( xControllingCycles % abtMAX_TESTS ) == 0 )\r
+ {\r
+ /* Looped through all the tests. Switch between using xTaskAbortDelay()\r
+ and xTaskAbortDelayFromISR() for the next round of tests. */\r
+ xUseFromISRVersion = !xUseFromISRVersion;\r
+ }\r
}\r
}\r
/*-----------------------------------------------------------*/\r
/* Just to remove compiler warnings. */\r
( void ) pvParameters;\r
\r
+ /* Start by performing a few tests to cover code not exercised in the loops\r
+ below. */\r
+ prvPerformSingleTaskTests();\r
+\r
xControllingTask = xTaskGetHandle( pcControllingTaskName );\r
configASSERT( xControllingTask );\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void prvPerformSingleTaskTests( void )\r
+{\r
+TaskHandle_t xThisTask;\r
+BaseType_t xReturned;\r
+\r
+ /* Try unblocking this task using both the task and ISR versions of the API -\r
+ both should return false as this task is not blocked. */\r
+ xThisTask = xTaskGetCurrentTaskHandle();\r
+\r
+ xReturned = xTaskAbortDelay( xThisTask );\r
+ if( xReturned != pdFALSE )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
+ xReturned = xTaskAbortDelayFromISR( xThisTask, NULL );\r
+ if( xReturned != pdFALSE )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
static void prvTestAbortingTaskDelayUntil( void )\r
{\r
TickType_t xTimeAtStart, xLastBlockTime;\r