[Nagios-devel] [PATCH 1/6] test: Make test_timeperiods functional

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

[Nagios-devel] [PATCH 1/6] test: Make test_timeperiods functional

Postby Guest » Mon May 06, 2013 3:21 pm

I intend to refactor the time periods, and need a bit of encouragement
from something that tells me that everything is OK.

Signed-off-by: Robin Sonefors
---
base/utils.c | 2 +-
t-tap/Makefile.in | 8 +-
t-tap/test_timeperiods.c | 196 ++---------------------------------------------
3 files changed, 13 insertions(+), 193 deletions(-)

diff --git a/base/utils.c b/base/utils.c
index 44cf98d..73ac13b 100644
--- a/base/utils.c
+++ b/base/utils.c
@@ -991,7 +991,7 @@ int check_time_against_period(time_t test_time, timeperiod *tperiod) {
/*#define TEST_TIMEPERIODS_B 1*/

/* Separate this out from public get_next_valid_time for testing, so we can mock current_time */
-static void _get_next_valid_time(time_t pref_time, time_t current_time, time_t *valid_time, timeperiod *tperiod) {
+void _get_next_valid_time(time_t pref_time, time_t current_time, time_t *valid_time, timeperiod *tperiod) {
time_t preferred_time = (time_t)0L;
timerange *temp_timerange;
daterange *temp_daterange;
diff --git a/t-tap/Makefile.in b/t-tap/Makefile.in
index f686d99..3079ee0 100644
--- a/t-tap/Makefile.in
+++ b/t-tap/Makefile.in
@@ -10,7 +10,7 @@ SRC_CGI=../cgi
SRC_COMMON=../common

CC=@CC@
-CFLAGS=@CFLAGS@ @DEFS@ -DNSCORE -I../include -I../tap/src
+CFLAGS=@CFLAGS@ @DEFS@ -DNSCORE -I../include -I../tap/src -I..

TESTS = test_logging test_events test_timeperiods test_nagios_config
TESTS += test_xsddefault
@@ -22,11 +22,11 @@ TESTS += test_downtime
XSD_OBJS = $(SRC_CGI)/statusdata-cgi.o $(SRC_CGI)/xstatusdata-cgi.o
XSD_OBJS += $(SRC_CGI)/objects-cgi.o $(SRC_CGI)/xobjects-cgi.o
XSD_OBJS += $(SRC_CGI)/comments-cgi.o $(SRC_CGI)/downtime-cgi.o
-XSD_OBJS += $(SRC_CGI)/cgiutils.o $(SRC_CGI)/skiplist.o ../common/shared.o
+XSD_OBJS += $(SRC_CGI)/cgiutils.o ../common/shared.o

TP_OBJS = $(SRC_BASE)/utils.o $(SRC_BASE)/config.o $(SRC_BASE)/macros-base.o
TP_OBJS += $(SRC_BASE)/objects-base.o $(SRC_BASE)/xobjects-base.o
-TP_OBJS += $(SRC_BASE)/skiplist.o ../common/shared.o
+TP_OBJS += ../common/shared.o

CFG_OBJS = $(TP_OBJS)
CFG_OBJS += $(SRC_BASE)/comments-base.o $(SRC_BASE)/xcomments-base.o
@@ -35,7 +35,7 @@ CFG_OBJS += $(SRC_BASE)/retention-base.o $(SRC_BASE)/xretention-base.o


LDFLAGS=@LDFLAGS@
-LIBS=@LIBS@
+LIBS=@LIBS@ ../lib/libnagios.a

prefix=@prefix@
exec_prefix=@exec_prefix@
diff --git a/t-tap/test_timeperiods.c b/t-tap/test_timeperiods.c
index 534ece1..9663231 100644
--- a/t-tap/test_timeperiods.c
+++ b/t-tap/test_timeperiods.c
@@ -43,191 +43,6 @@
#include "../include/nebmodules.h"
#include "tap.h"

-char *config_file = NULL;
-char *log_file = NULL;
-char *command_file = NULL;
-char *temp_file = NULL;
-char *temp_path = NULL;
-char *check_result_path = NULL;
-char *lock_file = NULL;
-char *log_archive_path = NULL;
-char *nagios_user = NULL;
-char *nagios_group = NULL;
-
-extern char *macro_x[MACRO_X_COUNT];
-
-char *global_host_event_handler = NULL;
-char *global_service_event_handler = NULL;
-command *global_host_event_handler_ptr = NULL;
-command *global_service_event_handler_ptr = NULL;
-
-char *ocsp_command = NULL;
-char *ochp_command = NULL;
-command *ocsp_command_ptr = NULL;
-command *ochp_command_ptr = NULL;
-
-char *illegal_object_chars = NULL;
-char *illegal_output_chars = NULL;
-
-int use_regexp_matches = FALSE;
-int use_true_regexp_matching = FALSE;
-
-int use_syslog = DEFAULT_USE_SYSLOG;
-int log_notifications = DEFAULT_NOTIFICATION_LOGGING;
-int log_service_retries = DEFAULT_LOG_SERVICE_RETRIES;
-int log_host_retries = DEFAULT_LOG_HOST_RETRIES;
-int log_event_handlers = DEFAULT_LOG_EVENT_HANDLERS;
-int log_initial_states = DEFAULT_LOG_INITIAL_STATES;
-int log_external_commands = DEFAULT_LOG_EXTERNAL_COMMANDS;
-int log_passive_checks = DEFAULT_LOG_PASSIVE_CHECKS;
-
-unsigned long logging_options = 0;
-

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: robin.sonefors@op5.com
Guest
 

Return to Community Support

Who is online

Users browsing this forum: No registered users and 36 guests