[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: TNG testing: Make executabl
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: TNG testing: Make executable name variable, try sending test data |
Date: |
Thu, 06 Jun 2019 03:45:57 +0200 |
This is an automated email from the git hooks/post-receive script.
julius-buenger pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 17cee253b TNG testing: Make executable name variable, try sending test
data
17cee253b is described below
commit 17cee253b6820e1c7aa18e51344a2fd5a14b809d
Author: Julius Bünger <address@hidden>
AuthorDate: Thu Jun 6 03:29:37 2019 +0200
TNG testing: Make executable name variable, try sending test data
---
src/transport/Makefile.am | 6 ++++-
src/transport/test_communicator_unix.c | 25 ++++++++---------
src/transport/transport-testing2.c | 49 +++++++++++++++++++++-------------
src/transport/transport-testing2.h | 1 +
4 files changed, 50 insertions(+), 31 deletions(-)
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 4fd54ac88..5c3721faa 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -249,7 +249,9 @@ libexec_PROGRAMS = \
$(WLAN_BIN_DUMMY) \
$(BT_BIN) \
gnunet-service-transport \
- gnunet-communicator-unix
+ gnunet-communicator-unix \
+ gnunet-communicator-udp \
+ gnunet-communicator-tcp
@@ -600,6 +602,8 @@ if HAVE_GETOPT_BINARY
check_PROGRAMS += \
test_transport_api_slow_ats
endif
+check_PROGRAMS += \
+test_communicator_unix
endif
if ENABLE_TEST_RUN
diff --git a/src/transport/test_communicator_unix.c
b/src/transport/test_communicator_unix.c
index e52391ef2..459af116a 100644
--- a/src/transport/test_communicator_unix.c
+++ b/src/transport/test_communicator_unix.c
@@ -32,18 +32,6 @@
#include <inttypes.h>
-/**
- * TODO
- * - start two communicators
- * - act like transport services
- * - get_server_addresses (service.c)
- * - open_listen_socket (service.c)
- * - GNUNET_MQ_queue_for_callbacks (service.c)
- * - let them communicate
- *
- */
-
-
#define LOG(kind,...) GNUNET_log_from (kind,
"test_transport_communicator_unix", __VA_ARGS__)
@@ -55,6 +43,14 @@ static struct
GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_hs[NUM_PE
//static char *addresses[NUM_PEERS];
+
+#define PAYLOAD_SIZE 256
+
+//static char payload[PAYLOAD_SIZE] = "TEST PAYLOAD";
+//static char payload[] = "TEST PAYLOAD";
+static uint32_t payload = 42;
+
+
static void
communicator_available_cb (void *cls,
struct
GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
@@ -110,6 +106,9 @@ add_queue_cb (void *cls,
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Got Queue!\n");
+ GNUNET_TRANSPORT_TESTING_transport_communicator_send (tc_queue,
+ &payload,
+ sizeof (payload));
}
@@ -120,6 +119,7 @@ run (void *cls)
tc_hs[0] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
"transport",
+ "gnunet-communicator-unix",
"test_communicator_1.conf",
&communicator_available_cb,
NULL,
@@ -128,6 +128,7 @@ run (void *cls)
NULL); /* cls */
tc_hs[1] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
"transport",
+ "gnunet-communicator-unix",
"test_communicator_2.conf",
&communicator_available_cb,
&add_address_cb,
diff --git a/src/transport/transport-testing2.c
b/src/transport/transport-testing2.c
index 9bbd15983..ff8e15719 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -541,19 +541,20 @@ shutdown_communicator (void *cls)
*/
static void
communicator_start (
- struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
+ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
+ const char *binary_name)
{
char *binary;
LOG (GNUNET_ERROR_TYPE_DEBUG, "communicator_start\n");
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-communicator-unix");
+ binary = GNUNET_OS_get_libexec_binary_path (binary_name);
tc_h->c_proc = GNUNET_OS_start_process (GNUNET_YES,
GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
NULL,
NULL,
NULL,
binary,
- "./gnunet-communicator-unix",
+ binary_name,
"-c",
tc_h->cfg_filename,
NULL);
@@ -583,14 +584,15 @@ communicator_start (
*/
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *
GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
- const char *service_name,
- const char *cfg_filename,
- GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback
- communicator_available_cb,
- GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb,
- GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback queue_create_reply_cb,
- GNUNET_TRANSPORT_TESTING_AddQueueCallback add_queue_cb,
- void *cb_cls)
+ const char *service_name,
+ const char *binary_name,
+ const char *cfg_filename,
+ GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback
+ communicator_available_cb,
+ GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb,
+ GNUNET_TRANSPORT_TESTING_QueueCreateReplyCallback queue_create_reply_cb,
+ GNUNET_TRANSPORT_TESTING_AddQueueCallback add_queue_cb,
+ void *cb_cls)
{
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h;
@@ -618,7 +620,8 @@
GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
transport_communicator_start (tc_h);
/* Schedule start communicator */
- communicator_start (tc_h);
+ communicator_start (tc_h,
+ binary_name);
return tc_h;
}
@@ -638,6 +641,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (
tc_queue =
GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue);
+ tc_queue->tc_h = tc_h;
prefix = GNUNET_HELLO_address_to_prefix (address);
if (NULL == prefix)
{
@@ -674,18 +678,27 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send
GNUNET_TRANSPORT_TESTING_SuccessStatus cb,
void *cb_cls*/)
{
- // struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission *tc_t;
+ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission *tc_t;
+ struct GNUNET_MessageHeader *mh;
struct GNUNET_TRANSPORT_SendMessageTo *msg;
struct GNUNET_MQ_Envelope *env;
-
+ size_t inbox_size;
+
+ inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size;
+ mh = GNUNET_malloc (inbox_size);
+ mh->size = htons (inbox_size);
+ mh->type = GNUNET_MESSAGE_TYPE_DUMMY;
+ memcpy (&mh[1],
+ payload,
+ payload_size);
env = GNUNET_MQ_msg_extra (msg,
- payload_size,
+ inbox_size,
GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG);
msg->qid = htonl (tc_queue->qid);
msg->mid = tc_queue->mid++;
msg->receiver = tc_queue->peer_id;
- memcpy (&msg[1], payload, payload_size);
+ memcpy (&msg[1], mh, inbox_size);
+ GNUNET_free (mh);
GNUNET_MQ_send (tc_queue->tc_h->c_mq, env);
- GNUNET_break (0); /* fixme: return value? */
- return NULL; // tc_t;
+ return tc_t;
}
diff --git a/src/transport/transport-testing2.h
b/src/transport/transport-testing2.h
index 4b9eb0f54..83d98baab 100644
--- a/src/transport/transport-testing2.h
+++ b/src/transport/transport-testing2.h
@@ -84,6 +84,7 @@ typedef void
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *
GNUNET_TRANSPORT_TESTING_transport_communicator_service_start
(const char *service_name,
+ const char *binary_name,
const char *cfg_filename,
GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback
communicator_available_cb,
GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: TNG testing: Make executable name variable, try sending test data,
gnunet <=