syslog-ng source
test_logwriter.c File Reference
#include <criterion/criterion.h>
#include "logwriter.h"
#include "logmsg/logmsg.h"
#include "template/templates.h"
#include "apphook.h"
#include "cfg.h"
#include "plugin.h"
#include "logqueue-fifo.h"
#include "timeutils/cache.h"
#include "msg-format.h"
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iv.h>
Include dependency graph for test_logwriter.c:

Classes

struct  LogWriterTestCase
 

Functions

LogMessage * init_msg (const gchar *msg_string, gboolean use_syslog_protocol)
 
void _tear_down (LogWriter *writer, LogMessage *msg, LogQueue *queue, GString *result_msg, LogWriterOptions *writer_options)
 
void _assert_logwriter_output (LogWriterTestCase c)
 
 Test (logwriter, test_logwriter)
 

Variables

MsgFormatOptions parse_options
 
const gchar * MSG_SYSLOG_STR
 
const gchar * EXPECTED_MSG_SYSLOG_STR
 
const gchar * EXPECTED_MSG_SYSLOG_STR_T
 
const gchar * EXPECTED_MSG_SYSLOG_STR_T_TRUNCATE
 
const gchar * EXPECTED_MSG_SYSLOG_TO_BSD_STR
 
const gchar * EXPECTED_MSG_SYSLOG_TO_FILE_STR
 
const gchar * MSG_SYSLOG_EMPTY_STR
 
const gchar * EXPECTED_MSG_SYSLOG_EMPTY_STR
 
const gchar * EXPECTED_MSG_SYSLOG_EMPTY_STR_T
 
const gchar * MSG_BSD_STR = "<155>2006-02-11T10:34:56+01:00 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép"
 
const gchar * EXPECTED_MSG_BSD_STR = "Feb 11 10:34:56 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép\n"
 
const gchar * EXPECTED_MSG_BSD_STR_TRUNCATE = "Feb 11 10:34:56 bzorp syslog-ng[23323]:"
 
const gchar * EXPECTED_MSG_BSD_STR_T = "155 23323 árvíztűrőtükörfúrógép"
 
const gchar * EXPECTED_MSG_BSD_STR_T_TRUNCATE = "155 23323 árvíztűrő"
 
const gchar * EXPECTED_MSG_BSD_TO_SYSLOG_STR
 
const gchar * EXPECTED_MSG_BSD_TO_PROTO_STR
 
const gchar * EXPECTED_MSG_BSD_TO_PROTO_STR_TRUNCATE = "<155>Feb 11 10:34:56 bz"
 
const gchar * MSG_ZERO_PRI = "<0>2006-02-11T10:34:56+01:00 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép"
 
const gchar * EXPECTED_MSG_ZERO_PRI_STR = "<0>Feb 11 10:34:56 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép\n"
 
const gchar * EXPECTED_MSG_ZERO_PRI_STR_T = "0"
 
const gchar * MSG_BSD_EMPTY_STR = "<155>2006-02-11T10:34:56+01:00 bzorp syslog-ng[23323]:"
 
const gchar * EXPECTED_MSG_BSD_EMPTY_STR = "<155>Feb 11 10:34:56 bzorp syslog-ng[23323]:\n"
 
const gchar * EXPECTED_MSG_BSD_EMPTY_STR_T = "23323"
 

Function Documentation

◆ _assert_logwriter_output()

void _assert_logwriter_output ( LogWriterTestCase  c)

◆ _tear_down()

void _tear_down ( LogWriter *  writer,
LogMessage *  msg,
LogQueue *  queue,
GString *  result_msg,
LogWriterOptions writer_options 
)

◆ init_msg()

LogMessage* init_msg ( const gchar *  msg_string,
gboolean  use_syslog_protocol 
)

◆ Test()

Test ( logwriter  ,
test_logwriter   
)

Variable Documentation

◆ EXPECTED_MSG_BSD_EMPTY_STR

const gchar* EXPECTED_MSG_BSD_EMPTY_STR = "<155>Feb 11 10:34:56 bzorp syslog-ng[23323]:\n"

◆ EXPECTED_MSG_BSD_EMPTY_STR_T

const gchar* EXPECTED_MSG_BSD_EMPTY_STR_T = "23323"

◆ EXPECTED_MSG_BSD_STR

const gchar* EXPECTED_MSG_BSD_STR = "Feb 11 10:34:56 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép\n"

◆ EXPECTED_MSG_BSD_STR_T

const gchar* EXPECTED_MSG_BSD_STR_T = "155 23323 árvíztűrőtükörfúrógép"

◆ EXPECTED_MSG_BSD_STR_T_TRUNCATE

const gchar* EXPECTED_MSG_BSD_STR_T_TRUNCATE = "155 23323 árvíztűrő"

◆ EXPECTED_MSG_BSD_STR_TRUNCATE

const gchar* EXPECTED_MSG_BSD_STR_TRUNCATE = "Feb 11 10:34:56 bzorp syslog-ng[23323]:"

