diff options
author | t3sserakt <t3ss@posteo.de> | 2021-07-22 17:03:02 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-07-22 17:03:02 +0200 |
commit | 6b2c5a92fbc3a57c42fc9fb38c4705ecb7afb328 (patch) | |
tree | 7e63539ec546952490bb9f8711ea431d2ae52ac7 /src/testbed | |
parent | f6f5f6367599cff9ec014c2950359dffa052404d (diff) | |
download | gnunet-6b2c5a92fbc3a57c42fc9fb38c4705ecb7afb328.tar.gz gnunet-6b2c5a92fbc3a57c42fc9fb38c4705ecb7afb328.zip |
- added first testcase cmd code for sending a simple testmessage
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-cmds-helper.c | 5 | ||||
-rw-r--r-- | src/testbed/plugin_testcmd.c | 6 | ||||
-rw-r--r-- | src/testbed/test_testbed_api_cmd_netjail.c | 5 | ||||
-rw-r--r-- | src/testbed/testbed_api_cmd_netjail_start_testbed.c | 9 |
4 files changed, 16 insertions, 9 deletions
diff --git a/src/testbed/gnunet-cmds-helper.c b/src/testbed/gnunet-cmds-helper.c index 0d618bd48..113e3c386 100644 --- a/src/testbed/gnunet-cmds-helper.c +++ b/src/testbed/gnunet-cmds-helper.c | |||
@@ -427,7 +427,8 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | |||
427 | strcat (node_ip, NODE_BASE_IP); | 427 | strcat (node_ip, NODE_BASE_IP); |
428 | strcat (node_ip, plugin->n); | 428 | strcat (node_ip, plugin->n); |
429 | 429 | ||
430 | plugin->api->start_testcase (&write_message, router_ip, node_ip); | 430 | plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, |
431 | plugin->n); | ||
431 | 432 | ||
432 | LOG (GNUNET_ERROR_TYPE_ERROR, | 433 | LOG (GNUNET_ERROR_TYPE_ERROR, |
433 | "We got here!\n"); | 434 | "We got here!\n"); |
@@ -479,8 +480,6 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | |||
479 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( | 480 | else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED == ntohs ( |
480 | message->type)) | 481 | message->type)) |
481 | { | 482 | { |
482 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
483 | "We got here 8!\n"); | ||
484 | plugin->api->all_peers_started (); | 483 | plugin->api->all_peers_started (); |
485 | return GNUNET_OK; | 484 | return GNUNET_OK; |
486 | } | 485 | } |
diff --git a/src/testbed/plugin_testcmd.c b/src/testbed/plugin_testcmd.c index 70b6ad3ae..797826781 100644 --- a/src/testbed/plugin_testcmd.c +++ b/src/testbed/plugin_testcmd.c | |||
@@ -46,7 +46,9 @@ all_peers_started () | |||
46 | 46 | ||
47 | static void | 47 | static void |
48 | start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, | 48 | start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, |
49 | char *node_ip) | 49 | char *node_ip, |
50 | char *n, | ||
51 | char *m) | ||
50 | { | 52 | { |
51 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 53 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
52 | 54 | ||
@@ -110,4 +112,4 @@ libgnunet_plugin_testcmd_done (void *cls) | |||
110 | } | 112 | } |
111 | 113 | ||
112 | 114 | ||
113 | /* end of plugin_gnsrecord_dns.c */ | 115 | /* end of plugin_testcmd.c */ |
diff --git a/src/testbed/test_testbed_api_cmd_netjail.c b/src/testbed/test_testbed_api_cmd_netjail.c index e5fc0877e..8bb9e40e8 100644 --- a/src/testbed/test_testbed_api_cmd_netjail.c +++ b/src/testbed/test_testbed_api_cmd_netjail.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file testing/test_testing_api_cmd_netjail.c | 22 | * @file testing/test_testbed_api_cmd_netjail.c |
23 | * @brief Test case executing a script in a network name space. | 23 | * @brief Test case executing a script in a network name space. |
24 | * @author t3sserakt | 24 | * @author t3sserakt |
25 | */ | 25 | */ |
@@ -44,7 +44,8 @@ run (void *cls) | |||
44 | "2"), | 44 | "2"), |
45 | GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", | 45 | GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", |
46 | "2", | 46 | "2", |
47 | "2"), | 47 | "2", |
48 | "libgnunet_plugin_testcmd"), | ||
48 | GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", | 49 | GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", |
49 | "netjail-start-testbed-1", | 50 | "netjail-start-testbed-1", |
50 | "2", | 51 | "2", |
diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c index bc4674b74..9b68c52f6 100644 --- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c +++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c | |||
@@ -97,6 +97,8 @@ struct NetJailState | |||
97 | struct GNUNET_TESTBED_Host **host; | 97 | struct GNUNET_TESTBED_Host **host; |
98 | 98 | ||
99 | unsigned int n_host; | 99 | unsigned int n_host; |
100 | |||
101 | char *plugin_name; | ||
100 | }; | 102 | }; |
101 | 103 | ||
102 | struct TestbedCount | 104 | struct TestbedCount |
@@ -345,6 +347,7 @@ start_testbed (struct NetJailState *ns, struct | |||
345 | 347 | ||
346 | cfg = GNUNET_CONFIGURATION_dup (config); | 348 | cfg = GNUNET_CONFIGURATION_dup (config); |
347 | 349 | ||
350 | // TODO We do not need this? | ||
348 | GNUNET_array_append (ns->host, ns->n_host, | 351 | GNUNET_array_append (ns->host, ns->n_host, |
349 | GNUNET_TESTBED_host_create_with_id (tbc->count - 1, | 352 | GNUNET_TESTBED_host_create_with_id (tbc->count - 1, |
350 | NULL, | 353 | NULL, |
@@ -374,7 +377,7 @@ start_testbed (struct NetJailState *ns, struct | |||
374 | 377 | ||
375 | msg = create_helper_init_msg_ (m_char, | 378 | msg = create_helper_init_msg_ (m_char, |
376 | n_char, | 379 | n_char, |
377 | "libgnunet_plugin_testcmd"); | 380 | ns->plugin_name); |
378 | GNUNET_array_append (ns->msg, ns->n_msg, &msg->header); | 381 | GNUNET_array_append (ns->msg, ns->n_msg, &msg->header); |
379 | 382 | ||
380 | GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send ( | 383 | GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send ( |
@@ -506,13 +509,15 @@ netjail_start_finish (void *cls, | |||
506 | struct GNUNET_TESTING_Command | 509 | struct GNUNET_TESTING_Command |
507 | GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, | 510 | GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, |
508 | char *local_m, | 511 | char *local_m, |
509 | char *global_n) | 512 | char *global_n, |
513 | char *plugin_name) | ||
510 | { | 514 | { |
511 | struct NetJailState *ns; | 515 | struct NetJailState *ns; |
512 | 516 | ||
513 | ns = GNUNET_new (struct NetJailState); | 517 | ns = GNUNET_new (struct NetJailState); |
514 | ns->local_m = local_m; | 518 | ns->local_m = local_m; |
515 | ns->global_n = global_n; | 519 | ns->global_n = global_n; |
520 | ns->plugin_name = plugin_name; | ||
516 | 521 | ||
517 | struct GNUNET_TESTING_Command cmd = { | 522 | struct GNUNET_TESTING_Command cmd = { |
518 | .cls = ns, | 523 | .cls = ns, |