diff --git a/configure.in b/configure.in index 097a292ea..31b74178d 100644 --- a/configure.in +++ b/configure.in @@ -141,6 +141,7 @@ AC_OUTPUT( src/pluto/Makefile src/whack/Makefile src/charon/Makefile + src/charon/testing/Makefile src/stroke/Makefile src/ipsec/Makefile src/starter/Makefile diff --git a/src/charon/testing/Makefile.am b/src/charon/testing/Makefile.am new file mode 100644 index 000000000..0957a7096 --- /dev/null +++ b/src/charon/testing/Makefile.am @@ -0,0 +1,35 @@ +noinst_PROGRAMS = testing +INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon -I$(top_srcdir)/src/stroke + +testing_SOURCES = \ +thread_pool_test.c policy_test.c prf_plus_test.h testcases.c ike_sa_manager_test.c \ +linked_list_test.c send_queue_test.h policy_test.h encryption_payload_test.c thread_pool_test.h \ +child_sa_test.c linked_list_test.h packet_test.c child_sa_test.h encryption_payload_test.h packet_test.h \ +diffie_hellman_test.c event_queue_test.c event_queue_test.h socket_test.c Makefile.am identification_test.c \ +ike_sa_manager_test.h ike_sa_test.c diffie_hellman_test.h parser_test.c socket_test.h identification_test.h \ +connection_test.c proposal_test.c ike_sa_test.h kernel_interface_test.c parser_test.h connection_test.h \ +proposal_test.h kernel_interface_test.h ike_sa_id_test.c hmac_test.c leak_detective_test.c hasher_test.c \ +ike_sa_id_test.h hmac_test.h leak_detective_test.h job_queue_test.c scheduler_test.c hmac_signer_test.c \ +hasher_test.h sender_test.c certificate_test.c job_queue_test.h scheduler_test.h hmac_signer_test.h \ +rsa_test.c sender_test.h generator_test.c aes_cbc_crypter_test.c certificate_test.h prf_plus_test.c \ +rsa_test.h generator_test.h aes_cbc_crypter_test.h send_queue_test.c + +testing_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lgmp -lpthread \ +$(top_srcdir)/src/charon/connection.o $(top_srcdir)/src/charon/local_connection_store.o $(top_srcdir)/src/charon/policy.o \ +$(top_srcdir)/src/charon/local_policy_store.o $(top_srcdir)/src/charon/local_credential_store.o $(top_srcdir)/src/charon/traffic_selector.o \ +$(top_srcdir)/src/charon/proposal.o $(top_srcdir)/src/charon/configuration.o $(top_srcdir)/src/charon/state.o $(top_srcdir)/src/charon/ike_sa_init_requested.o \ +$(top_srcdir)/src/charon/ike_sa_init_responded.o $(top_srcdir)/src/charon/ike_sa_established.o $(top_srcdir)/src/charon/responder_init.o \ +$(top_srcdir)/src/charon/initiator_init.o $(top_srcdir)/src/charon/ike_auth_requested.o $(top_srcdir)/src/charon/delete_requested.o \ +$(top_srcdir)/src/charon/child_sa.o $(top_srcdir)/src/charon/ike_sa.o $(top_srcdir)/src/charon/ike_sa_manager.o $(top_srcdir)/src/charon/ike_sa_id.o \ +$(top_srcdir)/src/charon/authenticator.o $(top_srcdir)/src/charon/encryption_payload.o $(top_srcdir)/src/charon/cert_payload.o \ +$(top_srcdir)/src/charon/traffic_selector_substructure.o $(top_srcdir)/src/charon/transform_attribute.o $(top_srcdir)/src/charon/configuration_attribute.o \ +$(top_srcdir)/src/charon/transform_substructure.o $(top_srcdir)/src/charon/auth_payload.o $(top_srcdir)/src/charon/ike_header.o $(top_srcdir)/src/charon/nonce_payload.o \ +$(top_srcdir)/src/charon/eap_payload.o $(top_srcdir)/src/charon/ts_payload.o $(top_srcdir)/src/charon/notify_payload.o $(top_srcdir)/src/charon/id_payload.o \ +$(top_srcdir)/src/charon/ke_payload.o $(top_srcdir)/src/charon/unknown_payload.o $(top_srcdir)/src/charon/encodings.o $(top_srcdir)/src/charon/cp_payload.o \ +$(top_srcdir)/src/charon/delete_payload.o $(top_srcdir)/src/charon/sa_payload.o $(top_srcdir)/src/charon/certreq_payload.o $(top_srcdir)/src/charon/vendor_id_payload.o \ +$(top_srcdir)/src/charon/proposal_substructure.o $(top_srcdir)/src/charon/payload.o $(top_srcdir)/src/charon/message.o $(top_srcdir)/src/charon/generator.o \ +$(top_srcdir)/src/charon/parser.o $(top_srcdir)/src/charon/packet.o $(top_srcdir)/src/charon/socket.o $(top_srcdir)/src/charon/job.o \ +$(top_srcdir)/src/charon/delete_established_ike_sa_job.o $(top_srcdir)/src/charon/incoming_packet_job.o $(top_srcdir)/src/charon/delete_half_open_ike_sa_job.o \ +$(top_srcdir)/src/charon/retransmit_request_job.o $(top_srcdir)/src/charon/initiate_ike_sa_job.o $(top_srcdir)/src/charon/job_queue.o $(top_srcdir)/src/charon/event_queue.o \ +$(top_srcdir)/src/charon/send_queue.o $(top_srcdir)/src/charon/kernel_interface.o $(top_srcdir)/src/charon/thread_pool.o $(top_srcdir)/src/charon/scheduler.o \ +$(top_srcdir)/src/charon/sender.o $(top_srcdir)/src/charon/receiver.o $(top_srcdir)/src/charon/stroke_interface.o diff --git a/src/charon/testing/connection_test.c b/src/charon/testing/connection_test.c index 6b12afc1d..9478b0e57 100644 --- a/src/charon/testing/connection_test.c +++ b/src/charon/testing/connection_test.c @@ -33,9 +33,7 @@ void test_connection(protected_tester_t *tester) { host_t *alice = host_create(AF_INET, "192.168.0.1", 500); host_t *bob = host_create(AF_INET, "192.168.0.2", 500); - identification_t *alice_id = identification_create_from_string("192.168.0.1"); - identification_t *bob_id = identification_create_from_string("192.168.0.2"); - connection_t *connection = connection_create(alice, bob, alice_id, bob_id, RSA_DIGITAL_SIGNATURE); + connection_t *connection = connection_create("alice-bob", TRUE, alice, bob, RSA_DIGITAL_SIGNATURE); proposal_t *prop1, *prop2, *prop3, *prop4; linked_list_t *list; diff --git a/src/charon/testing/generator_test.c b/src/charon/testing/generator_test.c index 004c700e6..02f1f446b 100644 --- a/src/charon/testing/generator_test.c +++ b/src/charon/testing/generator_test.c @@ -976,7 +976,7 @@ void test_generator_with_auth_payload(protected_tester_t *tester) generator = generator_create(); tester->assert_true(tester,(generator != NULL), "generator create check"); - auth_payload = auth_payload_create(FALSE); + auth_payload = auth_payload_create(); auth.ptr = "123456789012"; diff --git a/src/charon/testing/policy_test.c b/src/charon/testing/policy_test.c index 9003eeff0..639f9462f 100644 --- a/src/charon/testing/policy_test.c +++ b/src/charon/testing/policy_test.c @@ -48,7 +48,7 @@ void test_policy(protected_tester_t *tester) alice = identification_create_from_string("152.96.193.131"); bob = identification_create_from_string("152.96.193.130"); - policy = policy_create(alice, bob); + policy = policy_create("test", alice, bob); tester->assert_true(tester, (policy != NULL), "policy construction"); diff --git a/src/charon/testing/rsa_test.c b/src/charon/testing/rsa_test.c index 696901531..90baf3f5a 100644 --- a/src/charon/testing/rsa_test.c +++ b/src/charon/testing/rsa_test.c @@ -205,7 +205,7 @@ void test_rsa(protected_tester_t *tester) /* key loading */ private_key = rsa_private_key_create_from_file("alice.der", NULL); tester->assert_true(tester, private_key != NULL, "loading private key from file"); - certificate = x509_create_from_file("alice-cert.der"); + certificate = x509_create_from_file("alice-cert.der", "testcert"); tester->assert_true(tester, public_key != NULL, "loading certificate from file"); public_key = certificate->get_public_key(certificate); tester->assert_true(tester, public_key != NULL, "loading public key from certificate"); diff --git a/src/charon/testing/send_queue_test.c b/src/charon/testing/send_queue_test.c index a56f8e5a2..bf3fd9507 100644 --- a/src/charon/testing/send_queue_test.c +++ b/src/charon/testing/send_queue_test.c @@ -67,7 +67,7 @@ static void test_send_queue_sender(send_queue_test_t * testinfo) int i; for (i = 0; i < testinfo->insert_item_count; i++) { - packet_t *packet = packet_create(AF_INET); + packet_t *packet = packet_create(); testinfo->tester->assert_true(testinfo->tester,(packet != NULL), "create packet call check"); testinfo->send_queue->add(testinfo->send_queue,packet); } diff --git a/src/charon/testing/sender_test.c b/src/charon/testing/sender_test.c index 391d71fbc..d4bdcfd2a 100644 --- a/src/charon/testing/sender_test.c +++ b/src/charon/testing/sender_test.c @@ -64,7 +64,7 @@ void test_sender(protected_tester_t *tester) for (i = 0; i < NUMBER_OF_PACKETS_TO_SEND; i++) { - packet = packet_create(AF_INET); + packet = packet_create(); packet->set_destination(packet, host_create(AF_INET, "127.0.0.1", 500)); packet->set_source(packet, host_create(AF_INET, "127.0.0.1", 500)); packet->set_data(packet, chunk_clone(data)); diff --git a/src/charon/testing/socket_test.c b/src/charon/testing/socket_test.c index 9ae1b0fbc..2b751935a 100644 --- a/src/charon/testing/socket_test.c +++ b/src/charon/testing/socket_test.c @@ -36,7 +36,7 @@ void test_socket(protected_tester_t *tester) int packet_count = 10; int current; socket_t *skt = socket_create(500); - packet_t *pkt = packet_create(AF_INET); + packet_t *pkt = packet_create(); char test_data[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, /* spi */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05, /* spi */ diff --git a/src/charon/testing/testcases.c b/src/charon/testing/testcases.c index e4d92becf..d91811e09 100644 --- a/src/charon/testing/testcases.c +++ b/src/charon/testing/testcases.c @@ -251,8 +251,8 @@ int main() tester_t *tester = tester_create(test_output, FALSE); - tester->perform_tests(tester,all_tests); - //tester->perform_test(tester,&sender_test); + //tester->perform_tests(tester,all_tests); + tester->perform_test(tester,&policy_test); tester->destroy(tester);