◆ EXPECTED_MSG_BSD_TO_PROTO_STR

const gchar* EXPECTED_MSG_BSD_TO_PROTO_STR
Initial value:
=
"<155>Feb 11 10:34:56 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép\n"

◆ EXPECTED_MSG_BSD_TO_PROTO_STR_TRUNCATE

const gchar* EXPECTED_MSG_BSD_TO_PROTO_STR_TRUNCATE = "<155>Feb 11 10:34:56 bz"

◆ EXPECTED_MSG_BSD_TO_SYSLOG_STR

const gchar* EXPECTED_MSG_BSD_TO_SYSLOG_STR
Initial value:
=
"<155>1 2006-02-11T10:34:56+01:00 bzorp syslog-ng 23323 - - árvíztűrőtükörfúrógép\n"

◆ EXPECTED_MSG_SYSLOG_EMPTY_STR

const gchar* EXPECTED_MSG_SYSLOG_EMPTY_STR
Initial value:
=
"<132>1 2006-10-29T01:59:59+01:00 mymachine evntslog 3535 ID47 "
"[exampleSDID@0 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@0 class=\"high\"] \n"

◆ EXPECTED_MSG_SYSLOG_EMPTY_STR_T

const gchar* EXPECTED_MSG_SYSLOG_EMPTY_STR_T
Initial value:
=
"<132>1 2006-10-29T01:59:59+01:00 mymachine evntslog 3535 ID47 "
"[exampleSDID@0 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@0 class=\"high\"] ID47\n"

◆ EXPECTED_MSG_SYSLOG_STR

const gchar* EXPECTED_MSG_SYSLOG_STR
Initial value:
=
"<132>1 2006-10-29T01:59:59+01:00 mymachine evntslog 3535 ID47 [exampleSDID@0 iut=\"3\" eventSource=\"Application\" "
"eventID=\"1011\"][examplePriority@0 class=\"high\"] BOMAn application event log entry...\n"

◆ EXPECTED_MSG_SYSLOG_STR_T

const gchar* EXPECTED_MSG_SYSLOG_STR_T
Initial value:
=
"<132>1 2006-10-29T01:59:59+01:00 mymachine evntslog 3535 ID47 [exampleSDID@0 iut=\"3\" eventSource=\"Application\" "
"eventID=\"1011\"][examplePriority@0 class=\"high\"] ID47 BOMAn application event log entry...\n"

◆ EXPECTED_MSG_SYSLOG_STR_T_TRUNCATE

const gchar* EXPECTED_MSG_SYSLOG_STR_T_TRUNCATE
Initial value:
=
"<132>1 2006-10-29T01:59:59+01:00 mymachine evntslog 3535 ID47"

◆ EXPECTED_MSG_SYSLOG_TO_BSD_STR

const gchar* EXPECTED_MSG_SYSLOG_TO_BSD_STR
Initial value:
=
"<132>Oct 29 01:59:59 mymachine evntslog[3535]: BOMAn application event log entry...\n"

◆ EXPECTED_MSG_SYSLOG_TO_FILE_STR

const gchar* EXPECTED_MSG_SYSLOG_TO_FILE_STR
Initial value:
=
"Oct 29 01:59:59 mymachine evntslog[3535]: BOMAn application event log entry...\n"

◆ EXPECTED_MSG_ZERO_PRI_STR

const gchar* EXPECTED_MSG_ZERO_PRI_STR = "<0>Feb 11 10:34:56 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép\n"

◆ EXPECTED_MSG_ZERO_PRI_STR_T

const gchar* EXPECTED_MSG_ZERO_PRI_STR_T = "0"

◆ MSG_BSD_EMPTY_STR

const gchar* MSG_BSD_EMPTY_STR = "<155>2006-02-11T10:34:56+01:00 bzorp syslog-ng[23323]:"

◆ MSG_BSD_STR

const gchar* MSG_BSD_STR = "<155>2006-02-11T10:34:56+01:00 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép"

◆ MSG_SYSLOG_EMPTY_STR

const gchar* MSG_SYSLOG_EMPTY_STR
Initial value:
=
"<132>1 2006-10-29T01:59:59.156+01:00 mymachine evntslog 3535 ID47 [exampleSDID@0 "
"iut=\"3\" eventSource=\"Application\" eventID=\"1011\"][examplePriority@0 class=\"high\"]"

◆ MSG_SYSLOG_STR

const gchar* MSG_SYSLOG_STR
Initial value:
=
"<132>1 2006-10-29T01:59:59.156+01:00 mymachine evntslog 3535 ID47 [exampleSDID@0 iut=\"3\" "
"eventSource=\"Application\" eventID=\"1011\"][examplePriority@0 class=\"high\"] BOMAn application event log entry..."

◆ MSG_ZERO_PRI

const gchar* MSG_ZERO_PRI = "<0>2006-02-11T10:34:56+01:00 bzorp syslog-ng[23323]:árvíztűrőtükörfúrógép"

◆ parse_options

MsgFormatOptions parse_options