4 * @brief Main for all tests
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 #include "../queues/job_queue.h"
27 #include "../queues/event_queue.h"
28 #include "../queues/send_queue.h"
29 #include "../socket.h"
30 #include "../utils/logger_manager.h"
31 #include "../utils/allocator.h"
32 #include "../utils/tester.h"
33 #include "linked_list_test.h"
34 #include "thread_pool_test.h"
35 #include "job_queue_test.h"
36 #include "event_queue_test.h"
37 #include "send_queue_test.h"
38 #include "socket_test.h"
39 #include "sender_test.h"
40 #include "scheduler_test.h"
41 #include "receiver_test.h"
42 #include "ike_sa_id_test.h"
43 #include "ike_sa_test.h"
44 #include "ike_sa_manager_test.h"
45 #include "generator_test.h"
46 #include "parser_test.h"
47 #include "packet_test.h"
50 /* output for test messages */
54 * Test for linked_list_t
56 test_t linked_list_test
= {test_linked_list
,"Linked List"};
59 * Test for linked_list_t with iterator
61 test_t linked_list_iterator_test
= {test_linked_list_iterator
,"Linked List Iterator"};
64 * Test for linked_list_t insert and remove
66 test_t linked_list_insert_and_remove_test
= {test_linked_list_insert_and_remove
,"Linked List Insert and remove"};
69 * Test for event_queue_t
71 test_t event_queue_test
= {test_event_queue
,"Event-Queue"};
74 * Test 1 for job_queue_t
76 test_t job_queue_test1
= {test_job_queue
,"Job-Queue"};
79 * Test 1 for linked_list_t
81 test_t send_queue_test
= {test_send_queue
,"Send-Queue"};
86 test_t socket_test
= {test_socket
,"Socket"};
89 * Test for thread_pool_t
91 test_t thread_pool_test
= {test_thread_pool
,"Thread Pool"};
96 test_t sender_test
= {test_sender
,"Sender"};
99 * Test for scheduler_t
101 test_t scheduler_test
= {test_scheduler
,"Scheduler"};
104 * Test for receiver_t
106 test_t receiver_test
= {test_receiver
,"Receiver"};
109 * Test for ike_sa_id_t
111 test_t ike_sa_id_test
= {test_ike_sa_id
,"IKE_SA-Identifier"};
116 test_t ike_sa_test
= {test_ike_sa
,"IKE_SA"};
120 * Test for ike_sa_manager_t
122 test_t ike_sa_manager_test
= {test_ike_sa_manager
, "IKE_SA-Manager"};
125 * Test 2 for generator_t
127 test_t generator_test2
= {test_generator_with_header_payload
,"Generator: header payload"};
130 * Test 2 for generator_t
132 test_t parser_test
= {test_parser_with_header_payload
, "Parser: header payload"};
138 test_t packet_test
= {test_packet
,"Packet"};
144 job_queue_t
*global_job_queue
;
149 event_queue_t
*global_event_queue
;
154 send_queue_t
*global_send_queue
;
159 socket_t
*global_socket
;
165 logger_manager_t
*global_logger_manager
;
169 FILE * test_output
= stderr
;
171 test_t
*all_tests
[] ={
173 &linked_list_iterator_test
,
174 &linked_list_insert_and_remove_test
,
187 &ike_sa_manager_test
,
191 global_logger_manager
= logger_manager_create(CONTROL
);
193 global_socket
= socket_create(4600);
195 global_job_queue
= job_queue_create();
196 global_event_queue
= event_queue_create();
197 global_send_queue
= send_queue_create();
201 tester_t
*tester
= tester_create(test_output
, FALSE
);
203 tester
->perform_tests(tester
,all_tests
);
204 /* tester->perform_test(tester,&parser_test); */
206 tester
->destroy(tester
);
209 /* Destroy all queues */
210 global_job_queue
->destroy(global_job_queue
);
211 global_event_queue
->destroy(global_event_queue
);
212 global_send_queue
->destroy(global_send_queue
);
214 global_socket
->destroy(global_socket
);
216 global_logger_manager
->destroy(global_logger_manager
);
218 #ifdef LEAK_DETECTIVE
219 /* Leaks are reported on stderr */
220 report_memory_leaks(void);