tool to use testing functionality from cmd line More...
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "gnunet-testing", __VA_ARGS__) |
Functions | |
static int | create_unique_cfgs (const char *template, const unsigned int no) |
static int | create_hostkeys (const unsigned int no) |
static void | cleanup (void *cls) |
Cleanup called by signal handlers and when stdin is closed. More... | |
static void | stdin_cb (void *cls) |
Called whenever we can read stdin non-blocking. More... | |
static void | testing_main (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) |
Main function called by the testing library. More... | |
static void | run_no_scheduler (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be running without scheduler. More... | |
int | main (int argc, char *const *argv) |
The main function. More... | |
Variables | |
static int | ret |
Final status code. More... | |
static char * | create_hostkey |
Filename of the hostkey file we should write, null if we should not write a hostkey file. More... | |
static int | create_cfg |
Non-zero if we should create config files. More... | |
static unsigned int | create_no |
Number of config files to create. More... | |
static char * | create_cfg_template |
Filename of the config template to be written. More... | |
static char * | run_service_name |
Service we are supposed to run. More... | |
static struct GNUNET_DISK_FileHandle * | fh |
File handle to STDIN, for reading restart/quit commands. More... | |
static char * | tmpfilename |
Temporary filename, used with '-r' to write the configuration to. More... | |
static struct GNUNET_SCHEDULER_Task * | tid |
Task identifier of the task that waits for stdin. More... | |
static struct GNUNET_TESTING_Peer * | my_peer |
Peer started for '-r'. More... | |
tool to use testing functionality from cmd line
Definition in file gnunet-testing.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "gnunet-testing", __VA_ARGS__) |
Definition at line 31 of file gnunet-testing.c.
|
static |
Definition at line 87 of file gnunet-testing.c.
References create_cfg_template, GNUNET_asprintf(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_load(), GNUNET_CONFIGURATION_write(), GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_TESTING_configuration_create(), GNUNET_TESTING_system_create(), GNUNET_TESTING_system_destroy(), and GNUNET_YES.
Referenced by run_no_scheduler().
|
static |
Definition at line 173 of file gnunet-testing.c.
References _, create_hostkey, create_no, GNUNET_DISK_FileHandle::fd, GNUNET_assert, GNUNET_DISK_directory_create_for_file(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_READWRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log_from, GNUNET_OK, GNUNET_TESTING_hostkey_get(), GNUNET_TESTING_system_create(), GNUNET_TESTING_system_destroy(), GNUNET_YES, id, pk, and ret.
Referenced by run_no_scheduler().
|
static |
Cleanup called by signal handlers and when stdin is closed.
Removes the temporary file.
cls | unused |
Definition at line 218 of file gnunet-testing.c.
References fh, GNUNET_DISK_file_close(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log_strerror_file, GNUNET_SCHEDULER_cancel(), tid, and tmpfilename.
Referenced by testing_main().
|
static |
Called whenever we can read stdin non-blocking.
cls | unused |
Definition at line 246 of file gnunet-testing.c.
References _, fh, GNUNET_ERROR_TYPE_ERROR, GNUNET_OK, GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_shutdown(), GNUNET_TESTING_peer_start(), GNUNET_TESTING_peer_stop(), GNUNET_TIME_UNIT_FOREVER_REL, LOG, my_peer, and tid.
Referenced by testing_main().
|
static |
Main function called by the testing library.
Executed inside a running scheduler.
cls | unused |
cfg | configuration of the peer that was started |
peer | handle to the peer |
Definition at line 294 of file gnunet-testing.c.
References cfg, cleanup(), fh, GNUNET_break, GNUNET_CONFIGURATION_write(), GNUNET_DISK_get_handle_from_native(), GNUNET_DISK_mktemp(), GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, my_peer, peer, stdin_cb(), tid, and tmpfilename.
Referenced by run_no_scheduler().
|
static |
Main function that will be running without scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 332 of file gnunet-testing.c.
References create_cfg, create_cfg_template, create_hostkey, create_hostkeys(), create_no, create_unique_cfgs(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_TESTING_service_run(), GNUNET_YES, ret, run_service_name, and testing_main().
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 380 of file gnunet-testing.c.
References create_cfg, create_cfg_template, create_hostkey, create_no, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_GETOPT_option_uint(), GNUNET_OK, GNUNET_PROGRAM_run2(), GNUNET_STRINGS_get_utf8_args(), GNUNET_YES, options, ret, run_no_scheduler(), and run_service_name.
|
static |
Final status code.
Definition at line 37 of file gnunet-testing.c.
Referenced by create_hostkeys(), main(), and run_no_scheduler().
|
static |
Filename of the hostkey file we should write, null if we should not write a hostkey file.
Definition at line 43 of file gnunet-testing.c.
Referenced by create_hostkeys(), main(), and run_no_scheduler().
|
static |
Non-zero if we should create config files.
Definition at line 48 of file gnunet-testing.c.
Referenced by main(), and run_no_scheduler().
|
static |
Number of config files to create.
Definition at line 53 of file gnunet-testing.c.
Referenced by create_hostkeys(), main(), and run_no_scheduler().
|
static |
Filename of the config template to be written.
Definition at line 58 of file gnunet-testing.c.
Referenced by create_unique_cfgs(), main(), and run_no_scheduler().
|
static |
Service we are supposed to run.
Definition at line 63 of file gnunet-testing.c.
Referenced by main(), and run_no_scheduler().
|
static |
File handle to STDIN, for reading restart/quit commands.
Definition at line 68 of file gnunet-testing.c.
Referenced by cleanup(), close_files_iter(), database_setup(), database_shutdown(), destroy_task(), fh_reader(), get_file_handle(), GNUNET_DISK_fn_read(), GNUNET_DISK_get_handle_from_int_fd(), GNUNET_FS_download_start_task_(), GNUNET_FS_handle_on_demand_block(), incrementBit(), load_etc_hosts(), lookup_dns_servers(), main(), process_result_with_request(), publish_fs_connect_complete_cb(), restore_valid_peers(), sign_worker(), stdin_cb(), store_and_free_entries(), store_peer_presistently_iterator(), store_valid_peers(), testing_main(), transmit_next(), try_match_block(), and write_benchmark_data().
|
static |
Temporary filename, used with '-r' to write the configuration to.
Definition at line 73 of file gnunet-testing.c.
Referenced by cleanup(), and testing_main().
|
static |
Task identifier of the task that waits for stdin.
Definition at line 78 of file gnunet-testing.c.
Referenced by cleanup(), stdin_cb(), testing_main(), and write_benchmark_data().
|
static |
Peer started for '-r'.
Definition at line 83 of file gnunet-testing.c.
Referenced by stdin_cb(), and testing_main().