OpenVPN
Functions | Variables
mock_msg.c File Reference
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <stdint.h>
#include <cmocka.h>
#include "errlevel.h"
#include "error.h"
#include "mock_msg.h"
Include dependency graph for mock_msg.c:

Go to the source code of this file.

Functions

void mock_set_debug_level (int level)
 Mock debug level defaults to 0, which gives clean(-ish) test reports.
 
int mock_get_debug_level (void)
 
void mock_set_print_debug_level (int level)
 
int get_debug_level (void)
 
void x_msg_va (const unsigned int flags, const char *format, va_list arglist)
 
void x_msg (const unsigned int flags, const char *format,...)
 
void assert_failed (const char *filename, int line, const char *condition)
 
void out_of_memory (void)
 
bool dont_mute (unsigned int flags)
 Check muting filter.
 

Variables

unsigned int x_debug_level = 0
 
unsigned int print_x_debug_level = 0
 
bool fatal_error_triggered = false
 
char mock_msg_buf [MOCK_MSG_BUF]
 

Function Documentation

◆ assert_failed()

void assert_failed ( const char *  filename,
int  line,
const char *  condition 
)

Definition at line 105 of file mock_msg.c.

◆ dont_mute()

bool dont_mute ( unsigned int  flags)

Check muting filter.

Definition at line 133 of file mock_msg.c.

Referenced by msg_test().

◆ get_debug_level()

int get_debug_level ( void  )

Definition at line 69 of file mock_msg.c.

References x_debug_level.

◆ mock_get_debug_level()

int mock_get_debug_level ( void  )

Definition at line 57 of file mock_msg.c.

References x_debug_level.

Referenced by test_atoi_variants().

◆ mock_set_debug_level()

void mock_set_debug_level ( int  level)

Mock debug level defaults to 0, which gives clean(-ish) test reports.

Call this function from your test driver to increase debug output when you need debug output.

Definition at line 51 of file mock_msg.c.

References x_debug_level.

Referenced by test_atoi_variants().

◆ mock_set_print_debug_level()

void mock_set_print_debug_level ( int  level)

Definition at line 63 of file mock_msg.c.

References print_x_debug_level.

◆ out_of_memory()

void out_of_memory ( void  )

Definition at line 126 of file mock_msg.c.

◆ x_msg()

void x_msg ( const unsigned int  flags,
const char *  format,
  ... 
)

Definition at line 94 of file mock_msg.c.

References x_msg_va().

◆ x_msg_va()

void x_msg_va ( const unsigned int  flags,
const char *  format,
va_list  arglist 
)

Definition at line 75 of file mock_msg.c.

References CLEAR, fatal_error_triggered, M_DEBUG_LEVEL, M_FATAL, mock_msg_buf, and print_x_debug_level.

Referenced by x_msg().

Variable Documentation

◆ fatal_error_triggered

bool fatal_error_triggered = false

Definition at line 45 of file mock_msg.c.

Referenced by x_msg_va().

◆ mock_msg_buf

char mock_msg_buf[MOCK_MSG_BUF]

Definition at line 47 of file mock_msg.c.

Referenced by test_atoi_variants(), and x_msg_va().

◆ print_x_debug_level

unsigned int print_x_debug_level = 0

Definition at line 43 of file mock_msg.c.

Referenced by mock_set_print_debug_level(), and x_msg_va().

◆ x_debug_level

unsigned int x_debug_level = 0