summaryrefslogtreecommitdiff
path: root/src/grt/config/teststack.c
diff options
context:
space:
mode:
authorTristan Gingold2015-09-13 19:09:21 +0200
committerTristan Gingold2015-09-13 19:09:21 +0200
commit0af83126cae63e9bd71deb924ca1b81c57e590d3 (patch)
treece41768340ab932cf0b6e08ac31580c035c46c1d /src/grt/config/teststack.c
parent98ebbb21cd95cc467ddee8efd0de2cfc5a515180 (diff)
downloadghdl-0af83126cae63e9bd71deb924ca1b81c57e590d3.tar.gz
ghdl-0af83126cae63e9bd71deb924ca1b81c57e590d3.tar.bz2
ghdl-0af83126cae63e9bd71deb924ca1b81c57e590d3.zip
Remove unused files (were for stack switching).
Diffstat (limited to 'src/grt/config/teststack.c')
-rw-r--r--src/grt/config/teststack.c174
1 files changed, 0 insertions, 174 deletions
diff --git a/src/grt/config/teststack.c b/src/grt/config/teststack.c
deleted file mode 100644
index 6a6966d..0000000
--- a/src/grt/config/teststack.c
+++ /dev/null
@@ -1,174 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-
-extern void grt_stack_init (void);
-extern void grt_stack_switch (void *from, void *to);
-extern void *grt_stack_create (void (*func)(void *), void *arg);
-
-int stack_size = 4096;
-int stack_max_size = 8 * 4096;
-
-static void *stack1;
-static void *stack2;
-void *grt_stack_main_stack;
-
-void *grt_cur_proc;
-
-static int step;
-
-void
-grt_overflow_error (void)
-{
- abort ();
-}
-
-void
-grt_stack_error_null_access (void)
-{
- abort ();
-}
-
-void
-grt_stack_error_memory_access (void)
-{
- abort ();
-}
-
-void
-grt_stack_error_grow_failed (void)
-{
- abort ();
-}
-
-void
-error (void)
-{
- printf ("Test failure at step %d\n", step);
- fflush (stdout);
- exit (1);
-}
-
-static void
-func1 (void *ptr)
-{
- if (ptr != (void *)1)
- error ();
-
- if (step != 0)
- error ();
-
- step = 1;
-
- grt_stack_switch (grt_stack_main_stack, stack1);
-
- if (step != 5)
- error ();
-
- step = 6;
-
- grt_stack_switch (grt_stack_main_stack, stack1);
-
- if (step != 7)
- error ();
-
- step = 8;
-
- grt_stack_switch (stack2, stack1);
-
- if (step != 9)
- error ();
-
- step = 10;
-
- grt_stack_switch (grt_stack_main_stack, stack1);
-
- error ();
-}
-
-static void
-func2 (void *ptr)
-{
- if (ptr != (void *)2)
- error ();
-
- if (step == 11)
- {
- step = 12;
-
- grt_stack_switch (grt_stack_main_stack, stack2);
-
- error ();
- }
-
- if (step != 1)
- error ();
-
- step = 2;
-
- grt_stack_switch (grt_stack_main_stack, stack2);
-
- if (step != 3)
- error ();
-
- step = 4;
-
- grt_stack_switch (grt_stack_main_stack, stack2);
-
- if (step != 8)
- error ();
-
- step = 9;
-
- grt_stack_switch (stack1, stack2);
-}
-
-int
-main (void)
-{
- grt_stack_init ();
-
- stack1 = grt_stack_create (&func1, (void *)1);
- stack2 = grt_stack_create (&func2, (void *)2);
-
- step = 0;
- grt_stack_switch (stack1, grt_stack_main_stack);
-
- if (step != 1)
- error ();
-
- grt_stack_switch (stack2, grt_stack_main_stack);
-
- if (step != 2)
- error ();
-
- step = 3;
-
- grt_stack_switch (stack2, grt_stack_main_stack);
-
- if (step != 4)
- error ();
-
- step = 5;
-
- grt_stack_switch (stack1, grt_stack_main_stack);
-
- if (step != 6)
- error ();
-
- step = 7;
-
- grt_stack_switch (stack1, grt_stack_main_stack);
-
- if (step != 10)
- error ();
-
- step = 11;
-
- grt_stack_switch (stack2, grt_stack_main_stack);
-
- if (step != 12)
- error ();
-
- printf ("Test successful\n");
- return 0;
-}