[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15675 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15675 - gnunet/src/transport |
Date: |
Thu, 16 Jun 2011 16:29:54 +0200 |
Author: wachs
Date: 2011-06-16 16:29:53 +0200 (Thu, 16 Jun 2011)
New Revision: 15675
Modified:
gnunet/src/transport/plugin_transport_http.c
gnunet/src/transport/test_plugin_transport_http.c
gnunet/src/transport/test_plugin_transport_https.c
gnunet/src/transport/test_quota_compliance.c
gnunet/src/transport/test_transport_api.c
Log:
changes to tests
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2011-06-16 14:29:41 UTC
(rev 15674)
+++ gnunet/src/transport/plugin_transport_http.c 2011-06-16 14:29:53 UTC
(rev 15675)
@@ -3147,7 +3147,7 @@
if (GNUNET_CONFIGURATION_have_value (env->cfg,
"transport-https", "KEY_FILE"))
{
- GNUNET_CONFIGURATION_get_value_string (env->cfg,
+ GNUNET_CONFIGURATION_get_value_filename (env->cfg,
"transport-https",
"KEY_FILE",
&key_file);
@@ -3158,7 +3158,7 @@
/* Get private key file from config */
if (GNUNET_CONFIGURATION_have_value (env->cfg,"transport-https",
"CERT_FILE"))
{
- GNUNET_CONFIGURATION_get_value_string (env->cfg,
+ GNUNET_CONFIGURATION_get_value_filename (env->cfg,
"transport-https",
"CERT_FILE",
&cert_file);
Modified: gnunet/src/transport/test_plugin_transport_http.c
===================================================================
--- gnunet/src/transport/test_plugin_transport_http.c 2011-06-16 14:29:41 UTC
(rev 15674)
+++ gnunet/src/transport/test_plugin_transport_http.c 2011-06-16 14:29:53 UTC
(rev 15675)
@@ -386,6 +386,8 @@
*/
static GNUNET_SCHEDULER_TaskIdentifier http_task_send;
+static char * servicehome;
+
/**
* Shutdown testcase
*/
@@ -401,7 +403,7 @@
(fail_addr_to_str == GNUNET_YES))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Phase 0: Test plugin functions failed\n");
+ "Phase 0: Test plugin functions failed\n");
fail = 1;
}
if ( (test_no_ident.test_failed == GNUNET_YES) ||
@@ -410,7 +412,7 @@
(test_valid_ident.test_failed == GNUNET_YES) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Phase 1: Test connect with wrong data failed\n");
+ "Phase 1: Test connect with wrong data failed\n");
fail = 1;
}
if ( (fail_session_selection_any != GNUNET_NO) ||
@@ -419,7 +421,7 @@
(fail_session_selection_session_big != GNUNET_NO) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Phase 2: Test session selection failed\n");
+ "Phase 2: Test session selection failed\n");
fail = 1;
}
if ( (fail_msgs_transmited_to_local_addrs != count_str_addr) ||
@@ -427,13 +429,13 @@
(fail_msg_transmited_max_size == GNUNET_YES) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Phase 3: Test sending with plugin failed\n");
+ "Phase 3: Test sending with plugin failed\n");
fail = 1;
}
if (fail != 1)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "All tests successful\n");
+ "All tests successful\n");
}
api->disconnect(api->cls,&my_identity);
@@ -472,14 +474,21 @@
GNUNET_free(test_addr);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Unloading http plugin\n");
+ "Unloading http plugin\n");
GNUNET_assert (NULL == GNUNET_PLUGIN_unload
("libgnunet_gnunet_transport_plugin_http", api));
GNUNET_SCHEDULER_shutdown();
GNUNET_DISK_directory_remove ("/tmp/test_gnunet_transport_plugin_http");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Exiting testcase\n");
+ "Exiting testcase\n");
+
+ if (servicehome != NULL)
+ {
+ GNUNET_DISK_directory_remove (servicehome);
+ GNUNET_free (servicehome);
+ }
+
exit(fail);
return;
}
@@ -494,13 +503,13 @@
static void
task_send_cont (void *cls,
- const struct GNUNET_PeerIdentity * target,
- int result)
+ const struct GNUNET_PeerIdentity * target,
+ int result)
{
if ((cls == &fail_msg_transmited_bigger_max_size) && (result ==
GNUNET_SYSERR))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Message bigger max msg size was not sent!\n");
+ "Message bigger max msg size was not sent!\n");
fail_msg_transmited_bigger_max_size = GNUNET_NO;
return;
}
@@ -508,8 +517,8 @@
if ((cls == &fail_msg_transmited_max_size) && (result == GNUNET_OK))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Message with max msg size succesfully sent!\n",
- fail_msgs_transmited_to_local_addrs);
+ "Message with max msg size succesfully sent!\n",
+ fail_msgs_transmited_to_local_addrs);
fail_msg_transmited_max_size = GNUNET_NO;
}
}
@@ -530,18 +539,18 @@
uint16_t sender_address_len)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Testcase recieved new message from peer `%s' with type %u and
length %u, session %X\n",
- GNUNET_i2s(peer),
- ntohs(message->type),
- ntohs(message->size),
- session);
+ "Testcase recieved new message from peer `%s' with type %u and
length %u, session %X\n",
+ GNUNET_i2s(peer),
+ ntohs(message->type),
+ ntohs(message->size),
+ session);
if ( (ntohs(message->type)>=10) &&
(ntohs(message->type)<20) )
{
fail_msgs_transmited_to_local_addrs++;
if (fail_msgs_transmited_to_local_addrs == count_str_addr)
- run_connection_tests(2, session);
+ run_connection_tests(2, session);
}
if ((ntohs(message->type)==20))
{
@@ -616,8 +625,8 @@
tmp[len-2]= '\0';
#if DEBUG_CURL
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Header: `%s'\n",
- tmp);
+ "Header: `%s'\n",
+ tmp);
#endif
if (0==strcmp (tmp,"HTTP/1.1 100 Continue"))
{
@@ -651,7 +660,7 @@
static void
send_execute (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct HTTP_Transfer *res;
@@ -702,50 +711,50 @@
if (res == &test_no_ident)
{
if ((res->http_result_code==404) && (buffer_in.len==208))
- {
+ {
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Connecting to peer without any peer
identification: test passed\n");
+ "Connecting to peer without any peer
identification: test passed\n");
res->test_failed = GNUNET_NO;
}
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Connecting to peer without any peer
identification: test failed\n"));
+ _("Connecting to peer without any peer
identification: test failed\n"));
}
if (res == &test_too_short_ident)
{
if ((res->http_result_code==404) && (buffer_in.len==208))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Connecting to peer with too short peer
identification: test passed\n");
+ "Connecting to peer with too short peer
identification: test passed\n");
res->test_failed = GNUNET_NO;
}
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Connecting to peer with too short peer
identification: test failed\n"));
+ _("Connecting to peer with too short peer
identification: test failed\n"));
}
if (res == &test_too_long_ident)
{
if ((res->http_result_code==404) && (buffer_in.len==208))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Connecting to peer with too long peer
identification: test passed\n");
+ "Connecting to peer with too long peer
identification: test passed\n");
res->test_failed = GNUNET_NO;
}
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Connecting to peer with too long peer
identification: test failed\n"));
+ _("Connecting to peer with too long peer
identification: test failed\n"));
}
if (res == &test_valid_ident)
{
if ((res->http_result_code==200))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Connecting to peer with valid peer
identification: test passed\n");
+ "Connecting to peer with valid peer
identification: test passed\n");
res->test_failed = GNUNET_NO;
}
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Connecting to peer with valid peer
identification: test failed\n");
+ "Connecting to peer with valid peer
identification: test failed\n");
}
curl_easy_cleanup(curl_handle);
curl_handle=NULL;
@@ -811,12 +820,12 @@
GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1);
GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1);
http_task_send = GNUNET_SCHEDULER_add_select
(GNUNET_SCHEDULER_PRIORITY_DEFAULT,
- GNUNET_SCHEDULER_NO_TASK,
- GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 0),
- grs,
- gws,
- &send_execute,
- result);
+ GNUNET_SCHEDULER_NO_TASK,
+ GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 0),
+ grs,
+ gws,
+ &send_execute,
+ result);
GNUNET_NETWORK_fdset_destroy (gws);
GNUNET_NETWORK_fdset_destroy (grs);
@@ -829,7 +838,7 @@
*/
static int
send_data(struct HTTP_Transfer * result,
- char * url)
+ char * url)
{
curl_handle = curl_easy_init();
@@ -895,9 +904,9 @@
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Transport plugin notification for address: `%s':%u\n"),
- address,
- port);
+ _("Transport plugin notification for address: `%s':%u\n"),
+ address,
+ port);
pl_addr = GNUNET_malloc (sizeof (struct Plugin_Address) );
pl_addr->addrlen = addrlen;
pl_addr->addr = GNUNET_malloc(addrlen);
@@ -912,9 +921,9 @@
{
cur = addr_head;
while (NULL != cur->next)
- {
- cur = cur->next;
- }
+ {
+ cur = cur->next;
+ }
cur->next = pl_addr;
}
fail_notify_address_count++;
@@ -923,13 +932,13 @@
static void
plugin_env_session_end (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ const struct GNUNET_PeerIdentity *peer,
+ struct Session *session)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Pluging tells me: session %X to peer `%s' ended\n",
- session,
- GNUNET_i2s(peer));
+ "Pluging tells me: session %X to peer `%s' ended\n",
+ session,
+ GNUNET_i2s(peer));
}
@@ -970,13 +979,13 @@
static void
pretty_printer_cb (void *cls,
- const char *address)
+ const char *address)
{
if (NULL==address)
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Plugin returned pretty address: `%s'\n",
- address);
+ "Plugin returned pretty address: `%s'\n",
+ address);
fail_pretty_printer_count++;
}
@@ -1003,71 +1012,71 @@
if (test_no_ident.test_executed == GNUNET_NO)
{
- /* Connecting to peer without identification */
- const char * ident = "";
- GNUNET_asprintf (&host_str,
- "%s://%s/%s",
- PROTOCOL_PREFIX,
- test_addr,ident);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Connecting to peer without any peer identification.\n"));
- test_no_ident.test_executed = GNUNET_YES;
- send_data ( &test_no_ident, host_str);
- GNUNET_free (host_str);
- return;
+ /* Connecting to peer without identification */
+ const char * ident = "";
+ GNUNET_asprintf (&host_str,
+ "%s://%s/%s",
+ PROTOCOL_PREFIX,
+ test_addr,ident);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ _("Connecting to peer without any peer
identification.\n"));
+ test_no_ident.test_executed = GNUNET_YES;
+ send_data ( &test_no_ident, host_str);
+ GNUNET_free (host_str);
+ return;
}
if (test_too_short_ident.test_executed == GNUNET_NO)
{
- const char * ident = "AAAAAAAAAA";
- /* Connecting to peer with too short identification */
- GNUNET_asprintf (&host_str,
- "%s://%s/%s",
- PROTOCOL_PREFIX,
- test_addr,
- ident);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Connecting to peer with too short peer
identification.\n"));
- test_too_short_ident.test_executed = GNUNET_YES;
- send_data ( &test_too_short_ident, host_str);
- GNUNET_free (host_str);
- return;
+ const char * ident = "AAAAAAAAAA";
+ /* Connecting to peer with too short identification */
+ GNUNET_asprintf (&host_str,
+ "%s://%s/%s",
+ PROTOCOL_PREFIX,
+ test_addr,
+ ident);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ _("Connecting to peer with too short peer
identification.\n"));
+ test_too_short_ident.test_executed = GNUNET_YES;
+ send_data ( &test_too_short_ident, host_str);
+ GNUNET_free (host_str);
+ return;
}
if (test_too_long_ident.test_executed == GNUNET_NO)
{
- const char * ident =
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
-
- /* Connecting to peer with too long identification */
- GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX,
test_addr,ident);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Connecting to peer with too long peer
identification.\n"));
- test_too_long_ident.test_executed = GNUNET_YES;
- send_data ( &test_too_long_ident, host_str);
- GNUNET_free (host_str);
- return;
+ const char * ident =
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+
+ /* Connecting to peer with too long identification */
+ GNUNET_asprintf (&host_str, "%s://%s/%s",PROTOCOL_PREFIX,
test_addr,ident);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ _("Connecting to peer with too long peer
identification.\n"));
+ test_too_long_ident.test_executed = GNUNET_YES;
+ send_data ( &test_too_long_ident, host_str);
+ GNUNET_free (host_str);
+ return;
}
if (test_valid_ident.test_executed == GNUNET_NO)
{
- struct GNUNET_CRYPTO_HashAsciiEncoded ident;
- GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident);
- GNUNET_asprintf (&host_str,
- "%s://%s/%s%s",
- PROTOCOL_PREFIX,
- test_addr,
- (char *) &ident,
- ";0");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Connecting to peer with valid peer identification.\n"));
- test_valid_ident.test_executed = GNUNET_YES;
- send_data ( &test_valid_ident, host_str);
- GNUNET_free (host_str);
- return;
+ struct GNUNET_CRYPTO_HashAsciiEncoded ident;
+ GNUNET_CRYPTO_hash_to_enc(&my_identity.hashPubKey,&ident);
+ GNUNET_asprintf (&host_str,
+ "%s://%s/%s%s",
+ PROTOCOL_PREFIX,
+ test_addr,
+ (char *) &ident,
+ ";0");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ _("Connecting to peer with valid peer identification.\n"));
+ test_valid_ident.test_executed = GNUNET_YES;
+ send_data ( &test_valid_ident, host_str);
+ GNUNET_free (host_str);
+ return;
}
}
if (phase==1)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "\nPhase 1: transmit data to all suggested addresses\n\n");
+ "\nPhase 1: transmit data to all suggested addresses\n\n");
/* Using one of the addresses the plugin proposed */
GNUNET_assert (addr_head->addr != NULL);
@@ -1084,41 +1093,41 @@
int count = 0;
while (tmp_addr != NULL)
- {
- if (tmp_addr->addrlen == (sizeof (struct IPv4HttpAddress)))
- {
- inet_ntop(AF_INET, (struct in_addr *)
tmp_addr->addr,address,INET_ADDRSTRLEN);
- port = ntohs(((struct IPv4HttpAddress *) tmp_addr->addr)->u_port);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending message to addres no. %u: `%s':%u\n",
- count,
- address,
- port);
- }
- if (tmp_addr->addrlen == (sizeof (struct IPv6HttpAddress)))
- {
- inet_ntop(AF_INET6, (struct in6_addr *)
tmp_addr->addr,address,INET6_ADDRSTRLEN);
- port = ntohs(((struct IPv6HttpAddress *)
tmp_addr->addr)->u6_port);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending message to addres no. %u: `%s':%u\n",
- count,
- address,
- port);
- }
- msg.type=htons(type);
- memcpy(tmp,&msg,sizeof(struct GNUNET_MessageHeader));
- api->send(api->cls,
- &my_identity,
- tmp, sizeof(struct GNUNET_MessageHeader),
- 0, TIMEOUT,
- NULL,
- tmp_addr->addr, tmp_addr->addrlen,
- GNUNET_YES,
- &task_send_cont, &fail_msgs_transmited_to_local_addrs);
- tmp_addr = tmp_addr->next;
- count++;
- type++;
- }
+ {
+ if (tmp_addr->addrlen == (sizeof (struct IPv4HttpAddress)))
+ {
+ inet_ntop(AF_INET, (struct in_addr *)
tmp_addr->addr,address,INET_ADDRSTRLEN);
+ port = ntohs(((struct IPv4HttpAddress *)
tmp_addr->addr)->u_port);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending message to addres no. %u: `%s':%u\n",
+ count,
+ address,
+ port);
+ }
+ if (tmp_addr->addrlen == (sizeof (struct IPv6HttpAddress)))
+ {
+ inet_ntop(AF_INET6, (struct in6_addr *)
tmp_addr->addr,address,INET6_ADDRSTRLEN);
+ port = ntohs(((struct IPv6HttpAddress *)
tmp_addr->addr)->u6_port);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending message to addres no. %u: `%s':%u\n",
+ count,
+ address,
+ port);
+ }
+ msg.type=htons(type);
+ memcpy(tmp,&msg,sizeof(struct GNUNET_MessageHeader));
+ api->send(api->cls,
+ &my_identity,
+ tmp, sizeof(struct GNUNET_MessageHeader),
+ 0, TIMEOUT,
+ NULL,
+ tmp_addr->addr, tmp_addr->addrlen,
+ GNUNET_YES,
+ &task_send_cont, &fail_msgs_transmited_to_local_addrs);
+ tmp_addr = tmp_addr->next;
+ count++;
+ type++;
+ }
GNUNET_free(tmp);
return;
}
@@ -1129,32 +1138,32 @@
msg = GNUNET_malloc (sizeof(struct GNUNET_MessageHeader));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Phase 2: session selection\n\n");
+ "Phase 2: session selection\n\n");
size = sizeof(struct GNUNET_MessageHeader);
msg->size=htons(size);
msg->type = htons(20);
api->send(api->cls,
- &my_identity,
- (const char *) msg, size,
- 0, TIMEOUT, NULL, NULL, 0, GNUNET_NO,
- &task_send_cont, NULL);
+ &my_identity,
+ (const char *) msg, size,
+ 0, TIMEOUT, NULL, NULL, 0, GNUNET_NO,
+ &task_send_cont, NULL);
msg->type = htons(21);
api->send(api->cls,
- &my_identity,
- (const char *) msg, size,
- 0, TIMEOUT, NULL, NULL, 0, GNUNET_SYSERR,
- &task_send_cont, NULL);
+ &my_identity,
+ (const char *) msg, size,
+ 0, TIMEOUT, NULL, NULL, 0, GNUNET_SYSERR,
+ &task_send_cont, NULL);
/* answer on session*/
size = sizeof( struct GNUNET_MessageHeader);
msg->size = htons(size);
msg->type = htons(22);
api->send(api->cls,
- &my_identity,
- (const char *) msg, size,
- 0, TIMEOUT, session, NULL, 0, GNUNET_SYSERR,
- &task_send_cont, NULL);
+ &my_identity,
+ (const char *) msg, size,
+ 0, TIMEOUT, session, NULL, 0, GNUNET_SYSERR,
+ &task_send_cont, NULL);
GNUNET_free(msg);
/* answer on session with big message not fitting in mhd send buffer*/
@@ -1163,10 +1172,10 @@
msg->size=htons(size);
msg->type = htons(23);
api->send(api->cls,
- &my_identity,
- (const char *) msg, size,
- 0, TIMEOUT, session, NULL, 0, GNUNET_NO,
- &task_send_cont, NULL);
+ &my_identity,
+ (const char *) msg, size,
+ 0, TIMEOUT, session, NULL, 0, GNUNET_NO,
+ &task_send_cont, NULL);
GNUNET_free(msg);
return;
}
@@ -1175,7 +1184,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Phase 3: send multiple or big messages after disconnect\n\n");
+ "Phase 3: send multiple or big messages after disconnect\n\n");
/* disconnect from peer, so new connections are created */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Disconnect from peer: `%s'\n",
GNUNET_i2s(&my_identity));
api->disconnect(api->cls, &my_identity);
@@ -1190,12 +1199,12 @@
msg2->size = htons(2 * sizeof(struct GNUNET_MessageHeader));
msg2->type = htons(31);
api->send(api->cls,
- &my_identity,
- (const char *) msg, 4 * sizeof(struct GNUNET_MessageHeader),
- 0, TIMEOUT, NULL,
- addr_head->addr, addr_head->addrlen,
- GNUNET_NO,
- &task_send_cont, &fail_multiple_msgs_in_transmission);
+ &my_identity,
+ (const char *) msg, 4 * sizeof(struct GNUNET_MessageHeader),
+ 0, TIMEOUT, NULL,
+ addr_head->addr, addr_head->addrlen,
+ GNUNET_NO,
+ &task_send_cont, &fail_multiple_msgs_in_transmission);
GNUNET_free(msg);
/* send a message with size GNUNET_SERVER_MAX_MESSAGE_SIZE-1 */
@@ -1204,15 +1213,15 @@
msg->size = htons(size);
msg->type = htons(32);
api->send(api->cls,
- &my_identity,
- (const char *) msg, size,
- 0, TIMEOUT, NULL,
- addr_head->addr, addr_head->addrlen,
- GNUNET_NO,
- &task_send_cont, &fail_msg_transmited_max_size);
+ &my_identity,
+ (const char *) msg, size,
+ 0, TIMEOUT, NULL,
+ addr_head->addr, addr_head->addrlen,
+ GNUNET_NO,
+ &task_send_cont, &fail_msg_transmited_max_size);
GNUNET_free(msg);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "No more tests to run\n");
+ "No more tests to run\n");
}
}
@@ -1252,6 +1261,9 @@
addr_head = NULL;
count_str_addr = 0;
/* parse configuration */
+ if (GNUNET_CONFIGURATION_have_value (c,"PATHS", "SERVICEHOME"))
+ GNUNET_CONFIGURATION_get_value_string (c, "PATHS", "SERVICEHOME",
&servicehome);
+
if ((GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c,
"TRANSPORT",
@@ -1305,8 +1317,8 @@
setup_plugin_environment ();
GNUNET_asprintf (&libname, "libgnunet_plugin_transport_http");
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Loading HTTP transport plugin `%s'\n"),
- libname);
+ _("Loading HTTP transport plugin `%s'\n"),
+ libname);
api = GNUNET_PLUGIN_load (libname, &env);
GNUNET_free (libname);
if (api == NULL)
@@ -1323,16 +1335,16 @@
/* testing plugin functionality */
GNUNET_assert (0!=fail_notify_address_count);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transport plugin returned %u addresses to connect to\n",
- fail_notify_address_count);
+ "Transport plugin returned %u addresses to connect to\n",
+ fail_notify_address_count);
/* testing pretty printer with all addresses obtained from the plugin*/
cur = addr_head;
while (cur != NULL)
{
api->address_pretty_printer (api->cls, "http",
- cur->addr,cur->addrlen,
GNUNET_NO,TEST_TIMEOUT,
- &pretty_printer_cb, NULL);
+ cur->addr,cur->addrlen,
GNUNET_NO,TEST_TIMEOUT,
+ &pretty_printer_cb, NULL);
addr_str = api->address_to_string (api->cls, cur->addr, cur->addrlen);
suggest_res = api->check_address (api->cls, cur->addr, cur->addrlen);
@@ -1434,13 +1446,26 @@
#endif
NULL);
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+ cfg = GNUNET_CONFIGURATION_create ();
+
+ GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg,
"test_plugin_transport_data_http.conf"));
+ if (GNUNET_CONFIGURATION_have_value (cfg,"PATHS", "SERVICEHOME"))
+ GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME",
&servicehome);
+ GNUNET_DISK_directory_remove (servicehome);
+ GNUNET_CONFIGURATION_destroy (cfg);
+
ret = (GNUNET_OK ==
GNUNET_PROGRAM_run (5,
argv_prog,
"test_gnunet_transport_plugin_http",
"testcase", options, &run, NULL)) ? GNUNET_NO :
GNUNET_YES;
- GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http");
+ if (servicehome != NULL)
+ {
+ GNUNET_DISK_directory_remove (servicehome);
+ GNUNET_free (servicehome);
+ }
if (ret != GNUNET_OK)
return 1;
return fail;
Modified: gnunet/src/transport/test_plugin_transport_https.c
===================================================================
--- gnunet/src/transport/test_plugin_transport_https.c 2011-06-16 14:29:41 UTC
(rev 15674)
+++ gnunet/src/transport/test_plugin_transport_https.c 2011-06-16 14:29:53 UTC
(rev 15675)
@@ -389,6 +389,8 @@
static char * key_file;
static char * cert_file;
+static char * servicehome;
+
/**
* Shutdown testcase
*/
@@ -486,6 +488,13 @@
GNUNET_free (cert_file);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting testcase\n");
+
+ if (servicehome != NULL)
+ {
+ GNUNET_DISK_directory_remove (servicehome);
+ GNUNET_free (servicehome);
+ }
+
exit(fail);
return;
}
@@ -1167,6 +1176,10 @@
addr_head = NULL;
count_str_addr = 0;
/* parse configuration */
+ if (GNUNET_CONFIGURATION_have_value (c,"PATHS", "SERVICEHOME"))
+ GNUNET_CONFIGURATION_get_value_string (c, "PATHS", "SERVICEHOME",
&servicehome);
+
+
if ((GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c,
"TRANSPORT",
@@ -1388,13 +1401,27 @@
#endif
NULL);
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+ cfg = GNUNET_CONFIGURATION_create ();
+
+ GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg,
"test_plugin_transport_data_http.conf"));
+ if (GNUNET_CONFIGURATION_have_value (cfg,"PATHS", "SERVICEHOME"))
+ GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "SERVICEHOME",
&servicehome);
+ GNUNET_DISK_directory_remove (servicehome);
+ GNUNET_CONFIGURATION_destroy (cfg);
+
ret = (GNUNET_OK ==
GNUNET_PROGRAM_run (5,
argv_prog,
"test_gnunet_transport_plugin.https",
"testcase", options, &run, NULL)) ? GNUNET_NO :
GNUNET_YES;
-
- GNUNET_DISK_directory_remove ("/tmp/test_gnunet_transport_plugin.https");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("\ndelete\n\n"));
+ if (servicehome != NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("\ndelete\n\n"));
+ GNUNET_DISK_directory_remove (servicehome);
+ GNUNET_free (servicehome);
+ }
if (GNUNET_OK != ret)
return 1;
return fail;
Modified: gnunet/src/transport/test_quota_compliance.c
===================================================================
--- gnunet/src/transport/test_quota_compliance.c 2011-06-16 14:29:41 UTC
(rev 15674)
+++ gnunet/src/transport/test_quota_compliance.c 2011-06-16 14:29:53 UTC
(rev 15675)
@@ -33,6 +33,7 @@
#include "gnunet_server_lib.h"
#include "gnunet_transport_service.h"
#include "transport.h"
+#include "transport-testing.h"
#define VERBOSE GNUNET_NO
@@ -59,16 +60,6 @@
#define MTYPE 11111
-struct PeerContext
-{
- struct GNUNET_CONFIGURATION_Handle *cfg;
- struct GNUNET_TRANSPORT_Handle *th;
- struct GNUNET_PeerIdentity id;
-#if START_ARM
- struct GNUNET_OS_Process *arm_proc;
-#endif
-};
-
/**
* Handle for a transmission-ready request.
*/
@@ -655,6 +646,11 @@
setup_peer (struct PeerContext *p, const char *cfgname)
{
p->cfg = GNUNET_CONFIGURATION_create ();
+ GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
+ if (GNUNET_CONFIGURATION_have_value (p->cfg,"PATHS", "SERVICEHOME"))
+ GNUNET_CONFIGURATION_get_value_string (p->cfg, "PATHS", "SERVICEHOME",
&p->servicehome);
+ GNUNET_DISK_directory_remove (p->servicehome);
+
#if START_ARM
p->arm_proc = GNUNET_OS_start_process (NULL, NULL,
"gnunet-service-arm",
@@ -665,7 +661,6 @@
"-c", cfgname, NULL);
#endif
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL,
p,
¬ify_receive_new,
@@ -897,9 +892,6 @@
GNUNET_asprintf(&logger,
"test-quota-compliance-%s-%s","noplugin","none");
}
- GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1");
- GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer2");
-
fprintf(stderr, "Running `%s'\n", logger);
GNUNET_log_setup ("test-quota-compliance",
#if VERBOSE
@@ -926,9 +918,17 @@
ret = ok;
stop_arm (&p1);
stop_arm (&p2);
+
+ if ((p1.servicehome != NULL) && (p2.servicehome != NULL))
+ {
+ GNUNET_DISK_directory_remove (p1.servicehome);
+ GNUNET_DISK_directory_remove (p2.servicehome);
+ GNUNET_free(p1.servicehome);
+ GNUNET_free(p2.servicehome);
+ }
+
GNUNET_free(logger);
- GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer1");
- GNUNET_DISK_directory_remove ("/tmp/test_quota_compliance_peer2");
+
return ret;
}
Modified: gnunet/src/transport/test_transport_api.c
===================================================================
--- gnunet/src/transport/test_transport_api.c 2011-06-16 14:29:41 UTC (rev
15674)
+++ gnunet/src/transport/test_transport_api.c 2011-06-16 14:29:53 UTC (rev
15675)
@@ -37,7 +37,7 @@
#include "transport.h"
#include "transport-testing.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
#define VERBOSE_ARM GNUNET_NO
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15675 - gnunet/src/transport,
gnunet <=