diff options
author | t3sserakt <t3ss@posteo.de> | 2021-11-09 17:38:47 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-11-09 17:43:25 +0100 |
commit | 8cd4dadfb9ebd4db232fda79d5c4353eacb15690 (patch) | |
tree | a063e52d71d1b6611371f6c129c6ae1b0215cf99 /src/testing/gnunet-cmds-helper.c | |
parent | 6fb788ca2ec44837ea10a36be7fd0030fb08955b (diff) | |
download | gnunet-8cd4dadfb9ebd4db232fda79d5c4353eacb15690.tar.gz gnunet-8cd4dadfb9ebd4db232fda79d5c4353eacb15690.zip |
- moved global netjail methods to its own header file.dev/t3ss/tng
- added configuration by string in test skript instead of config file.
- moved netjail scripts to contrib/netjail and install them into
the share/gnunet directory.
Diffstat (limited to 'src/testing/gnunet-cmds-helper.c')
-rw-r--r-- | src/testing/gnunet-cmds-helper.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c index 4aeccb115..f90cc3cc4 100644 --- a/src/testing/gnunet-cmds-helper.c +++ b/src/testing/gnunet-cmds-helper.c | |||
@@ -142,6 +142,16 @@ struct NodeIdentifier | |||
142 | * | 142 | * |
143 | */ | 143 | */ |
144 | char *local_m; | 144 | char *local_m; |
145 | |||
146 | /** | ||
147 | * Shall we read the topology from file, or from a string. | ||
148 | */ | ||
149 | unsigned int *read_file; | ||
150 | |||
151 | /** | ||
152 | * String with topology data or name of topology file. | ||
153 | */ | ||
154 | char *topology_data; | ||
145 | }; | 155 | }; |
146 | 156 | ||
147 | /** | 157 | /** |
@@ -402,7 +412,8 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | |||
402 | strcat (node_ip, plugin->m); | 412 | strcat (node_ip, plugin->m); |
403 | 413 | ||
404 | plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, | 414 | plugin->api->start_testcase (&write_message, router_ip, node_ip, plugin->m, |
405 | plugin->n, plugin->local_m); | 415 | plugin->n, plugin->local_m, ni->topology_data, |
416 | ni->read_file); | ||
406 | 417 | ||
407 | GNUNET_free (binary); | 418 | GNUNET_free (binary); |
408 | 419 | ||
@@ -559,6 +570,10 @@ main (int argc, char **argv) | |||
559 | struct GNUNET_GETOPT_CommandLineOption options[] = | 570 | struct GNUNET_GETOPT_CommandLineOption options[] = |
560 | { GNUNET_GETOPT_OPTION_END }; | 571 | { GNUNET_GETOPT_OPTION_END }; |
561 | int ret; | 572 | int ret; |
573 | int i; | ||
574 | size_t topology_data_length = 0; | ||
575 | unsigned int read_file; | ||
576 | char cr[1] = "\n"; | ||
562 | 577 | ||
563 | GNUNET_log_setup ("gnunet-cmds-helper", | 578 | GNUNET_log_setup ("gnunet-cmds-helper", |
564 | "DEBUG", | 579 | "DEBUG", |
@@ -569,6 +584,30 @@ main (int argc, char **argv) | |||
569 | ni->m = argv[3]; | 584 | ni->m = argv[3]; |
570 | ni->n = argv[4]; | 585 | ni->n = argv[4]; |
571 | 586 | ||
587 | sscanf (argv[5], "%u", &read_file); | ||
588 | |||
589 | if (1 == read_file) | ||
590 | ni->topology_data = argv[6]; | ||
591 | else | ||
592 | { | ||
593 | for (i = 6; i<argc; i++) | ||
594 | topology_data_length += strlen (argv[i]) + 1; | ||
595 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
596 | "topo data length %lu\n", | ||
597 | topology_data_length); | ||
598 | ni->topology_data = GNUNET_malloc (topology_data_length); | ||
599 | for (i = 6; i<argc; i++) | ||
600 | { | ||
601 | strcat (ni->topology_data, argv[i]); | ||
602 | strcat (ni->topology_data, cr); | ||
603 | } | ||
604 | } | ||
605 | ni->read_file = &read_file; | ||
606 | ni->topology_data[topology_data_length - 1] = '\0'; | ||
607 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
608 | "topo data %s\n", | ||
609 | ni->topology_data); | ||
610 | |||
572 | status = GNUNET_OK; | 611 | status = GNUNET_OK; |
573 | if (NULL == | 612 | if (NULL == |
574 | (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) | 613 | (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) |