Module: xenomai-forge
Branch: next
Commit: 07f0be5f7a41209f83e4a93f7dd82055a78b355b
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=07f0be5f7a41209f83e4a93f7dd82055a78b355b

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed May  8 17:06:34 2013 +0200

alchemy/testsuite: check exec sequence in heap-1

---

 lib/alchemy/testsuite/heap-1.c |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/lib/alchemy/testsuite/heap-1.c b/lib/alchemy/testsuite/heap-1.c
index c626d5d..7b002da 100644
--- a/lib/alchemy/testsuite/heap-1.c
+++ b/lib/alchemy/testsuite/heap-1.c
@@ -5,6 +5,12 @@
 #include <alchemy/task.h>
 #include <alchemy/heap.h>
 
+static int tseq[] = {
+       7, 1, 2, 3, 4,
+       8, 9, 5, 6, 10,
+       11, 12,
+};
+
 static struct traceobj trobj;
 
 static RT_TASK t_bgnd, t_fgnd;
@@ -15,18 +21,24 @@ static void background_task(void *arg)
        RT_HEAP heap;
        int ret;
 
+       traceobj_enter(&trobj);
+
+       traceobj_mark(&trobj, 7);
        ret = rt_heap_bind(&heap, "HEAP", TM_INFINITE);
        traceobj_assert(&trobj, ret == 0);
-
-       traceobj_enter(&trobj);
+       traceobj_mark(&trobj, 8);
 
        ret = rt_heap_alloc(&heap, 8192, TM_NONBLOCK, &p1);
+       traceobj_mark(&trobj, 9);
        traceobj_assert(&trobj, ret == -EWOULDBLOCK);
        ret = rt_heap_alloc(&heap, 8192, TM_INFINITE, &p1);
+       traceobj_mark(&trobj, 10);
        traceobj_assert(&trobj, ret == 0);
        ret = rt_heap_alloc(&heap, 8192, TM_NONBLOCK, &p2);
+       traceobj_mark(&trobj, 11);
        traceobj_assert(&trobj, ret == 0);
        ret = rt_heap_alloc(&heap, 8192, TM_INFINITE, &p1);
+       traceobj_mark(&trobj, 12);
        traceobj_assert(&trobj, ret == -EIDRM);
 
        traceobj_exit(&trobj);
@@ -38,20 +50,26 @@ static void foreground_task(void *arg)
        RT_HEAP heap;
        int ret;
 
+       traceobj_enter(&trobj);
+
+       traceobj_mark(&trobj, 1);
        ret = rt_heap_bind(&heap, "HEAP", TM_INFINITE);
        traceobj_assert(&trobj, ret == 0);
-
-       traceobj_enter(&trobj);
+       traceobj_mark(&trobj, 2);
 
        ret = rt_heap_alloc(&heap, 8192, TM_NONBLOCK, &p1);
        traceobj_assert(&trobj, ret == 0);
+       traceobj_mark(&trobj, 3);
        ret = rt_heap_alloc(&heap, 8192, TM_NONBLOCK, &p2);
        traceobj_assert(&trobj, ret == 0);
+       traceobj_mark(&trobj, 4);
 
        ret = rt_task_set_priority(NULL, 19);
        traceobj_assert(&trobj, ret == 0);
+       traceobj_mark(&trobj, 5);
        ret = rt_task_set_priority(NULL, 21);
        traceobj_assert(&trobj, ret == 0);
+       traceobj_mark(&trobj, 6);
 
        ret = rt_heap_free(&heap, p1);
        traceobj_assert(&trobj, ret == 0);
@@ -73,7 +91,7 @@ int main(int argc, char *const argv[])
 
        copperplate_init(&argc, &argv);
 
-       traceobj_init(&trobj, argv[0], 0);
+       traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
 
        ret = rt_task_create(&t_bgnd, "BGND", 0,  20, 0);
        traceobj_assert(&trobj, ret == 0);
@@ -92,5 +110,7 @@ int main(int argc, char *const argv[])
 
        traceobj_join(&trobj);
 
+       traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));
+
        exit(0);
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to