testbound.c File Reference

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

#include "config.h"
#include <ctype.h>
#include "testcode/testpkts.h"
#include "testcode/replay.h"
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "libunbound/worker.h"
#include "util/config_file.h"
#include "sldns/keyraw.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.
 
#define MAXARG   100
 Max number of arguments to pass to unbound.
 

Functions

int daemon_main (int argc, char *argv[])
 renamed main routine
 
static void testbound_usage (void)
 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. More...
 
static void echo_cmdline (int argc, char *argv[])
 pretty print commandline for unbound in this test
 
static void spool_temp_file_name (int *lineno, FILE *cfg, char *id)
 spool temp file name
 
static void spool_temp_file (FILE *in, int *lineno, char *id)
 spool temp file
 
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
 
static 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))
 
int tcp_connect_errno_needs_log (struct sockaddr *ATTR_UNUSED(addr), socklen_t ATTR_UNUSED(addrlen))
 
int squelch_err_ssl_handshake (unsigned long ATTR_UNUSED(err))
 
void listen_setup_locks (void)
 setup the locks for the listen ports
 
void listen_desetup_locks (void)
 desetup the locks for the listen ports
 

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

Function Documentation

◆ 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_get_lock(), 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.