Make full demo exit on error

pull/622/head
Alfred Gedeon 4 years ago committed by alfred gedeon
parent aed7209b7a
commit e84fc19966

@ -97,7 +97,7 @@ ${BUILD_DIR}/${BIN} : ${OBJ_FILES}
${BUILD_DIR}/%.o : %.c Makefile
-mkdir -p $(@D)
$(CC) $(CPPFLAGS) $(CFLAGS) -MMD -c $< -o $@
$(CC) $(CFLAGS) ${INCLUDE_DIRS} -DUSER_DEMO= -MMD -c $< -o $@
.PHONY: clean
@ -110,7 +110,3 @@ profile:
gprof -a -p --all-lines $(GPROF_OPTIONS) $(BUILD_DIR)/$(BIN) $(BUILD_DIR)/gmon.out > $(BUILD_DIR)/prof_flat.txt
gprof -a --graph $(GPROF_OPTIONS) $(BUILD_DIR)/$(BIN) $(BUILD_DIR)/gmon.out > $(BUILD_DIR)/prof_call_graph.txt

@ -65,16 +65,18 @@
/* Local includes. */
#include "console.h"
#define BLINKY_DEMO 0
#define FULL_DEMO 1
#define mainSELECTED_APPLICATION BLINKY_DEMO
#ifdef BUILD_DIR
#define BUILD BUILD_DIR
#else
#define BUILD "./"
#endif
#ifdef USER_DEMO
#define mainSELECTED_APPLICATION USER_DEMO
#else
#define BLINKY_DEMO 0
#define FULL_DEMO 1
#define mainSELECTED_APPLICATION FULL_DEMO
#endif
/* This demo uses heap_3.c (the libc provided malloc() and free()). */
@ -132,8 +134,6 @@ static BaseType_t xTraceRunning = pdTRUE;
/*-----------------------------------------------------------*/
int main( void )
{
/* SIGINT is not blocked by the posix port */
@ -418,6 +418,5 @@ void handle_sigint( int signal )
{
printf( "chdir into %s error is %d\n", BUILD, errno );
}
exit( 1 );
exit( 2 );
}

