]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/WIN32-MingW/main_full.c
Import the code coverage test additions from the (unpublished) Visual Studio project...
[freertos] / FreeRTOS / Demo / WIN32-MingW / main_full.c
index 38e303521e3c5ee5b371a87344d2d1ee73341434..b8e06d184646cf1d7a8840e9b402f93356e9570d 100644 (file)
 \r
 #define mainTIMER_TEST_PERIOD                  ( 50 )\r
 \r
+/*\r
+ * Exercises code that is not otherwise covered by the standard demo/test\r
+ * tasks.\r
+ */\r
+extern BaseType_t xRunCodeCoverageTestAdditions( void );\r
+\r
 /* Task function prototypes. */\r
 static void prvCheckTask( void *pvParameters );\r
 \r
@@ -420,7 +426,6 @@ void *pvAllocated;
        timer. */\r
        prvDemonstrateTimerQueryFunctions();\r
 \r
-\r
        /* If xMutexToDelete has not already been deleted, then delete it now.\r
        This is done purely to demonstrate the use of, and test, the\r
        vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore\r
@@ -445,6 +450,25 @@ void *pvAllocated;
        allocations so there is no need to test here. */\r
        pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 );\r
        vPortFree( pvAllocated );\r
+\r
+       /* Exit after a fixed time so code coverage results are written to the\r
+       disk. */\r
+       #if( projCOVERAGE_TEST == 1 )\r
+       {\r
+               const TickType_t xMaxRunTime = pdMS_TO_TICKS( 30000UL );\r
+\r
+               /* Exercise code not otherwise executed by standard demo/test tasks. */\r
+               if( xRunCodeCoverageTestAdditions() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Code coverage additions failed.\r\n";\r
+               }\r
+\r
+               if( ( xTaskGetTickCount() - configINITIAL_TICK_COUNT ) >= xMaxRunTime )\r
+               {\r
+                       vTaskEndScheduler();\r
+               }\r
+       }\r
+       #endif\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r