unbound  0.1
Macros | Functions | Variables
testbound.c File Reference

Exits with code 1 on a failure. More...

#include "config.h"
#include "testcode/ldns-testpkts.h"
#include "testcode/replay.h"
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "util/config_file.h"
#include "daemon/unbound.c"

Macros

#define unbound_testbound   1
 signal that this is a testbound compile
#define main   daemon_main
 include the main program from the unbound daemon.
#define MAX_LINE_LEN   1024
 maximum line length for lines in the replay file.
#define MAXARG   100
 Max number of arguments to pass to unbound.

Functions

static void testbound_usage ()
 give commandline usage for testbound.
static void add_opts (const char *args, int *pass_argc, char *pass_argv[])
 Add options from string to passed argc.
static void echo_cmdline (int argc, char *argv[])
 pretty print commandline for unbound in this test
static void spool_auto_file (FILE *in, int *lineno, FILE *cfg, char *id)
 spool autotrust file
static void setup_config (FILE *in, int *lineno, int *pass_argc, char *pass_argv[])
 process config elements
static struct replay_scenariosetup_playback (const char *filename, int *pass_argc, char *pass_argv[])
 read playback file
void remove_configfile (void)
 remove config file at exit
int main (int argc, char *argv[])
 Main fake event test program.
struct listen_portdaemon_remote_open_ports (struct config_file *ATTR_UNUSED(cfg))
struct daemon_remotedaemon_remote_create (struct config_file *ATTR_UNUSED(cfg))
void daemon_remote_delete (struct daemon_remote *rc)
 remote control state to delete.
void daemon_remote_clear (struct daemon_remote *ATTR_UNUSED(rc))
int daemon_remote_open_accept (struct daemon_remote *ATTR_UNUSED(rc), struct listen_port *ATTR_UNUSED(ports), struct worker *ATTR_UNUSED(worker))
int remote_accept_callback (struct comm_point *ATTR_UNUSED(c), void *ATTR_UNUSED(arg), int ATTR_UNUSED(error), struct comm_reply *ATTR_UNUSED(repinfo))
int remote_control_callback (struct comm_point *ATTR_UNUSED(c), void *ATTR_UNUSED(arg), int ATTR_UNUSED(error), struct comm_reply *ATTR_UNUSED(repinfo))
void remote_get_opt_ssl (char *ATTR_UNUSED(str), void *ATTR_UNUSED(arg))
void wsvc_command_option (const char *ATTR_UNUSED(wopt), const char *ATTR_UNUSED(cfgfile), int ATTR_UNUSED(v), int ATTR_UNUSED(c))
void wsvc_setup_worker (struct worker *ATTR_UNUSED(worker))
void wsvc_desetup_worker (struct worker *ATTR_UNUSED(worker))

Variables

static struct config_strlistcfgfiles = NULL
 config files (removed at exit)

Detailed Description

Exits with code 1 on a failure.

0 if all unit tests are successfull.

Macro Definition Documentation

#define main   daemon_main

include the main program from the unbound daemon.

rename main to daemon_main to call it

#define MAX_LINE_LEN   1024

maximum line length for lines in the replay file.

Referenced by setup_config(), and spool_auto_file().

#define MAXARG   100

Max number of arguments to pass to unbound.

Referenced by add_opts(), and main().

Function Documentation

static void testbound_usage ( )
static

give commandline usage for testbound.

Referenced by main().

static void add_opts ( const char *  args,
int *  pass_argc,
char *  pass_argv[] 
)
static

Add options from string to passed argc.

splits on whitespace.

Parameters
args,:the option argument, "-v -p 12345" or so.
pass_argc,:ptr to the argc for unbound. Modified.
pass_argv,:the argv to pass to unbound. Modified.

References fatal_exit(), and MAXARG.

Referenced by main(), and setup_config().

int main ( int  argc,
char *  argv[] 
)

Main fake event test program.

Setup, teardown and report errors.

Parameters
argc,:arg count.
argv,:array of commandline arguments.
Returns
program failure if test fails.

References add_opts(), echo_cmdline(), fake_event_cleanup(), fake_event_init(), fatal_exit(), log_info(), log_init(), MAXARG, optarg, optind, remove_configfile(), setup_playback(), testbound_selftest(), and testbound_usage().

void daemon_remote_delete ( struct daemon_remote rc)

remote control state to delete.

Parameters
rc,:state to delete.

References daemon_remote::ctx, and daemon_remote_clear().