nfs-ganesha 1.4
Defines | Functions

test_liblog_functions.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "log.h"

Go to the source code of this file.

Defines

#define TRUE   1
#define FALSE   0
#define ERR_DUMMY   3
#define ERR_DUMMY_1   0
#define ERR_DUMMY_2   1
#define TestFormat(format, args...)
#define TestGaneshaFormat(expect, compare, format, args...)
#define NB_THREADS   20

Functions

void TestAlways (int expect, char *buff, log_components_t component, char *string)
void TestMajor (int expect, char *buff, log_components_t component, char *string)
void TestCrit (int expect, char *buff, log_components_t component, char *string)
void TestEvent (int expect, char *buff, log_components_t component, char *string)
void TestDebug (int expect, char *buff, log_components_t component, char *string)
void TestFullDebug (int expect, char *buff, log_components_t component, char *string)
void Test1 (char *str, char *file)
void Test2 ()
void run_Tests (int all, char *arg, char *str, char *file)
void * run_MT_Tests (void *arg)
int main (int argc, char *argv[])

Define Documentation

#define ERR_DUMMY   3

Definition at line 47 of file test_liblog_functions.c.

#define ERR_DUMMY_1   0
#define ERR_DUMMY_2   1
#define FALSE   0

Definition at line 44 of file test_liblog_functions.c.

#define NB_THREADS   20

Definition at line 468 of file test_liblog_functions.c.

#define TestFormat (   format,
  args... 
)
Value:
do {                                                  \
    char compare[2048], buff[2048];                     \
    sprintf(compare, format, ## args);                  \
    log_snprintf(buff, 2048, format, ## args);          \
    if (strcmp(compare, buff) != 0)                     \
      {                                                 \
        LogTest("FAILURE: %s produced \"%s\" expected \"%s\"",  \
                format, buff, compare);                 \
        exit(1);                                        \
      }                                                 \
    else                                                \
      LogTest("SUCCESS: %s produced \"%s\"", format, buff); \
  } while (0)

Definition at line 163 of file test_liblog_functions.c.

#define TestGaneshaFormat (   expect,
  compare,
  format,
  args... 
)
Value:
do {                                                  \
    char buff[2048];                                    \
    log_snprintf(buff, 2048, format, ## args);          \
    if (strcmp(compare, buff) != 0 && expect)           \
      {                                                 \
        LogTest("FAILURE: %s produced \"%s\" expected \"%s\"",  \
                format, buff, compare);                 \
        exit(1);                                        \
      }                                                 \
    else if (expect)                                    \
      LogTest("SUCCESS: %s produced \"%s\"", format, buff); \
    else                                                \
      LogTest("FAILURE (EXPECTED):  %s produced \"%s\"", format, buff); \
  } while (0)

Definition at line 178 of file test_liblog_functions.c.

#define TRUE   1

Definition at line 41 of file test_liblog_functions.c.


Function Documentation

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

Definition at line 470 of file test_liblog_functions.c.

void* run_MT_Tests ( void *  arg)

Definition at line 459 of file test_liblog_functions.c.

void run_Tests ( int  all,
char *  arg,
char *  str,
char *  file 
)

Definition at line 448 of file test_liblog_functions.c.

void Test1 ( char *  str,
char *  file 
)

Tests about Log streams and special printf functions.

Definition at line 197 of file test_liblog_functions.c.

void Test2 ( )

Definition at line 343 of file test_liblog_functions.c.

void TestAlways ( int  expect,
char *  buff,
log_components_t  component,
char *  string 
)

Definition at line 57 of file test_liblog_functions.c.

void TestCrit ( int  expect,
char *  buff,
log_components_t  component,
char *  string 
)

Definition at line 90 of file test_liblog_functions.c.

void TestDebug ( int  expect,
char *  buff,
log_components_t  component,
char *  string 
)

Definition at line 126 of file test_liblog_functions.c.

void TestEvent ( int  expect,
char *  buff,
log_components_t  component,
char *  string 
)

Definition at line 108 of file test_liblog_functions.c.

void TestFullDebug ( int  expect,
char *  buff,
log_components_t  component,
char *  string 
)

Definition at line 145 of file test_liblog_functions.c.

void TestMajor ( int  expect,
char *  buff,
log_components_t  component,
char *  string 
)

Definition at line 72 of file test_liblog_functions.c.