Motr  M0
validation.c File Reference
#include <glob.h>
#include "conf/validation.h"
#include "conf/ut/common.h"
#include "lib/fs.h"
#include "lib/string.h"
#include "lib/memory.h"
#include "ut/ut.h"
Include dependency graph for validation.c:

Go to the source code of this file.

Macros

#define _UT_ASSERT(cond)
 

Functions

static void cache_load (struct m0_conf_cache *cache, const char *path, char **sharp_out)
 
static void test_validation (void)
 
static char * sharp_comment (const char *input)
 
static void test_sharp_comment (void)
 

Variables

static char g_buf [192]
 
struct m0_ut_suite conf_validation_ut
 

Macro Definition Documentation

◆ _UT_ASSERT

#define _UT_ASSERT (   cond)
Value:
"path=%s\n" \
"err={%s}\n" \
"expected={%s}\n" \
"g_buf={%s}", \
*pathv, (err ?: ""), (expected ?: ""), g_buf)
static int expected
Definition: locality.c:102
static char g_buf[192]
Definition: validation.c:30
#define M0_ASSERT_INFO(cond, fmt,...)

Function Documentation

◆ cache_load()

static void cache_load ( struct m0_conf_cache cache,
const char *  path,
char **  sharp_out 
)
static
Note
Don't forget to free(*sharp_out).

Definition at line 136 of file validation.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sharp_comment()

static char* sharp_comment ( const char *  input)
static

If the first line of the input matches /^#+=/ regexp, sharp_comment() returns the remainder of this line without the matched prefix. The returned string is stripped of leading and trailing blanks.

If there is no match, sharp_comment() returns NULL.

Note
The returned pointer should be free()d. (But not m0_free()d.)

Definition at line 80 of file validation.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_sharp_comment()

static void test_sharp_comment ( void  )
static

Definition at line 102 of file validation.c.

Here is the call graph for this function:

◆ test_validation()

static void test_validation ( void  )
static

Definition at line 35 of file validation.c.

Here is the call graph for this function:

Variable Documentation

◆ conf_validation_ut

struct m0_ut_suite conf_validation_ut
Initial value:
= {
.ts_name = "conf-validation-ut",
.ts_tests = {
{ "sharp-comment", test_sharp_comment },
{ "validation", test_validation },
{ NULL, NULL }
}
}
M0_INTERNAL int m0_conf_ut_cache_init(void)
Definition: common.c:107
#define NULL
Definition: misc.h:38
static void test_validation(void)
Definition: validation.c:35
M0_INTERNAL int m0_conf_ut_cache_fini(void)
Definition: common.c:114
static void test_sharp_comment(void)
Definition: validation.c:102

Definition at line 151 of file validation.c.

◆ g_buf

char g_buf[192]
static

Definition at line 30 of file validation.c.