summaryrefslogtreecommitdiffstats
path: root/testsuites/samples/unlimited/test2.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/samples/unlimited/test2.c')
-rw-r--r--testsuites/samples/unlimited/test2.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/testsuites/samples/unlimited/test2.c b/testsuites/samples/unlimited/test2.c
index 3416c1532b..0491e84ae6 100644
--- a/testsuites/samples/unlimited/test2.c
+++ b/testsuites/samples/unlimited/test2.c
@@ -32,25 +32,25 @@ void test2()
uint32_t block;
uint32_t task_count = 0;
rtems_id removed_ids[TASK_ALLOCATION_SIZE * 2];
-
+
char c1 = 'a';
char c2 = 'a';
char c3 = '0';
char c4 = '0';
-
+
printf( "\n TEST2 : re-allocate of index numbers, and a block free'ed and one inactive\n" );
/*
* Allocate enought tasks so the Inactive list is empty. Remember
* to count the Init task, ie ... - 1.
*/
-
+
while (task_count < ((TASK_ALLOCATION_SIZE * 5) - TASK_INDEX_OFFSET))
{
rtems_name name;
printf(" TEST2 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
-
+
name = rtems_build_name(c1, c2, c3, c4);
result = rtems_task_create(name,
@@ -62,23 +62,23 @@ void test2()
if (status_code_bad(result))
break;
-
+
printf("number = %3i, id = %08x, starting, ", task_count, task_id[task_count]);
fflush(stdout);
-
+
result = rtems_task_start(task_id[task_count],
test_task,
(rtems_task_argument) task_count);
-
+
if (status_code_bad(result))
break;
-
+
/*
* Update the name.
*/
-
+
NEXT_TASK_NAME(c1, c2, c3, c4);
-
+
task_count++;
}
@@ -95,7 +95,7 @@ void test2()
}
task = 0;
-
+
for (block = 1; block < 4; block += 2)
{
for (remove_task = (block * TASK_ALLOCATION_SIZE) - TASK_INDEX_OFFSET;
@@ -114,9 +114,9 @@ void test2()
/*
* Save the id's to match them against the reallocated ids
*/
-
+
removed_ids[task++] = task_id[remove_task];
-
+
printf(" TEST2 : block %i remove, signal task %08x, ", block, task_id[remove_task]);
rtems_event_send(task_id[remove_task], 1);
task_id[remove_task] = 0;
@@ -135,7 +135,7 @@ void test2()
for (id_slot = 0; id_slot < MAX_TASKS; id_slot++)
if (!task_id[id_slot])
break;
-
+
if (id_slot == MAX_TASKS)
{
printf( " FAIL2 : no free task id slot.\n");
@@ -144,7 +144,7 @@ void test2()
}
printf(" TEST2 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
-
+
name = rtems_build_name(c1, c2, c3, c4);
result = rtems_task_create(name,
@@ -153,7 +153,7 @@ void test2()
RTEMS_DEFAULT_ATTRIBUTES,
RTEMS_LOCAL,
&task_id[id_slot]);
-
+
if (status_code_bad(result))
{
printf( " FAIL2 : re-creating a task -\n"
@@ -162,13 +162,13 @@ void test2()
destory_all_tasks("TEST2");
exit( 1 );
}
-
+
printf("number = %3i, id = %08x, starting, ", task_count, task_id[id_slot]);
-
+
result = rtems_task_start(task_id[id_slot],
test_task,
(rtems_task_argument) task_count);
-
+
if (status_code_bad(result))
{
printf( " FAIL : re-starting a task -\n"
@@ -177,17 +177,17 @@ void test2()
destory_all_tasks("TEST2");
exit( 1 );
}
-
+
/*
* Update the name.
*/
-
+
NEXT_TASK_NAME(c1, c2, c3, c4);
-
+
/*
* Search the removed ids to see if it existed, clear the removed id when found
*/
-
+
for (remove_task = 0; remove_task < (TASK_ALLOCATION_SIZE * 2); remove_task++)
if (removed_ids[remove_task] == task_id[id_slot])
{
@@ -199,11 +199,11 @@ void test2()
* If not located in the removed id table, check and make sure it is not
* already allocated
*/
-
+
if (remove_task == (TASK_ALLOCATION_SIZE * 2))
{
uint32_t allocated_id;
-
+
for (allocated_id = 0; allocated_id < MAX_TASKS; allocated_id++)
if ((task_id[id_slot] == task_id[allocated_id]) && (id_slot != allocated_id))
{
@@ -212,7 +212,7 @@ void test2()
task_id[id_slot]);
exit( 1 );
}
-
+
printf( " FAIL2 : could not find the task id in the removed table -\n"
" task id = %08x\n",
task_id[id_slot]);
@@ -221,8 +221,8 @@ void test2()
task_count++;
}
-
+
destory_all_tasks("TEST2");
-
+
printf( " TEST2 : completed\n" );
}