@ -185,6 +185,7 @@ static void prvReloadModeTestTimerCallback( TimerHandle_t xTimer );
/* The variable into which error messages are latched. */
static char * pcStatusMessage = "OK: No errors";
int xErrorCount = 0;
/* This semaphore is created purely to test using the vSemaphoreDelete() and
* semaphore tracing API functions. It has no other purpose. */
@ -287,6 +288,7 @@ static void prvCheckTask( void * pvParameters )
if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )
{
pcStatusMessage = "Error: TimerDemo";
xErrorCount++;
}
}
#endif
@ -294,106 +296,131 @@ static void prvCheckTask( void * pvParameters )
if( xAreStreamBufferTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: StreamBuffer";
xErrorCount++;
}
else if( xAreMessageBufferTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: MessageBuffer";
xErrorCount++;
}
else if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: Notification";
xErrorCount++;
}
/* else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) */
/* { */
/* pcStatusMessage = "Error: NotificationArray"; */
/* } */
/* else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: NotificationArray";
xErrorCount++;
} */
else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: IntSem";
xErrorCount++;
}
else if( xAreEventGroupTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: EventGroup";
xErrorCount++;
}
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: IntMath";
xErrorCount++;
}
else if( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: GenQueue";
xErrorCount++;
}
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: QueuePeek";
xErrorCount++;
}
else if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: BlockQueue";
xErrorCount++;
}
else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: SemTest";
xErrorCount++;
}
else if( xArePollingQueuesStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: PollQueue";
xErrorCount++;
}
else if( xAreMathsTaskStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Flop";
xErrorCount++;
}
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: RecMutex";
xErrorCount++;
}
else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: CountSem";
xErrorCount++;
}
else if( xIsCreateTaskStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: Death";
xErrorCount++;
}
else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Dynamic";
xErrorCount++;
}
else if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Queue overwrite";
xErrorCount++;
}
else if( xAreBlockTimeTestTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Block time";
xErrorCount++;
}
else if( xAreAbortDelayTestTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Abort delay";
xErrorCount++;
}
else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Stream buffer interrupt";
xErrorCount++;
}
else if( xAreMessageBufferAMPTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Message buffer AMP";
xErrorCount++;
}
#if ( configUSE_QUEUE_SETS == 1 )
else if( xAreQueueSetTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Queue set";
xErrorCount++;
}
else if( xAreQueueSetPollTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Queue set polling";
xErrorCount++;
}
#endif
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
else if( xAreStaticAllocationTasksStillRunning() != pdPASS )
{
xErrorCount++;
pcStatusMessage = "Error: Static allocation";
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
@ -402,6 +429,11 @@ static void prvCheckTask( void * pvParameters )
pcStatusMessage,
xTaskGetTickCount() );
if( xErrorCount != 0 )
{
exit( 1 );
}
/* Reset the error condition */
pcStatusMessage = "OK: No errors";
}
@ -490,6 +522,7 @@ void vFullDemoIdleFunction( void )
if( xRunCodeCoverageTestAdditions() != pdPASS )
{
pcStatusMessage = "Code coverage additions failed.\r\n";
xErrorCount++;
}
if( ( xTaskGetTickCount() - configINITIAL_TICK_COUNT ) >= xMaxRunTime )
@ -656,6 +689,7 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle )
{
pcStatusMessage = "Error: Returned idle task handle was incorrect";
xErrorCount++;
}
/* Check the same handle is obtained using the idle task's name. First try
@ -663,11 +697,13 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
if( xTaskGetHandle( "Idle" ) == xIdleTaskHandle )
{
pcStatusMessage = "Error: Returned handle for name Idle was incorrect";
xErrorCount++;
}
if( xTaskGetHandle( "IDLE" ) != xIdleTaskHandle )
{
pcStatusMessage = "Error: Returned handle for name Idle was incorrect";
xErrorCount++;
}
/* Check the timer task handle was returned correctly. */
@ -676,23 +712,27 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
if( strcmp( pcTaskName, "Tmr Svc" ) != 0 )
{
pcStatusMessage = "Error: Returned timer task handle was incorrect";
xErrorCount++;
}
if( xTaskGetHandle( "Tmr Svc" ) != xTimerTaskHandle )
{
pcStatusMessage = "Error: Returned handle for name Tmr Svc was incorrect";
xErrorCount++;
}
/* This task is running, make sure it's state is returned as running. */
if( eTaskStateGet( xIdleTaskHandle ) != eRunning )
{
pcStatusMessage = "Error: Returned idle task state was incorrect";
xErrorCount++;
}
/* If this task is running, then the timer task must be blocked. */
if( eTaskStateGet( xTimerTaskHandle ) != eBlocked )
{
pcStatusMessage = "Error: Returned timer task state was incorrect";
xErrorCount++;
}
/* Also with the vTaskGetInfo() function. */
@ -709,6 +749,7 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
( xTaskInfo.xHandle != xTimerTaskHandle ) )
{
pcStatusMessage = "Error: vTaskGetInfo() returned incorrect information about the timer task";
xErrorCount++;
}
/* Other tests that should only be performed once follow. The test task
@ -726,6 +767,7 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
if( eTaskStateGet( xTestTask ) != eReady )
{
pcStatusMessage = "Error: Returned test task state was incorrect 1";
xErrorCount++;
}
/* Now suspend the test task and check its state is reported correctly. */
@ -734,6 +776,7 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
if( eTaskStateGet( xTestTask ) != eSuspended )
{
pcStatusMessage = "Error: Returned test task state was incorrect 2";
xErrorCount++;
}
/* Now delete the task and check its state is reported correctly. */
@ -742,6 +785,7 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
if( eTaskStateGet( xTestTask ) != eDeleted )
{
pcStatusMessage = "Error: Returned test task state was incorrect 3";
xErrorCount++;
}
}
}

Loading…
Cancel
Save