fb11e647
vrobic
reseau statique a...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
From ccb37ece1a21325bbc1f3efba7d3f0ec0d6b26ac Mon Sep 17 00:00:00 2001
From: Benjamin Valentin <benpicco@zedat.fu-berlin.de>
Date: Tue, 23 Jul 2013 21:08:31 +0200
Subject: [PATCH 02/10] port tests to riot
---
tests/common/.Makefile.template | 37 +++++++++++++++++++++++++++++++++++++
tests/common/bin/.gitignore | 0
tests/common/generate_makefiles.sh | 8 ++++++++
tests/common/test_common_avl.c | 10 +++++-----
tests/cunit/Makefile | 3 +++
tests/rfc5444/.Makefile.template | 30 ++++++++++++++++++++++++++++++
tests/rfc5444/bin/.gitignore | 0
tests/rfc5444/generate_makefiles.sh | 8 ++++++++
8 files changed, 91 insertions(+), 5 deletions(-)
create mode 100644 tests/common/.Makefile.template
create mode 100644 tests/common/bin/.gitignore
create mode 100755 tests/common/generate_makefiles.sh
create mode 100644 tests/cunit/Makefile
create mode 100644 tests/rfc5444/.Makefile.template
create mode 100644 tests/rfc5444/bin/.gitignore
create mode 100755 tests/rfc5444/generate_makefiles.sh
diff --git a/tests/common/.Makefile.template b/tests/common/.Makefile.template
new file mode 100644
index 0000000..afbaf0f
--- /dev/null
+++ b/tests/common/.Makefile.template
@@ -0,0 +1,37 @@
+####
+#### Sample Makefile for building apps with the RIOT OS
+####
+#### The Sample Filesystem Layout is:
+#### /this makefile
+#### ../../RIOT
+#### ../../boards for board definitions (if you have one or more)
+####
+
+# name of your project
+export APPLICATION = %TESTNAME%
+
+# for easy switching of boards
+export BOARD ?= native
+
+# this has to be the absolute path of the RIOT-base dir
+export RIOTBASE =$(CURDIR)/../../../../../..
+
+export CFLAGS = -DOONF_LOG_INFO -DOONF_LOG_DEBUG_INFO
+
+## Modules to include.
+
+USEMODULE += oonf_cunit
+ifneq (,$(findstring regex,$(APPLICATION)))
+ USEMODULE += oonf_regex
+endif
+USEMODULE += oonf_common
+
+ifneq (,$(findstring daemonize,$(APPLICATION)))
+ error daemonize is not supported on RIOT
+endif
+
+export INCLUDES += -I$(CURDIR)/../..
+
+QUIET ?= 1
+
+include $(RIOTBASE)/Makefile.include
diff --git a/tests/common/bin/.gitignore b/tests/common/bin/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/tests/common/generate_makefiles.sh b/tests/common/generate_makefiles.sh
new file mode 100755
index 0000000..8bf9faa
--- /dev/null
+++ b/tests/common/generate_makefiles.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+for file in *.c; do
+ test=$(basename $file .c)
+ mkdir -p $test
+ sed s/%TESTNAME%/$test/ .Makefile.template > $test/Makefile
+ cp $test\.c $test
+done
diff --git a/tests/common/test_common_avl.c b/tests/common/test_common_avl.c
index b5ee8c0..e4e5b26 100644
--- a/tests/common/test_common_avl.c
+++ b/tests/common/test_common_avl.c
@@ -816,17 +816,17 @@ static void random_delete(uint32_t *array, int count) {
/* insert/remove 1000's random numbers into tree and check if everything is okay */
static void test_random_insert(void) {
- uint32_t array[1000];
+ uint32_t array[100];
struct tree_element *e, *ptr;
srand(0);
START_TEST();
avl_init(&head, avl_comp_uint32, true);
- random_insert(array, 1000);
- random_delete(array, 500);
- random_insert(array, 400);
- random_delete(array, 600);
+ random_insert(array, 100);
+ random_delete(array, 50);
+ random_insert(array, 40);
+ random_delete(array, 60);
avl_remove_all_elements(&head, e, node, ptr) {
free(e);
diff --git a/tests/cunit/Makefile b/tests/cunit/Makefile
new file mode 100644
index 0000000..5e0046d
--- /dev/null
+++ b/tests/cunit/Makefile
@@ -0,0 +1,3 @@
+MODULE:=oonf_$(shell basename $(CURDIR))
+
+include $(RIOTBASE)/Makefile.base
diff --git a/tests/rfc5444/.Makefile.template b/tests/rfc5444/.Makefile.template
new file mode 100644
index 0000000..e472545
--- /dev/null
+++ b/tests/rfc5444/.Makefile.template
@@ -0,0 +1,30 @@
+####
+#### Sample Makefile for building apps with the RIOT OS
+####
+#### The Sample Filesystem Layout is:
+#### /this makefile
+#### ../../RIOT
+#### ../../boards for board definitions (if you have one or more)
+####
+
+# name of your project
+export APPLICATION = %TESTNAME%
+
+# for easy switching of boards
+export BOARD ?= native
+
+# this has to be the absolute path of the RIOT-base dir
+export RIOTBASE =$(CURDIR)/../../../../../..
+
+export CFLAGS = -DOONF_LOG_INFO -DOONF_LOG_DEBUG_INFO
+
+## Modules to include.
+USEMODULE += oonf_cunit
+USEMODULE += oonf_common
+USEMODULE += oonf_rfc5444
+
+export INCLUDES += -I$(CURDIR)/../..
+
+QUIET ?= 1
+
+include $(RIOTBASE)/Makefile.include
diff --git a/tests/rfc5444/bin/.gitignore b/tests/rfc5444/bin/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/tests/rfc5444/generate_makefiles.sh b/tests/rfc5444/generate_makefiles.sh
new file mode 100755
index 0000000..8bf9faa
--- /dev/null
+++ b/tests/rfc5444/generate_makefiles.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+for file in *.c; do
+ test=$(basename $file .c)
+ mkdir -p $test
+ sed s/%TESTNAME%/$test/ .Makefile.template > $test/Makefile
+ cp $test\.c $test
+done
--
1.9.1
|