Macros | Functions | Variables
testbound.c File Reference

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

#include "config.h"
#include "testcode/testpkts.h"
#include "testcode/replay.h"
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "util/config_file.h"
#include "sldns/keyraw.h"
#include <ctype.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. More...
 
#define MAX_LINE_LEN   1024
 maximum line length for lines in the replay file. More...
 
#define MAXARG   100
 Max number of arguments to pass to unbound. More...
 

Functions

static void testbound_usage (void)
 give commandline usage for testbound. More...
 
static void add_opts (const char *args, int *pass_argc, char *pass_argv[])
 Add options from string to passed argc. More...
 
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. More...
 
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. More...
 
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 successful.

Macro Definition Documentation

◆ main

#define main   daemon_main

include the main program from the unbound daemon.

rename main to daemon_main to call it

Referenced by hashlittle().

◆ MAX_LINE_LEN

#define MAX_LINE_LEN   1024

maximum line length for lines in the replay file.

Referenced by setup_config(), and spool_auto_file().

◆ MAXARG

#define MAXARG   100

Max number of arguments to pass to unbound.

Referenced by add_opts(), and main().

Function Documentation

◆ testbound_usage()

static void testbound_usage ( void  )
static

give commandline usage for testbound.

Referenced by main().

◆ add_opts()

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
argsthe option argument, "-v -p 12345" or so.
pass_argcptr to the argc for unbound. Modified.
pass_argvthe argv to pass to unbound. Modified.

References MAXARG.

Referenced by main(), and setup_config().

◆ main()

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

Main fake event test program.

Setup, teardown and report errors.

Parameters
argcarg count.
argvarray of commandline arguments.
Returns
program failure if test fails.

References add_opts(), log_info(), log_init(), MAXARG, optarg, optind, remove_configfile(), testbound_selftest(), and testbound_usage().

◆ daemon_remote_delete()

void daemon_remote_delete ( struct daemon_remote rc)

remote control state to delete.

Parameters
rcstate to delete.

References daemon_remote_clear().