Module: xenomai-forge
Branch: rtdm-api-waitqueues
Commit: 83cf9f5eea2065c670398c1905570ee4b23b25da
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=83cf9f5eea2065c670398c1905570ee4b23b25da

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Apr 24 10:38:21 2014 +0200

alchemy/testsuite: check block+suspend conjunctive wait

---

 lib/alchemy/testsuite/Makefile  |    1 +
 lib/alchemy/testsuite/task-10.c |   72 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/lib/alchemy/testsuite/Makefile b/lib/alchemy/testsuite/Makefile
index 04a299d..5726cad 100644
--- a/lib/alchemy/testsuite/Makefile
+++ b/lib/alchemy/testsuite/Makefile
@@ -21,6 +21,7 @@ TESTS :=      \
        task-7  \
        task-8  \
        task-9  \
+       task-10 \
        mq-1    \
        mq-2    \
        mq-3    \
diff --git a/lib/alchemy/testsuite/task-10.c b/lib/alchemy/testsuite/task-10.c
new file mode 100644
index 0000000..3b16ff3
--- /dev/null
+++ b/lib/alchemy/testsuite/task-10.c
@@ -0,0 +1,72 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <copperplate/traceobj.h>
+#include <alchemy/task.h>
+#include <alchemy/sem.h>
+
+static struct traceobj trobj;
+
+static int tseq[] = {
+       1, 6, 2, 3, 4, 7, 5
+};
+
+static RT_TASK t_test;
+
+static RT_SEM sem;
+
+static void test_task(void *arg)
+{
+       int ret;
+
+       traceobj_enter(&trobj);
+
+       traceobj_mark(&trobj, 6);
+
+       ret = rt_sem_p(&sem, TM_INFINITE);
+       traceobj_assert(&trobj, ret == 0);
+
+       traceobj_mark(&trobj, 7);
+
+       traceobj_exit(&trobj);
+}
+
+int main(int argc, char *const argv[])
+{
+       int ret;
+
+       traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));
+
+       ret = rt_sem_create(&sem, "SEMA", 0, S_FIFO);
+       traceobj_assert(&trobj, ret == 0);
+
+       ret = rt_task_create(&t_test, "test_task", 0, 10, 0);
+       traceobj_assert(&trobj, ret == 0);
+
+       traceobj_mark(&trobj, 1);
+
+       ret = rt_task_start(&t_test, test_task, NULL);
+       traceobj_assert(&trobj, ret == 0);
+
+       traceobj_mark(&trobj, 2);
+
+       ret = rt_task_suspend(&t_test);
+       traceobj_assert(&trobj, ret == 0);
+
+       traceobj_mark(&trobj, 3);
+
+       ret = rt_sem_v(&sem);
+       traceobj_assert(&trobj, ret == 0);
+
+       traceobj_mark(&trobj, 4);
+
+       ret = rt_task_resume(&t_test);
+       traceobj_assert(&trobj, ret == 0);
+
+       traceobj_mark(&trobj, 5);
+
+       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