Library for writing testcases for GNUnet. More...
Data Structures | |
struct | GNUNET_TESTING_SharedService |
Specification of a service that is to be shared among peers. More... | |
Macros | |
#define | GNUNET_TESTING_HOSTKEYFILESIZE |
Size of each hostkey in the hostkey file (in BYTES). More... | |
#define | GNUNET_TESTING_PREFIX "GNUNET_TESTING_PREFIX" |
The environmental variable, if set, that dictates where testing should place generated peer configurations. More... | |
Typedefs | |
typedef void(* | GNUNET_TESTING_PeerStopCallback) (void *cls, struct GNUNET_TESTING_Peer *peer, int success) |
Callback to inform whether the peer is running or stopped. More... | |
typedef void(* | GNUNET_TESTING_TestMain) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) |
Signature of the 'main' function for a (single-peer) testcase that is run using GNUNET_TESTING_peer_run(). More... | |
Functions | |
struct GNUNET_TESTING_System * | GNUNET_TESTING_system_create (const char *testdir, const char *trusted_ip, const char *hostname, const struct GNUNET_TESTING_SharedService *shared_services) |
Create a system handle. More... | |
struct GNUNET_TESTING_System * | GNUNET_TESTING_system_create_with_portrange (const char *testdir, const char *trusted_ip, const char *hostname, const struct GNUNET_TESTING_SharedService *shared_services, uint16_t lowport, uint16_t highport) |
Create a system handle. More... | |
void | GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, int remove_paths) |
Free system resources. More... | |
struct GNUNET_CRYPTO_EddsaPrivateKey * | GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, uint32_t key_number, struct GNUNET_PeerIdentity *id) |
Testing includes a number of pre-created hostkeys for faster peer startup. More... | |
uint16_t | GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system) |
Reserve a port for a peer. More... | |
void | GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, uint16_t port) |
Release reservation of a TCP or UDP port for a peer (used during GNUNET_TESTING_peer_destroy). More... | |
int | GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system, struct GNUNET_CONFIGURATION_Handle *cfg) |
Create a new configuration using the given configuration as a template; ports and paths will be modified to select available ports on the local system. More... | |
struct GNUNET_TESTING_Peer * | GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, struct GNUNET_CONFIGURATION_Handle *cfg, uint32_t key_number, struct GNUNET_PeerIdentity *id, char **emsg) |
Configure a GNUnet peer. More... | |
void | GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, struct GNUNET_PeerIdentity *id) |
Obtain the peer identity from a peer handle. More... | |
int | GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer) |
Start the peer. More... | |
int | GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer) |
Stop the peer. More... | |
void | GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer) |
Destroy the peer. More... | |
int | GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer) |
Sends SIGTERM to the peer's main process. More... | |
int | GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer) |
Waits for a peer to terminate. More... | |
int | GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer, GNUNET_TESTING_PeerStopCallback cb, void *cb_cls) |
Stop a peer asynchronously using ARM API. More... | |
void | GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer) |
Cancel a previous asynchronous peer stop request. More... | |
int | GNUNET_TESTING_peer_run (const char *testdir, const char *cfgfilename, GNUNET_TESTING_TestMain tm, void *tm_cls) |
Start a single peer and run a test using the testing library. More... | |
int | GNUNET_TESTING_service_run (const char *testdir, const char *service_name, const char *cfgfilename, GNUNET_TESTING_TestMain tm, void *tm_cls) |
Start a single service (no ARM, except of course if the given service name is 'arm') and run a test using the testing library. More... | |
Library for writing testcases for GNUnet.
It can start/stop one or more peers on a system; testing is responsible for managing private keys, ports and paths; it is a low-level library that does not support higher-level functions such as P2P connection, topology management or distributed testbed maintenance (those are provided by the Testbed service)
#define GNUNET_TESTING_HOSTKEYFILESIZE |
Size of each hostkey in the hostkey file (in BYTES).
Definition at line 63 of file gnunet_testing_lib.h.
#define GNUNET_TESTING_PREFIX "GNUNET_TESTING_PREFIX" |
The environmental variable, if set, that dictates where testing should place generated peer configurations.
Definition at line 70 of file gnunet_testing_lib.h.
typedef void(* GNUNET_TESTING_PeerStopCallback) (void *cls, struct GNUNET_TESTING_Peer *peer, int success) |
Callback to inform whether the peer is running or stopped.
cls | the closure given to GNUNET_TESTING_peer_stop_async() |
peer | the respective peer whose status is being reported |
success | GNUNET_YES if the peer is stopped; GNUNET_SYSERR upon any error |
Definition at line 350 of file gnunet_testing_lib.h.
typedef void(* GNUNET_TESTING_TestMain) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) |
Signature of the 'main' function for a (single-peer) testcase that is run using GNUNET_TESTING_peer_run().
cls | closure |
cfg | configuration of the peer that was started |
peer | identity of the peer that was created |
Definition at line 394 of file gnunet_testing_lib.h.
struct GNUNET_TESTING_System* GNUNET_TESTING_system_create | ( | const char * | testdir, |
const char * | trusted_ip, | ||
const char * | hostname, | ||
const struct GNUNET_TESTING_SharedService * | shared_services | ||
) |
Create a system handle.
There must only be one system handle per operating system. Uses a default range for allowed ports. Ports are still tested for availability.
testdir | only the directory name without any path. This is used for all service homes; the directory will be created in a temporary location depending on the underlying OS. This variable will be overridden with the value of the environmental variable GNUNET_TESTING_PREFIX, if it exists. |
trusted_ip | the ip address which will be set as TRUSTED HOST in all service configurations generated to allow control connections from this ip. This can either be a single ip address or a network address in CIDR notation. |
hostname | the hostname of the system we are using for testing; NULL for localhost |
shared_services | NULL terminated array describing services that are to be shared among peers |
Definition at line 477 of file testing.c.
References GNUNET_TESTING_system_create_with_portrange(), HIGH_PORT, hostname, LOW_PORT, GNUNET_TESTING_System::shared_services, and GNUNET_TESTING_System::trusted_ip.
Referenced by create_hostkeys(), create_unique_cfgs(), GNUNET_TESTING_service_run(), GNUNET_TRANSPORT_TESTING_init(), handle_init(), system_create_run(), and tokenizer_cb().
struct GNUNET_TESTING_System* GNUNET_TESTING_system_create_with_portrange | ( | const char * | testdir, |
const char * | trusted_ip, | ||
const char * | hostname, | ||
const struct GNUNET_TESTING_SharedService * | shared_services, | ||
uint16_t | lowport, | ||
uint16_t | highport | ||
) |
Create a system handle.
There must only be one system handle per operating system. Use this function directly if multiple system objects are created for the same host (only really useful when testing — or to make the port range configurable).
testdir | only the directory name without any path. This is used for all service homes; the directory will be created in a temporary location depending on the underlying OS. This variable will be overridden with the value of the environmental variable GNUNET_TESTING_PREFIX, if it exists. |
trusted_ip | the ip address which will be set as TRUSTED HOST in all service configurations generated to allow control connections from this ip. This can either be a single ip address or a network address in CIDR notation. |
hostname | the hostname of the system we are using for testing; NULL for localhost |
shared_services | NULL terminated array describing services that are to be shared among peers |
lowport | lowest port number this system is allowed to allocate (inclusive) |
highport | highest port number this system is allowed to allocate (exclusive) |
There must only be one system handle per operating system.
testdir | only the directory name without any path. This is used for all service homes; the directory will be created in a temporary location depending on the underlying OS. This variable will be overridden with the value of the environmental variable GNUNET_TESTING_PREFIX, if it exists. |
trusted_ip | the ip address which will be set as TRUSTED HOST in all service configurations generated to allow control connections from this ip. This can either be a single ip address or a network address in CIDR notation. |
hostname | the hostname of the system we are using for testing; NULL for localhost |
shared_services | NULL terminated array describing services that are to be shared among peers |
lowport | lowest port number this system is allowed to allocate (inclusive) |
highport | highest port number this system is allowed to allocate (exclusive) |
Definition at line 392 of file testing.c.
References GNUNET_TESTING_SharedService::cfg, SharedService::cfg, cfg_copy_iterator(), getenv(), GNUNET_array_append, GNUNET_assert, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_iterate_section_values(), GNUNET_DISK_mkdtemp(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_strdup, GNUNET_TESTING_PREFIX, GNUNET_TESTING_system_destroy(), GNUNET_YES, GNUNET_TESTING_System::highport, hostkeys_load(), hostname, GNUNET_TESTING_System::hostname, GNUNET_TESTING_System::lowport, GNUNET_TESTING_System::n_shared_services, GNUNET_TESTING_SharedService::service, GNUNET_TESTING_SharedService::share, SharedService::share, GNUNET_TESTING_System::shared_services, SharedService::sname, GNUNET_TESTING_System::tmppath, and GNUNET_TESTING_System::trusted_ip.
Referenced by GNUNET_TESTING_system_create().
void GNUNET_TESTING_system_destroy | ( | struct GNUNET_TESTING_System * | system, |
int | remove_paths | ||
) |
Free system resources.
system | system to be freed |
remove_paths | should the 'testdir' and all subdirectories be removed (clean up on shutdown)? |
Definition at line 557 of file testing.c.
References SharedService::cfg, cleanup_shared_service_instance(), GNUNET_CONFIGURATION_destroy(), GNUNET_DISK_directory_remove(), GNUNET_free, GNUNET_YES, GNUNET_TESTING_System::hostkeys_data, hostkeys_unload(), GNUNET_TESTING_System::hostname, SharedService::instances, SharedService::n_instances, GNUNET_TESTING_System::n_shared_services, SharedServiceInstance::proc, GNUNET_TESTING_System::shared_services, SharedService::sname, SharedServiceInstance::ss, stop_shared_service_instance(), GNUNET_TESTING_System::tmppath, and GNUNET_TESTING_System::trusted_ip.
Referenced by create_hostkeys(), create_unique_cfgs(), GNUNET_TESTING_service_run(), GNUNET_TESTING_system_create_with_portrange(), GNUNET_TRANSPORT_TESTING_done(), shutdown_task(), and system_destroy_run().
struct GNUNET_CRYPTO_EddsaPrivateKey* GNUNET_TESTING_hostkey_get | ( | const struct GNUNET_TESTING_System * | system, |
uint32_t | key_number, | ||
struct GNUNET_PeerIdentity * | id | ||
) |
Testing includes a number of pre-created hostkeys for faster peer startup.
This function can be used to access the n-th key of those pre-created hostkeys; note that these keys are ONLY useful for testing and not secure as the private keys are part of the public GNUnet source code.
This is primarily a helper function used internally by GNUNET_TESTING_peer_configure().
system | the testing system handle |
key_number | desired pre-created hostkey to obtain |
id | set to the peer's identity (hash of the public key; if NULL, GNUNET_SYSERR is returned immediately |
This function can be used to access the n-th key of those pre-created hostkeys; note that these keys are ONLY useful for testing and not secure as the private keys are part of the public GNUnet source code.
This is primarily a helper function used internally by GNUNET_TESTING_peer_configure.
system | the testing system handle |
key_number | desired pre-created hostkey to obtain |
id | set to the peer's identity (hash of the public key; if NULL, NULL is returned immediately |
Definition at line 732 of file testing.c.
References _, GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_ERROR_TYPE_ERROR, GNUNET_memcpy, GNUNET_new, GNUNET_TESTING_HOSTKEYFILESIZE, GNUNET_TESTING_System::hostkeys_data, id, LOG, and GNUNET_TESTING_System::total_hostkeys.
Referenced by create_hostkeys(), GNUNET_TESTING_get_peer(), GNUNET_TESTING_peer_configure(), and GNUNET_TESTING_peer_get_identity().
uint16_t GNUNET_TESTING_reserve_port | ( | struct GNUNET_TESTING_System * | system | ) |
Reserve a port for a peer.
system | system to use for reservation tracking |
Reserve a port for a peer.
system | system to use for reservation tracking |
Definition at line 598 of file testing.c.
References ai, AI_NUMERICSERV, GNUNET_asprintf(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_NETWORK_socket_bind(), GNUNET_NETWORK_socket_close(), GNUNET_NETWORK_socket_create(), GNUNET_NO, GNUNET_OK, GNUNET_TESTING_System::highport, LOG, GNUNET_TESTING_System::lowport, GNUNET_TESTING_System::reserved_ports, and ret.
Referenced by associate_shared_service(), and update_config().
void GNUNET_TESTING_release_port | ( | struct GNUNET_TESTING_System * | system, |
uint16_t | port | ||
) |
Release reservation of a TCP or UDP port for a peer (used during GNUNET_TESTING_peer_destroy).
system | system to use for reservation tracking |
port | reserved port to release |
Release reservation of a TCP or UDP port for a peer (used during GNUNET_TESTING_peer_destroy).
system | system to use for reservation tracking |
port | reserved port to release |
Definition at line 694 of file testing.c.
References GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, LOG, port, and GNUNET_TESTING_System::reserved_ports.
Referenced by GNUNET_TESTING_peer_destroy().
int GNUNET_TESTING_configuration_create | ( | struct GNUNET_TESTING_System * | system, |
struct GNUNET_CONFIGURATION_Handle * | cfg | ||
) |
Create a new configuration using the given configuration as a template; ports and paths will be modified to select available ports on the local system.
The default configuration will be available in PATHS section under the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PATHS section to the temporary directory specific to this configuration. If we run out of "*port" numbers, return GNUNET_SYSERR.
This is primarily a helper function used internally by GNUNET_TESTING_peer_configure().
system | system to use to coordinate resource usage |
cfg | template configuration to update |
The default configuration will be available in PATHS section under the option DEFAULTCONFIG after the call. GNUNET_HOME is also set in PATHS section to the temporary directory specific to this configuration. If we run out of "*port" numbers, return GNUNET_SYSERR.
This is primarily a helper function used internally by GNUNET_TESTING_peer_configure().
system | system to use to coordinate resource usage |
cfg | template configuration to update |
Definition at line 1167 of file testing.c.
References cfg, GNUNET_TESTING_configuration_create_(), and UpdateContext::system.
Referenced by create_unique_cfgs(), GNUNET_TRANSPORT_TESTING_start_peer(), start_peer_run(), and tokenizer_cb().
struct GNUNET_TESTING_Peer* GNUNET_TESTING_peer_configure | ( | struct GNUNET_TESTING_System * | system, |
struct GNUNET_CONFIGURATION_Handle * | cfg, | ||
uint32_t | key_number, | ||
struct GNUNET_PeerIdentity * | id, | ||
char ** | emsg | ||
) |
Configure a GNUnet peer.
GNUnet must be installed on the local system and available in the PATH.
system | system to use to coordinate resource usage |
cfg | configuration to use; will be UPDATED (to reflect needed changes in port numbers and paths) |
key_number | number of the hostkey to use for the peer |
id | identifier for the daemon, will be set, can be NULL |
emsg | set to freshly allocated error message (set to NULL on success), can be NULL |
Definition at line 1188 of file testing.c.
References _, associate_shared_service(), cfg, GNUNET_DISK_FileHandle::fd, GNUNET_asprintf(), GNUNET_assert, GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_have_value(), GNUNET_CONFIGURATION_remove_section(), GNUNET_CONFIGURATION_write(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_new_array, GNUNET_NO, GNUNET_OK, GNUNET_OS_get_libexec_binary_path(), GNUNET_strdup, GNUNET_SYSERR, GNUNET_TESTING_configuration_create_(), GNUNET_TESTING_hostkey_get(), GNUNET_TESTING_HOSTKEYFILESIZE, GNUNET_TESTING_System::hostkeys_data, GNUNET_TESTING_System::n_shared_services, peer, pk, GNUNET_TESTING_System::shared_services, SharedService::sname, SharedServiceInstance::ss, and GNUNET_TESTING_System::total_hostkeys.
Referenced by GNUNET_TESTING_service_run(), GNUNET_TRANSPORT_TESTING_start_peer(), handle_peer_create(), start_peer_run(), and update_peer_config().
void GNUNET_TESTING_peer_get_identity | ( | struct GNUNET_TESTING_Peer * | peer, |
struct GNUNET_PeerIdentity * | id | ||
) |
Obtain the peer identity from a peer handle.
peer | peer handle for which we want the peer's identity |
id | identifier for the daemon, will be set |
Definition at line 1359 of file testing.c.
References GNUNET_free_nz, GNUNET_memcpy, GNUNET_new, GNUNET_TESTING_hostkey_get(), and peer.
Referenced by GNUNET_TRANSPORT_TESTING_start_peer(), handle_overlay_connect(), handle_peer_get_config(), handle_remote_overlay_connect(), and start_peer_run().
int GNUNET_TESTING_peer_start | ( | struct GNUNET_TESTING_Peer * | peer | ) |
Start the peer.
peer | peer to start |
Definition at line 1381 of file testing.c.
References _, GNUNET_assert, GNUNET_break, GNUNET_CONFIGURATION_expand_dollar(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, GNUNET_OS_start_process_s(), GNUNET_SYSERR, SharedServiceInstance::n_refs, peer, and start_shared_service_instance().
Referenced by GNUNET_TESTING_service_run(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_start_peer(), start_peer(), start_peer_run(), and stdin_cb().
int GNUNET_TESTING_peer_stop | ( | struct GNUNET_TESTING_Peer * | peer | ) |
Stop the peer.
This call is blocking as it kills the peer's main ARM process by sending a SIGTERM and waits on it. For asynchronous shutdown of peer, see GNUNET_TESTING_peer_stop_async().
peer | peer to stop |
peer | peer to stop |
Definition at line 1485 of file testing.c.
References GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_peer_kill(), GNUNET_TESTING_peer_wait(), and peer.
Referenced by GNUNET_TESTING_peer_destroy(), GNUNET_TESTING_service_run(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), GST_destroy_peer(), stdin_cb(), and stop_peer_run().
void GNUNET_TESTING_peer_destroy | ( | struct GNUNET_TESTING_Peer * | peer | ) |
Destroy the peer.
Releases resources locked during peer configuration. If the peer is still running, it will be stopped AND a warning will be printed (users of the API should stop the peer explicitly first).
peer | peer to destroy |
Definition at line 1566 of file testing.c.
References GNUNET_ARM_disconnect(), GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_TESTING_peer_stop(), GNUNET_TESTING_release_port(), and peer.
Referenced by GNUNET_TESTING_service_run(), GNUNET_TRANSPORT_TESTING_stop_peer(), GST_destroy_peer(), GST_destroy_peers(), stop_peer_run(), and update_peer_config().
int GNUNET_TESTING_peer_kill | ( | struct GNUNET_TESTING_Peer * | peer | ) |
Sends SIGTERM to the peer's main process.
peer | the handle to the peer |
Definition at line 1430 of file testing.c.
References GNUNET_assert, GNUNET_break, GNUNET_OK, GNUNET_OS_process_kill(), GNUNET_SYSERR, GNUNET_TERM_SIG, SharedServiceInstance::n_refs, peer, and stop_shared_service_instance().
Referenced by disconn_status(), GNUNET_TESTING_peer_stop(), GST_destroy_peers(), and stop_peer().
int GNUNET_TESTING_peer_wait | ( | struct GNUNET_TESTING_Peer * | peer | ) |
Waits for a peer to terminate.
The peer's main process will also be destroyed.
peer | the handle to the peer |
Definition at line 1462 of file testing.c.
References GNUNET_break, GNUNET_OS_process_destroy(), GNUNET_OS_process_wait(), GNUNET_SYSERR, peer, and ret.
Referenced by disconn_status(), GNUNET_TESTING_peer_stop(), GST_destroy_peers(), and handle_peer_stop().
int GNUNET_TESTING_peer_stop_async | ( | struct GNUNET_TESTING_Peer * | peer, |
GNUNET_TESTING_PeerStopCallback | cb, | ||
void * | cb_cls | ||
) |
Stop a peer asynchronously using ARM API.
Peer's shutdown is signaled through the GNUNET_TESTING_PeerStopCallback().
peer | the peer to stop |
cb | the callback to signal peer shutdown |
cb_cls | closure for the cb |
Definition at line 1525 of file testing.c.
References GNUNET_TESTING_Peer::cb, GNUNET_TESTING_Peer::cb_cls, disconn_status(), GNUNET_ARM_connect(), GNUNET_OK, GNUNET_SYSERR, and peer.
Referenced by handle_peer_reconfigure().
void GNUNET_TESTING_peer_stop_async_cancel | ( | struct GNUNET_TESTING_Peer * | peer | ) |
Cancel a previous asynchronous peer stop request.
GNUNET_TESTING_peer_stop_async() should have been called before on the given peer. It is an error to call this function if the peer stop callback was already called
peer | the peer on which GNUNET_TESTING_peer_stop_async() was called before. |
Definition at line 1550 of file testing.c.
References GNUNET_ARM_disconnect(), GNUNET_assert, and peer.
Referenced by cleanup_prc().
int GNUNET_TESTING_peer_run | ( | const char * | testdir, |
const char * | cfgfilename, | ||
GNUNET_TESTING_TestMain | tm, | ||
void * | tm_cls | ||
) |
Start a single peer and run a test using the testing library.
Starts a peer using the given configuration and then invokes the given callback. This function ALSO initializes the scheduler loop and should thus be called directly from "main". The testcase should self-terminate by invoking GNUNET_SCHEDULER_shutdown().
testdir | only the directory name without any path. This is used for all service homes; the directory will be created in a temporary location depending on the underlying OS |
cfgfilename | name of the configuration file to use; use NULL to only run with defaults |
tm | main function of the testcase |
tm_cls | closure for tm |
Definition at line 1592 of file testing.c.
References GNUNET_TESTING_service_run().
Referenced by pre_run().
int GNUNET_TESTING_service_run | ( | const char * | testdir, |
const char * | service_name, | ||
const char * | cfgfilename, | ||
GNUNET_TESTING_TestMain | tm, | ||
void * | tm_cls | ||
) |
Start a single service (no ARM, except of course if the given service name is 'arm') and run a test using the testing library.
Starts a service using the given configuration and then invokes the given callback. This function ALSO initializes the scheduler loop and should thus be called directly from "main". The testcase should self-terminate by invoking GNUNET_SCHEDULER_shutdown().
This function is useful if the testcase is for a single service and if that service doesn't itself depend on other services.
testdir | only the directory name without any path. This is used for all service homes; the directory will be created in a temporary location depending on the underlying OS |
service_name | name of the service to run |
cfgfilename | name of the configuration file to use; use NULL to only run with defaults |
tm | main function of the testcase |
tm_cls | closure for tm |
Definition at line 1643 of file testing.c.
References _, cfg, GNUNET_asprintf(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_load(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log_setup(), GNUNET_OK, GNUNET_OS_get_libexec_binary_path(), GNUNET_SCHEDULER_run(), GNUNET_strdup, GNUNET_SYSERR, GNUNET_TESTING_peer_configure(), GNUNET_TESTING_peer_destroy(), GNUNET_TESTING_peer_start(), GNUNET_TESTING_peer_stop(), GNUNET_TESTING_system_create(), GNUNET_TESTING_system_destroy(), GNUNET_YES, hostkeys_unload(), LOG, peer, sc, service_name, and service_run_main().
Referenced by GNUNET_TESTING_peer_run(), and run_no_scheduler().