Commit 8e5cfdfc authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Make the testing code more explicit (in user messages)

parent 5dd86507
......@@ -19,6 +19,7 @@ rtems_task Init(rtems_task_argument argument)
int i;
memcheck();
all_OK = 1;
g_init_task_id = rtems_task_self();
for(i = 0; i < TASKS; i++)
{
......@@ -30,12 +31,20 @@ rtems_task Init(rtems_task_argument argument)
Task_name[i],
(rtems_task_priority) 2,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES, // use RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE for Linux/Windows like
// handling of tasks with same priority (i.e. pre-emption)
#if CONFIGURE_SMP_MAXIMUM_PROCESSORS == 4
// LEON3/LEON4 system - use full SMP
RTEMS_DEFAULT_MODES,
#else
// LEON2 system - emulate SMP via Linux/Windows-like
// handling of tasks with same priority (i.e. pre-emption)
RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE
#endif
(i%2) == 0 ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[i]);
if (status != RTEMS_SUCCESSFUL) {
printf("[PARENT] Failed to rtems_task_create... status:%0x\n", status);
printf(
"[MAIN] Failed to rtems_task_create... status:%0x\n",
status);
rtems_task_delete(RTEMS_SELF);
}
......@@ -45,10 +54,10 @@ rtems_task Init(rtems_task_argument argument)
(i%2) == 0 ? Task1_EntryPoint : Task2_EntryPoint,
i);
}
// To give coverage code the opportunity to work, wait for child tasks to die first.
// We use RTEMS events here, but you can use any sync API you want.
// To give coverage code the opportunity to work, wait for children tasks
// to die first. RTEMS events are used for synchronization.
{
printf("[PARENT] Parent task waits for children to complete...\n");
printf("[MAIN] Waiting for testing tasks to complete...\n");
rtems_option options = (RTEMS_EVENT_ANY | RTEMS_WAIT);
rtems_event_set in = 0;
for (i=0; i<TASKS; i++)
......@@ -59,11 +68,15 @@ rtems_task Init(rtems_task_argument argument)
status = rtems_event_receive(in, options, RTEMS_NO_TIMEOUT, &out);
if ( status == RTEMS_SUCCESSFUL ) {
non_completed &= ~out;
printf("[PARENT] Child task completed.\n");
printf("[MAIN] Checking task completed.\n");
fflush(stdout);
}
}
printf("[PARENT] All tasks completed.\n");
printf("[MAIN] All testing tasks completed.\n");
if (!all_OK)
printf("[MAIN] Some tests failed... :-(\n");
else
printf("[MAIN] All tests passed! :-)\n");
fflush(stdout);
}
exit(0);
......
......@@ -28,5 +28,6 @@ void memcheck(void);
#endif
GLOBAL rtems_id g_init_task_id;
GLOBAL int all_OK;
#include <rtems/confdefs.h>
......@@ -14,7 +14,36 @@ rtems_task Task1_EntryPoint(rtems_task_argument argument)
d+=1.001;
d*=1.0001;
}
printf("[TASK %d] Computed value was %ld\n", task_no, (long)d);
{
long result = (long) d;
long target = 0;
switch(task_no) {
case 0:
target = 172003605L;
break;
case 2:
target = 172003611L;
break;
default:
printf(
"[TASK %d] Failed! Unexpected task number for FPU tests...\n",
task_no);
fflush(stdout);
all_OK = 0;
task_end(task_no);
return;
}
if (target != result) {
printf(
"[TASK %d] Failed! Computed value was %ld instead of %ld\n",
task_no, result, target);
fflush(stdout);
all_OK = 0;
task_end(task_no);
return;
}
}
printf("[TASK %d] Computed the correct floating point result.\n", task_no);
fflush(stdout);
task_end(task_no);
}
......@@ -14,6 +14,16 @@ rtems_task Task2_EntryPoint(rtems_task_argument argument)
dummy ^= k;
dummy++;
}
printf("[TASK %d] Computed value was %lld\n", task_no, dummy);
if (dummy != 500000) {
printf(
"[TASK %d] Failed! Computed value was %lld instead of 500000\n",
task_no, dummy);
fflush(stdout);
all_OK = 0;
task_end(task_no);
return;
}
printf("[TASK %d] Computed the correct integer result.\n", task_no);
fflush(stdout);
task_end((int) argument);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment