Skip to content

Commit 1d25eba

Browse files
committed
tests: obj tracing: fix counting
We break out of the while loop on a 2 count then we assert on 2, this seems to never fail. Count to the end and then assert. Signed-off-by: Anas Nashif <[email protected]>
1 parent 5d94b89 commit 1d25eba

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

tests/kernel/obj_tracing/src/trace_obj.c

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ static void get_obj_count(int obj_type)
7373
*/
7474
if (obj_list == &ktimer || obj_list == &timer) {
7575
obj_found++;
76-
if (obj_found == 2) {
77-
TC_PRINT("Found timer objects\n");
78-
break;
79-
}
8076
}
8177
obj_list = SYS_TRACING_NEXT(struct k_timer, k_timer,
8278
obj_list);
@@ -90,10 +86,6 @@ static void get_obj_count(int obj_type)
9086
while (obj_list != NULL) {
9187
if (obj_list == &kmslab || obj_list == &mslab) {
9288
obj_found++;
93-
if (obj_found == 2) {
94-
TC_PRINT("Found memory slab objects\n");
95-
break;
96-
}
9789
}
9890
obj_list = SYS_TRACING_NEXT(struct k_mem_slab,
9991
k_mem_slab, obj_list);
@@ -107,10 +99,6 @@ static void get_obj_count(int obj_type)
10799
while (obj_list != NULL) {
108100
if (obj_list == &ksema || obj_list == &sema) {
109101
obj_found++;
110-
if (obj_found == 2) {
111-
TC_PRINT("Found semaphore objects\n");
112-
break;
113-
}
114102
}
115103
obj_list = SYS_TRACING_NEXT(struct k_sem, k_sem,
116104
obj_list);
@@ -124,10 +112,6 @@ static void get_obj_count(int obj_type)
124112
while (obj_list != NULL) {
125113
if (obj_list == &kmutex || obj_list == &mutex) {
126114
obj_found++;
127-
if (obj_found == 2) {
128-
TC_PRINT("Found mutex objects\n");
129-
break;
130-
}
131115
}
132116
obj_list = SYS_TRACING_NEXT(struct k_mutex, k_mutex,
133117
obj_list);
@@ -141,10 +125,6 @@ static void get_obj_count(int obj_type)
141125
while (obj_list != NULL) {
142126
if (obj_list == &kstack || obj_list == &stack) {
143127
obj_found++;
144-
if (obj_found == 2) {
145-
TC_PRINT("Found stack objects\n");
146-
break;
147-
}
148128
}
149129
obj_list = SYS_TRACING_NEXT(struct k_stack, k_stack,
150130
obj_list);
@@ -158,10 +138,6 @@ static void get_obj_count(int obj_type)
158138
while (obj_list != NULL) {
159139
if (obj_list == &kmsgq || obj_list == &msgq) {
160140
obj_found++;
161-
if (obj_found == 2) {
162-
TC_PRINT("Found message queue objects\n");
163-
break;
164-
}
165141
}
166142
obj_list = SYS_TRACING_NEXT(struct k_msgq, k_msgq,
167143
obj_list);
@@ -175,10 +151,6 @@ static void get_obj_count(int obj_type)
175151
while (obj_list != NULL) {
176152
if (obj_list == &kmbox || obj_list == &mbox) {
177153
obj_found++;
178-
if (obj_found == 2) {
179-
TC_PRINT("Found mail box objects\n");
180-
break;
181-
}
182154
}
183155
obj_list = SYS_TRACING_NEXT(struct k_mbox, k_mbox,
184156
obj_list);
@@ -192,10 +164,6 @@ static void get_obj_count(int obj_type)
192164
while (obj_list != NULL) {
193165
if (obj_list == &kpipe || obj_list == &pipe) {
194166
obj_found++;
195-
if (obj_found == 2) {
196-
TC_PRINT("Found pipe objects\n");
197-
break;
198-
}
199167
}
200168
obj_list = SYS_TRACING_NEXT(struct k_pipe, k_pipe,
201169
obj_list);
@@ -209,10 +177,6 @@ static void get_obj_count(int obj_type)
209177
while (obj_list != NULL) {
210178
if (obj_list == &kqueue || obj_list == &queue) {
211179
obj_found++;
212-
if (obj_found == 2) {
213-
TC_PRINT("Found queue objects\n");
214-
break;
215-
}
216180
}
217181
obj_list = SYS_TRACING_NEXT(struct k_queue, k_queue,
218182
obj_list);
@@ -226,9 +190,8 @@ static void get_obj_count(int obj_type)
226190

227191
/**
228192
* @brief Verify tracing of kernel objects
229-
* @details Statically create kernel objects
230-
* and check if they are added to trace object
231-
* list with object tracing enabled.
193+
* @details Statically create kernel objects and check if they are added to
194+
* trace object list with object tracing enabled.
232195
* @ingroup kernel_objtracing_tests
233196
* @see SYS_TRACING_HEAD(), SYS_TRACING_NEXT()
234197
*/

0 commit comments

Comments
 (0)