summaryrefslogtreecommitdiffstats
path: root/testsuites/samples/unlimited/test1.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-17 16:01:03 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-17 16:01:03 +0000
commitf4a8ee1c55788aeb053ede7571b07906a9847a45 (patch)
tree7417825a9a351aaf100374b08d314756523bef5f /testsuites/samples/unlimited/test1.c
parentSuggested rephrasing of inline versus macros option by Chris Johns (diff)
downloadrtems-f4a8ee1c55788aeb053ede7571b07906a9847a45.tar.bz2
Unlimited objects patch from Chris Johns <ccj@acm.org>. Email follows:
First, the unlimited patch. I have compiled the unlmited patch for the Linux posix BSP only and it seems to work cleanly. I would like a really major application run on this change before commiting as the changes are very core and significant. I am currently building all the tests to run. I have no targets suitable to test on at the moment. I have tested the patch for inline functions and macros. Turning macros on has found some core bugs. I have fixed these but have not run all the tests. Please review the patch for these changes. They are: 1) The conditional compilation for MP support broke the core messages code. You cannot embed a conditional macro in another macro. The Send and Urgent Send calls are macros. 2) User extensions handler initialisation now has two parameters. I have updated the macros to support the extra parameter. The patch also contains the gcc-target-default.cfg fix required to build the kernel. More of a by product than a fix for you.
Diffstat (limited to 'testsuites/samples/unlimited/test1.c')
-rw-r--r--testsuites/samples/unlimited/test1.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/testsuites/samples/unlimited/test1.c b/testsuites/samples/unlimited/test1.c
new file mode 100644
index 0000000000..2f415492d9
--- /dev/null
+++ b/testsuites/samples/unlimited/test1.c
@@ -0,0 +1,102 @@
+/* Test1
+ *
+ * This test uses a hack to disable suto-extend then checks to see only the
+ * requested number of objects are allocated.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989-1997.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may in
+ * the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include "system.h"
+#include <rtems/score/object.h>
+#include <stdio.h>
+
+void test1()
+{
+ boolean auto_extend;
+ rtems_status_code result;
+ rtems_unsigned32 task_count = 0;
+
+ char c1 = 'a';
+ char c2 = 'a';
+ char c3 = '0';
+ char c4 = '0';
+
+ printf( "\n TEST1 : auto-extend disabled.\n" );
+
+ /*
+ * This is a major hack and only recommended for a test. Doing this
+ * saves having another test.
+ */
+
+ auto_extend = _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend;
+ _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend = FALSE;
+
+ while (task_count < MAX_TASKS)
+ {
+ rtems_name name;
+
+ printf(" TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
+
+ name = rtems_build_name(c1, c2, c3, c4);
+
+ result = rtems_task_create(name,
+ 10,
+ 4096,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ RTEMS_LOCAL,
+ &task_id[task_count]);
+
+ if (status_code_bad(result))
+ break;
+
+ printf("number = %3i, id = %08x, starting, ", task_count, task_id[task_count]);
+
+ 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++;
+ }
+
+ if (task_count >= MAX_TASKS)
+ printf( "\nMAX_TASKS too small for work-space size, please make larger !!\n\n" );
+
+ if (task_count != (TASK_ALLOCATION_SIZE - 1)) {
+ printf( " FAIL1 : the number of tasks does not equal the expected size -\n"
+ " task created = %i, required number = %i\n",
+ task_count, TASK_ALLOCATION_SIZE);
+ exit( 1 );
+ }
+
+ destory_all_tasks("TEST1");
+
+ _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend = auto_extend;
+
+ printf( " TEST1 : completed\n" );
+}
+
+
+
+
+