1 : /*
2 : * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
3 : * and/or its subsidiary(-ies).
4 : * Contact: Marko Hyyppä
5 : * Contact e-mail: DG.MIN-Support@nokia.com
6 : *
7 : * This program is free software: you can redistribute it and/or modify it
8 : * under the terms of the GNU General Public License as published by the Free
9 : * Software Foundation, version 2 of the License.
10 : *
11 : * This program is distributed in the hope that it will be useful, but WITHOUT
12 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 : * more details. You should have received a copy of the GNU General Public
15 : * License along with this program. If not, see
16 : * <http://www.gnu.org/licenses/>.
17 : */
18 :
19 :
20 :
21 : /**
22 : * @file data_test_module_info.c
23 : * @version 0.1
24 : * @brief This file contains implementation of Test Module Info API
25 : */
26 :
27 : /* ------------------------------------------------------------------------- */
28 : /* INCLUDE FILES */
29 :
30 : #include <string.h>
31 : #include <pthread.h>
32 :
33 : #include <min_common.h>
34 : #include <data_test_module_info.h>
35 : #include <data_test_result.h>
36 :
37 : /* ------------------------------------------------------------------------- */
38 : /* EXTERNAL DATA STRUCTURES */
39 : /* None */
40 :
41 : /* ------------------------------------------------------------------------- */
42 : /* EXTERNAL FUNCTION PROTOTYPES */
43 : /* None */
44 :
45 : /* ------------------------------------------------------------------------- */
46 : /* CONSTANTS */
47 : /* None */
48 :
49 : /* ------------------------------------------------------------------------- */
50 : /* MACROS */
51 : /* None */
52 :
53 : /* ------------------------------------------------------------------------- */
54 : /* LOCAL CONSTANTS AND MACROS */
55 :
56 : /** Test Module Info thread spesicific mutex data variable.
57 : Initial value is PTHREAD_MUTEX_INITIALIZER.
58 : (Note scope of variable and mutex are the same.)
59 : */
60 : pthread_mutex_t TM_MUTEX = PTHREAD_MUTEX_INITIALIZER;
61 :
62 : /* ------------------------------------------------------------------------- */
63 : /* MODULE DATA STRUCTURES */
64 : static test_module_id_t current_id = 1000;
65 :
66 : /* ------------------------------------------------------------------------- */
67 : /* LOCAL FUNCTION PROTOTYPES */
68 :
69 : /** Local comparison function for same process ID value searching.
70 : This function is used with DLLIST function dl_list_find().
71 : */
72 : LOCAL int compare_pid (const void *data1, const void *data2);
73 :
74 : /* ------------------------------------------------------------------------- */
75 : /* FORWARD DECLARATIONS */
76 : /* None */
77 :
78 : /* ==================== LOCAL FUNCTIONS ==================================== */
79 : /* None */
80 :
81 : /* ======================== FUNCTIONS ====================================== */
82 :
83 : /** Adds Test Module Info data item to linked list
84 : * @param list_handle pointer to linked list of Test Modules Info data
85 : * @param tm_data pointer to Test Module Info data structure.
86 : * @return pointer to Test Module Info data item,
87 : * or returns INITPTR if operation failed.
88 : *
89 : * Possible errors:
90 : * INITPTR if Test Module Info adding to list failed.
91 : */
92 : DLListIterator tm_add (DLList * list_handle, test_module_info_s * tm_data)
93 682 : {
94 682 : pthread_mutex_lock (&TM_MUTEX);
95 :
96 682 : DLListIterator dllist_item = INITPTR;
97 :
98 682 : if (list_handle != INITPTR) {
99 682 : dl_list_add (list_handle, (void *)tm_data);
100 682 : dllist_item = dl_list_tail (list_handle);
101 : }
102 :
103 682 : pthread_mutex_unlock (&TM_MUTEX);
104 :
105 682 : return dllist_item;
106 : }
107 :
108 : /** Searches for test module by id from the given list
109 : * @param list_handle pointer to linked list of Test Modules Info data
110 : * @param id search key
111 : * @return pointer to Test Module Info data item,
112 : * or returns INITPTR if operation failed.
113 : *
114 : */
115 :
116 : DLListIterator tm_find_by_module_id (DLList * list_handle,
117 : test_module_id_t id)
118 333 : {
119 333 : pthread_mutex_lock (&TM_MUTEX);
120 : DLListIterator it;
121 :
122 911 : for (it = dl_list_head (list_handle); it != INITPTR;
123 245 : it = dl_list_next(it)) {
124 578 : if (((test_module_info_s *)dl_list_data(it))->module_id_ ==
125 : id) {
126 333 : pthread_mutex_unlock (&TM_MUTEX);
127 333 : return it;
128 : }
129 : }
130 :
131 0 : pthread_mutex_unlock (&TM_MUTEX);
132 :
133 0 : return INITPTR;
134 :
135 : }
136 :
137 :
138 : /* ------------------------------------------------------------------------- */
139 :
140 : /** Creates new Test Module Info data structure
141 : * @param tm_filename contains Test Module Info filename string.
142 : * @param cfg_filename_list pointer to config filename string linked list.
143 : * @return pointer to Test Module Info data item,
144 : * or returns INITPTR if operation failed.
145 : *
146 : * Possible errors:
147 : * INITPTR if Test Module Info adding to list failed.
148 : */
149 : test_module_info_s *tm_create (filename_t tm_filename,
150 : DLList * cfg_filename_list,
151 : test_module_id_t id)
152 493 : {
153 493 : pthread_mutex_lock (&TM_MUTEX);
154 :
155 493 : test_module_info_s *test_module = NEW (test_module_info_s);
156 :
157 985 : if ((test_module != NULL)
158 : && (strlen (tm_filename) < MaxFileName + 1)) {
159 492 : STRCPY (test_module->module_filename_, tm_filename,
160 : strlen (tm_filename) + 1);
161 492 : test_module->cfg_filename_list_ = cfg_filename_list;
162 492 : test_module->test_case_list_ = INITPTR;
163 492 : test_module->test_summary_ = NULL;
164 492 : if (id == 0) {
165 285 : test_module->module_id_ = current_id;
166 285 : current_id ++;
167 : } else
168 207 : test_module->module_id_ = id;
169 :
170 : } else {
171 : /* Test Module Info data structure creation failed */
172 1 : test_module = INITPTR;
173 : }
174 :
175 493 : pthread_mutex_unlock (&TM_MUTEX);
176 :
177 493 : return test_module;
178 : }
179 :
180 : /* ------------------------------------------------------------------------- */
181 :
182 : /** Removes Test Module Info data item from linked list where this exists
183 : * @param tm_data_item pointer to Test Module Info data item.
184 : */
185 : void tm_remove (DLListIterator tm_data_item)
186 90 : {
187 90 : pthread_mutex_lock (&TM_MUTEX);
188 :
189 90 : if ((tm_data_item != INITPTR) && (tm_data_item != NULL))
190 90 : dl_list_remove_it (tm_data_item);
191 :
192 90 : pthread_mutex_unlock (&TM_MUTEX);
193 90 : }
194 :
195 : /* ------------------------------------------------------------------------- */
196 :
197 : /** Deletes Test Module Info data structure and freeing memory allocation of
198 : * used data
199 : * @param test_module pointer to Test Module Info data structure.
200 : */
201 : void tm_delete (test_module_info_s * test_module)
202 2 : {
203 2 : pthread_mutex_lock (&TM_MUTEX);
204 :
205 2 : if (test_module != NULL) {
206 :
207 2 : if (test_module->cfg_filename_list_ != INITPTR) {
208 2 : dl_list_free_data (&test_module->cfg_filename_list_);
209 2 : dl_list_free (&test_module->cfg_filename_list_);
210 : }
211 2 : if (test_module->test_case_list_ != INITPTR)
212 1 : dl_list_free (&test_module->test_case_list_);
213 :
214 2 : if (test_module->test_summary_)
215 1 : DELETE (test_module->test_summary_);
216 :
217 2 : DELETE (test_module);
218 : }
219 :
220 2 : pthread_mutex_unlock (&TM_MUTEX);
221 2 : }
222 :
223 : /* ------------------------------------------------------------------------- */
224 :
225 : /** Gets Test Module Info process ID value
226 : * @param item_ptr pointer to Test Module Info data item.
227 : * @return process ID value.
228 : *
229 : * Possible errors:
230 : * None.
231 : */
232 : long tm_get_pid (DLListIterator item_ptr)
233 435 : {
234 435 : pthread_mutex_lock (&TM_MUTEX);
235 :
236 435 : test_module_info_s *tm_data = dl_list_data (item_ptr);
237 :
238 435 : pthread_mutex_unlock (&TM_MUTEX);
239 :
240 435 : return tm_data->process_id_;
241 : }
242 :
243 : /* ------------------------------------------------------------------------- */
244 :
245 : /** Gets test module id
246 : * @param item_ptr pointer to Test Module Info data item.
247 : * @return id
248 : *
249 : * Possible errors:
250 : * None.
251 : */
252 : test_module_id_t tm_get_module_id (DLListIterator item_tm_data)
253 875 : {
254 875 : pthread_mutex_lock (&TM_MUTEX);
255 :
256 875 : test_module_info_s *tm_data = dl_list_data (item_tm_data);
257 :
258 875 : pthread_mutex_unlock (&TM_MUTEX);
259 :
260 875 : return tm_data->module_id_;
261 :
262 : }
263 :
264 : /* ------------------------------------------------------------------------- */
265 :
266 : /** Gets Test Case list of given Test Module Info data item
267 : * @param item_tm_data pointer to Test Module Info data item.
268 : * @return pointer to Test Case linked list.
269 : *
270 : * Possible errors:
271 : * None.
272 : */
273 : DLList *tm_get_tclist (DLListIterator item_tm_data)
274 1071 : {
275 1071 : pthread_mutex_lock (&TM_MUTEX);
276 :
277 1071 : test_module_info_s *tm_data = dl_list_data (item_tm_data);
278 :
279 1071 : pthread_mutex_unlock (&TM_MUTEX);
280 :
281 1071 : return tm_data->test_case_list_;
282 : }
283 :
284 : /* ------------------------------------------------------------------------- */
285 :
286 : /** Gets Test Case status value
287 : * @param tm_data_item pointer to Test Module Info data item.
288 : * @return status value, or error if Test Module Info not available.
289 : *
290 : * Possible errors:
291 : * -1 if Test Module Info data not exists
292 : */
293 : int tm_get_status (DLListIterator tm_data_item)
294 1220 : {
295 1220 : pthread_mutex_lock (&TM_MUTEX);
296 :
297 : test_module_info_s *test_module;
298 : int tm_status;
299 :
300 1220 : test_module = (test_module_info_s *) dl_list_data (tm_data_item);
301 :
302 2439 : if ((test_module != INITPTR) && (test_module != NULL)) {
303 1219 : tm_status = test_module->status_;
304 : } else {
305 : /* Test Module Status value not available */
306 1 : tm_status = -1;
307 : }
308 :
309 : /*
310 : if (tm_data_item != INITPTR) {
311 : test_module = (test_module_info_s*)dl_list_data(tm_data_item);
312 : if (test_module)
313 : tm_status = test_module->status_;
314 : else
315 : tm_status = -1;
316 : }
317 : */
318 :
319 1220 : pthread_mutex_unlock (&TM_MUTEX);
320 :
321 1220 : return tm_status;
322 : }
323 :
324 : /* ------------------------------------------------------------------------- */
325 :
326 : /** Gets Test Module Info data item pointer according to process ID value
327 : * @param tm_list pointer to Test Module Info data linked list.
328 : * @param pid process ID value.
329 : * @return pointer to found Test Module Info data item,
330 : * or INITPTR if wanted data item not exists.
331 : *
332 : * Possible errors:
333 : * INITPTR if Test Module Info data item not exists
334 : */
335 : DLListIterator tm_get_ptr_by_pid (DLList * tm_list, long pid)
336 1246 : {
337 1246 : pthread_mutex_lock (&TM_MUTEX);
338 :
339 1246 : DLListIterator tm_data_item = INITPTR;
340 :
341 1246 : tm_data_item = dl_list_find (dl_list_head (tm_list),
342 : dl_list_tail (tm_list), compare_pid,
343 : &pid);
344 :
345 1246 : pthread_mutex_unlock (&TM_MUTEX);
346 :
347 1246 : return tm_data_item;
348 : }
349 :
350 : /* ------------------------------------------------------------------------- */
351 :
352 : /** Compares process ID values between two Test Module Info data item with
353 : * use of DLLIST function dl_list_find()
354 : * @param data1 void* pointer to first data.
355 : * @param data2 void* pointer to second data.
356 : * @return returns integer result value of comparision,
357 : * or returns error value if be compared data is not available.
358 : *
359 : * Possible errors:
360 : * -2 if given data is not available.
361 : */
362 : LOCAL int compare_pid (const void *data1, const void *data2)
363 1986 : {
364 : /* If compared data pointers are invalid, return error code -2 */
365 1986 : int result = -2;
366 : long pid1, pid2;
367 :
368 1986 : if ((data1 != NULL) && (data2 != NULL)) {
369 1986 : pid1 = ((test_module_info_s *) data1)->process_id_;
370 1986 : pid2 = *((long *)data2);
371 :
372 1986 : if (pid1 > pid2)
373 25 : result = 1;
374 1961 : else if (pid1 == pid2)
375 1221 : result = 0;
376 : else
377 740 : result = -1;
378 : }
379 :
380 1986 : return result;
381 : }
382 :
383 : /* ------------------------------------------------------------------------- */
384 :
385 : /** Gets pointer to Test Module Info config filenames linked list
386 : * @param tm_data_item pointer to Test Module Info data item.
387 : * @return return pointer to linked list,
388 : * or if given data item not available then returns INITPTR.
389 : *
390 : * Possible errors:
391 : * INITPTR if Test Module Info data item not available.
392 : */
393 : DLList *tm_get_cfg_filenames (DLListIterator tm_data_item)
394 265 : {
395 265 : pthread_mutex_lock (&TM_MUTEX);
396 :
397 265 : test_module_info_s *test_module = INITPTR;
398 265 : DLList *cfg_filename_list = INITPTR;
399 :
400 265 : if (tm_data_item != INITPTR) {
401 265 : test_module = (test_module_info_s *) tm_data_item->data_;
402 265 : if (test_module) {
403 265 : cfg_filename_list = test_module->cfg_filename_list_;
404 : }
405 : }
406 :
407 265 : pthread_mutex_unlock (&TM_MUTEX);
408 :
409 265 : return cfg_filename_list;
410 : }
411 :
412 : /* ------------------------------------------------------------------------- */
413 :
414 : /** Copy filename string of Test Module Info data item to given filename
415 : * string
416 : * @param tm_data_item pointer to Test Module Info data item.
417 : * @param tm_filename filename string where wanted filename be copied.
418 : */
419 : void tm_get_module_filename (DLListIterator tm_data_item,
420 : filename_t tm_filename)
421 8 : {
422 8 : pthread_mutex_lock (&TM_MUTEX);
423 :
424 8 : test_module_info_s *test_module = INITPTR;
425 :
426 8 : if (tm_data_item != INITPTR) {
427 8 : test_module = (test_module_info_s *) tm_data_item->data_;
428 8 : if (test_module) {
429 8 : STRCPY (tm_filename, test_module->module_filename_,
430 : strlen (test_module->module_filename_) + 1);
431 : }
432 : }
433 :
434 8 : pthread_mutex_unlock (&TM_MUTEX);
435 8 : }
436 :
437 : /* ------------------------------------------------------------------------- */
438 :
439 : /** Gets pointer to Test Summary data structure of given Test Module Info
440 : * data item
441 : * @param tm_data_item pointer to Test Module Info data item.
442 : * @return returns pointer Test Summary data structure,
443 : * if Test Module Info data not available returns INITPTR.
444 : *
445 : * Possible errors:
446 : * INITPTR if Test Module Info data not available.
447 : */
448 : test_summary_s *tm_get_test_summary_data (DLListIterator tm_data_item)
449 2 : {
450 2 : pthread_mutex_lock (&TM_MUTEX);
451 :
452 2 : test_summary_s *test_summary = INITPTR;
453 2 : test_module_info_s *test_module = INITPTR;
454 :
455 2 : if (tm_data_item != INITPTR) {
456 1 : test_module = (test_module_info_s *) tm_data_item->data_;
457 1 : if (test_module)
458 1 : test_summary = test_module->test_summary_;
459 : }
460 :
461 2 : pthread_mutex_unlock (&TM_MUTEX);
462 :
463 2 : return test_summary;
464 : }
465 :
466 : /* ------------------------------------------------------------------------- */
467 :
468 : /** Gets Test Summary detail data by given data structure member enumeration
469 : * @param tm_data_item pointer to Test Module Info data item.
470 : * @param ts_type data structure member type.
471 : * @return positive integer value of wanted detail data.
472 : * If Test Summary data not available returns error code.
473 : *
474 : * Possible errors:
475 : * -1 If Test Summary data not available.
476 : * -2 If data structure member type is invalid.
477 : */
478 : int tm_get_test_summary_detail (DLListIterator tm_data_item, int ts_type)
479 10 : {
480 10 : pthread_mutex_lock (&TM_MUTEX);
481 :
482 10 : test_module_info_s *test_module = INITPTR;
483 10 : test_summary_s *test_summary = INITPTR;
484 10 : int ts_count = -1; /* Test Summary data not available */
485 :
486 10 : if (tm_data_item != INITPTR) {
487 9 : test_module = (test_module_info_s *) tm_data_item->data_;
488 :
489 9 : if ((test_module != INITPTR) && (test_module != NULL)) {
490 8 : test_summary = test_module->test_summary_;
491 :
492 8 : if ((test_summary != INITPTR)
493 : && (test_summary != NULL)) {
494 :
495 7 : switch (ts_type) {
496 :
497 : case TEST_RESULT_PASSED:
498 1 : ts_count = test_summary->passed_;
499 1 : break;
500 :
501 : case TEST_RESULT_FAILED:
502 1 : ts_count = test_summary->failed_;
503 1 : break;
504 :
505 : case TEST_RESULT_CRASHED:
506 1 : ts_count = test_summary->crashed_;
507 1 : break;
508 :
509 : case TEST_RESULT_ABORTED:
510 1 : ts_count = test_summary->aborted_;
511 1 : break;
512 :
513 : case TEST_RESULT_TIMEOUT:
514 1 : ts_count = test_summary->timeout_;
515 1 : break;
516 :
517 : default:
518 : /* Invalid Test Summary type */
519 2 : ts_count = -2;
520 : break;
521 : }
522 : }
523 : }
524 : }
525 :
526 10 : pthread_mutex_unlock (&TM_MUTEX);
527 :
528 10 : return ts_count;
529 : }
530 :
531 : /* ------------------------------------------------------------------------- */
532 :
533 : /** Sets process ID value of given Test Module Info data item
534 : * @param item_ptr pointer to Test Module Info data item.
535 : * @param tm_pid new process ID value.
536 : */
537 : void tm_set_pid (DLListIterator item_ptr, long tm_pid)
538 217 : {
539 217 : pthread_mutex_lock (&TM_MUTEX);
540 :
541 : test_module_info_s *tm_data_item =
542 217 : (test_module_info_s *) dl_list_data (item_ptr);
543 :
544 217 : if (tm_data_item != INITPTR)
545 217 : tm_data_item->process_id_ = tm_pid;
546 :
547 217 : pthread_mutex_unlock (&TM_MUTEX);
548 217 : }
549 :
550 : /* ------------------------------------------------------------------------- */
551 :
552 : /** Sets pointer to Test Case linked list for given Test Module Info
553 : * data item
554 : * @param item_tm_data pointer to Test Module Info data item.
555 : * @param tcs_list pointer to Test Case linked list.
556 : */
557 : void tm_set_tclist (DLListIterator item_tm_data, DLList * tcs_list)
558 200 : {
559 200 : pthread_mutex_lock (&TM_MUTEX);
560 :
561 200 : test_module_info_s *tm_data = dl_list_data (item_tm_data);
562 200 : tm_data->test_case_list_ = tcs_list;
563 :
564 200 : pthread_mutex_unlock (&TM_MUTEX);
565 200 : }
566 :
567 : /* ------------------------------------------------------------------------- */
568 :
569 : /** Sets status value of given Test Module Info data item
570 : * @param tm_data_item pointer to Test Module Info data item.
571 : * @param status new status value.
572 : */
573 : void tm_set_status (DLListIterator tm_data_item, int status)
574 726 : {
575 726 : pthread_mutex_lock (&TM_MUTEX);
576 :
577 : test_module_info_s *test_module =
578 726 : (test_module_info_s *) dl_list_data (tm_data_item);
579 :
580 726 : if ((test_module != INITPTR) && (test_module != NULL)) {
581 725 : test_module->status_ = status;
582 : }
583 :
584 : /*
585 : test_module_info_s* test_module = INITPTR;
586 :
587 : if (tm_data_item != INITPTR) {
588 : test_module = (test_module_info_s*)dl_list_data(tm_data_item);
589 : if (test_module)
590 : test_module->status_ = status;
591 : }
592 : */
593 :
594 726 : pthread_mutex_unlock (&TM_MUTEX);
595 726 : }
596 :
597 : /* ------------------------------------------------------------------------- */
598 :
599 : /** Sets pointer to config filename linked list for Test Module Info
600 : * data item
601 : * @param tm_data_item pointer to Test Module Info data item.
602 : * @param cfg_filename_list pointer linked list of config filenames.
603 : */
604 : void tm_set_cfg_filenames (DLListIterator tm_data_item,
605 : DLList * cfg_filename_list)
606 8 : {
607 8 : pthread_mutex_lock (&TM_MUTEX);
608 :
609 8 : test_module_info_s *test_module = NULL;
610 :
611 8 : if (tm_data_item) {
612 8 : test_module = (test_module_info_s *) tm_data_item->data_;
613 8 : if (test_module) {
614 8 : test_module->cfg_filename_list_ = cfg_filename_list;
615 : }
616 : }
617 :
618 8 : pthread_mutex_unlock (&TM_MUTEX);
619 8 : }
620 :
621 : /* ------------------------------------------------------------------------- */
622 :
623 : /** Creates new Test Summary data structure for given Test Moddule Info
624 : * data item
625 : * @param tm_data_item pointer to Test Module Info data item.
626 : * @return returns integer value 1 if data structure created successfully,
627 : * or returns error code if operation failed.
628 : *
629 : * Possible errors:
630 : * -1 if Test Summary creation failed.
631 : */
632 : int tm_create_test_summary (DLListIterator tm_data_item)
633 3 : {
634 3 : pthread_mutex_lock (&TM_MUTEX);
635 :
636 : /* If Test Summary creation failed then returns error code -1 */
637 3 : int result = -1;
638 3 : test_module_info_s *test_module = INITPTR;
639 3 : test_summary_s *test_summary = INITPTR;
640 :
641 3 : if (tm_data_item != INITPTR) {
642 3 : test_module = (test_module_info_s *) tm_data_item->data_;
643 :
644 3 : if (test_module) {
645 3 : test_summary = NEW (test_summary_s);
646 :
647 3 : if (test_summary) {
648 3 : test_module->test_summary_ = test_summary;
649 3 : result = 1;
650 : }
651 : }
652 : }
653 :
654 3 : pthread_mutex_unlock (&TM_MUTEX);
655 :
656 3 : return result;
657 : }
658 :
659 : /* ------------------------------------------------------------------------- */
660 :
661 : /** Sets pointer to Test Summary data structure for given Test Module Info
662 : * data item
663 : * @param tm_data_item pointer to Test Module Info data item.
664 : * @param test_summary pointer to Test Summary data structure.
665 : */
666 : void tm_set_test_summary_data (DLListIterator tm_data_item,
667 : test_summary_s * test_summary)
668 2 : {
669 2 : pthread_mutex_lock (&TM_MUTEX);
670 :
671 2 : test_module_info_s *test_module = INITPTR;
672 :
673 2 : if (tm_data_item != INITPTR) {
674 2 : test_module = (test_module_info_s *) tm_data_item->data_;
675 2 : if (test_module)
676 2 : test_module->test_summary_ = test_summary;
677 : }
678 :
679 2 : pthread_mutex_unlock (&TM_MUTEX);
680 2 : }
681 :
682 : /* ------------------------------------------------------------------------- */
683 :
684 : /** Sets selected Test Summary data detail for given Test Module Info
685 : * data item
686 : * @param tm_data_item pointer to Test Module Info data item.
687 : * @param ts_type selected Test Summary data structure data member type.
688 : * @param ts_type_count new count value for selected data structure member.
689 : */
690 : void tm_set_test_summary_detail (DLListIterator tm_data_item,
691 : int ts_type, int ts_type_count)
692 10 : {
693 10 : pthread_mutex_lock (&TM_MUTEX);
694 :
695 10 : test_module_info_s *test_module = INITPTR;
696 10 : test_summary_s *test_summary = INITPTR;
697 :
698 10 : if (tm_data_item != INITPTR) {
699 9 : test_module = (test_module_info_s *) tm_data_item->data_;
700 :
701 9 : if ((test_module != INITPTR) && (test_module != NULL)) {
702 8 : test_summary =
703 : (test_summary_s *) test_module->test_summary_;
704 :
705 8 : if ((test_summary != INITPTR)
706 : && (test_module != NULL)) {
707 :
708 7 : switch (ts_type) {
709 :
710 : case TEST_RESULT_PASSED:
711 1 : test_summary->passed_ = ts_type_count;
712 1 : break;
713 :
714 : case TEST_RESULT_FAILED:
715 1 : test_summary->failed_ = ts_type_count;
716 1 : break;
717 :
718 : case TEST_RESULT_CRASHED:
719 1 : test_summary->crashed_ =
720 : ts_type_count;
721 1 : break;
722 :
723 : case TEST_RESULT_ABORTED:
724 1 : test_summary->aborted_ =
725 : ts_type_count;
726 1 : break;
727 :
728 : case TEST_RESULT_TIMEOUT:
729 1 : test_summary->timeout_ =
730 : ts_type_count;
731 : break;
732 :
733 : default:
734 : /* None */
735 : break;
736 : }
737 : }
738 : }
739 : }
740 :
741 10 : pthread_mutex_unlock (&TM_MUTEX);
742 10 : }
743 :
744 : /* ------------------------------------------------------------------------- */
745 :
746 : /* ================= OTHER EXPORTED FUNCTIONS ============================== */
747 : /* None */
748 :
749 : /* ================= TESTS FOR LOCAL FUNCTIONS ============================= */
750 : /* None */
751 :
752 : /* ========================================================================= */
753 : /* End of file */
|