The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
cf_tests.c File Reference

Tests for cf_file, cf_util, and cf_parse. More...

#include <freeradius-devel/util/test/acutest.h>
#include <freeradius-devel/util/test/acutest_helpers.h>
#include <freeradius-devel/server/cf_file.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/server/cf_priv.h>
+ Include dependency graph for cf_tests.c:

Go to the source code of this file.

Data Structures

struct  test_octets_t
 

Macros

#define TEST_INIT   test_init()
 

Functions

static void test_cf_root (void)
 
static unsigned int test_config_item_count (CONF_SECTION *cs)
 Count the pairs and sections in a section, ignoring CONF_DATA.
 
static void test_data_add_find (void)
 
static void test_data_find_missing (void)
 
static void test_data_remove (void)
 
static void test_expand_missing_ref (void)
 
static void test_expand_nested_ref (void)
 
static void test_expand_no_variables (void)
 
static void test_expand_section_ref (void)
 
static void test_file_read_buffer_comment_only (void)
 
static void test_file_read_buffer_continuation_no_newline (void)
 
static void test_file_read_buffer_pair (void)
 
static void test_file_read_empty_file (void)
 
static void test_filename_lineno (void)
 
static void test_filename_set (void)
 
static void test_init (void)
 Global initialisation.
 
static void test_item_free_children (void)
 
static void test_item_mark_parsed (void)
 
static void test_item_next_mixed (void)
 
static void test_item_remove_pair (void)
 
static void test_item_remove_section (void)
 
static void test_lineno_set (void)
 
static void test_pair_alloc_basic (void)
 
static void test_pair_alloc_no_value (void)
 
static void test_pair_alloc_operators (void)
 
static void test_pair_alloc_quoted (void)
 
static void test_pair_count (void)
 
static void test_pair_count_descendents (void)
 
static void test_pair_dup (void)
 
static void test_pair_find_basic (void)
 
static void test_pair_find_missing (void)
 
static void test_pair_find_next (void)
 
static void test_pair_first_next (void)
 
static void test_pair_in_table_found (void)
 
static void test_pair_in_table_invalid (void)
 
static void test_pair_parse_octets_quote (void)
 The quotes around a value are the type hint for an octets item.
 
static void test_pair_prev (void)
 
static void test_pair_replace (void)
 
static void test_pair_to_item_roundtrip (void)
 
static void test_reference_item_missing (void)
 
static void test_reference_item_pair (void)
 
static void test_reference_item_section (void)
 
static void test_section_alloc_name1_name2 (void)
 
static void test_section_alloc_name1_only (void)
 
static void test_section_alloc_parent (void)
 
static void test_section_dup_basic (void)
 
static void test_section_dup_nested_pairs (void)
 
static void test_section_dup_rename (void)
 
static void test_section_find_child (void)
 
static void test_section_find_missing (void)
 
static void test_section_find_name1_name2 (void)
 
static void test_section_find_next (void)
 
static void test_section_first_next (void)
 
static void test_section_name_cmp (void)
 
static void test_section_prev (void)
 
static void test_section_to_item_roundtrip (void)
 
static void test_section_value_find (void)
 

Variables

static TALLOC_CTX * autofree
 
 TEST_LIST
 
static conf_parser_t const test_octets_rules []
 
static fr_table_num_sorted_t const test_table []
 
static size_t test_table_len = NUM_ELEMENTS(test_table)
 

Detailed Description

Tests for cf_file, cf_util, and cf_parse.

Definition in file cf_tests.c.


Data Structure Documentation

◆ test_octets_t

struct test_octets_t

Definition at line 1294 of file cf_tests.c.

Data Fields
uint8_t const * bare
uint8_t const * quoted_escape
uint8_t const * quoted_hex
uint8_t const * quoted_text

Macro Definition Documentation

◆ TEST_INIT

#define TEST_INIT   test_init()

Definition at line 25 of file cf_tests.c.

Function Documentation

◆ test_cf_root()

static void test_cf_root ( void  )
static

Definition at line 886 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_config_item_count()

static unsigned int test_config_item_count ( CONF_SECTION *  cs)
static

Count the pairs and sections in a section, ignoring CONF_DATA.

cf_file_read() and cf_file_read_buffer() both attach the file dedup tree to the section as CONF_DATA, so an "empty" configuration is never childless.

Definition at line 1189 of file cf_tests.c.

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

◆ test_data_add_find()

static void test_data_add_find ( void  )
static

Definition at line 911 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_data_find_missing()

static void test_data_find_missing ( void  )
static

Definition at line 935 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_data_remove()

static void test_data_remove ( void  )
static

Definition at line 949 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_expand_missing_ref()

static void test_expand_missing_ref ( void  )
static

Definition at line 1047 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_expand_nested_ref()

static void test_expand_nested_ref ( void  )
static

Definition at line 1021 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_expand_no_variables()

static void test_expand_no_variables ( void  )
static

Definition at line 977 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_expand_section_ref()

static void test_expand_section_ref ( void  )
static

Definition at line 998 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_file_read_buffer_comment_only()

static void test_file_read_buffer_comment_only ( void  )
static

Definition at line 1229 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_file_read_buffer_continuation_no_newline()

static void test_file_read_buffer_continuation_no_newline ( void  )
static

Definition at line 1261 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_file_read_buffer_pair()

static void test_file_read_buffer_pair ( void  )
static

Definition at line 1243 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_file_read_empty_file()

static void test_file_read_empty_file ( void  )
static

Definition at line 1200 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_filename_lineno()

static void test_filename_lineno ( void  )
static

Definition at line 841 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_filename_set()

static void test_filename_set ( void  )
static

Definition at line 860 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_init()

static void test_init ( void  )
static

Global initialisation.

Definition at line 38 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_item_free_children()

static void test_item_free_children ( void  )
static

Definition at line 663 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_item_mark_parsed()

static void test_item_mark_parsed ( void  )
static

Definition at line 685 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_item_next_mixed()

static void test_item_next_mixed ( void  )
static

Definition at line 632 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_item_remove_pair()

static void test_item_remove_pair ( void  )
static

Definition at line 593 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_item_remove_section()

static void test_item_remove_section ( void  )
static

Definition at line 613 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_lineno_set()

static void test_lineno_set ( void  )
static

Definition at line 873 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_alloc_basic()

static void test_pair_alloc_basic ( void  )
static

Definition at line 140 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_alloc_no_value()

static void test_pair_alloc_no_value ( void  )
static

Definition at line 175 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_alloc_operators()

static void test_pair_alloc_operators ( void  )
static

Definition at line 192 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_alloc_quoted()

static void test_pair_alloc_quoted ( void  )
static

Definition at line 158 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_count()

static void test_pair_count ( void  )
static

Definition at line 547 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_count_descendents()

static void test_pair_count_descendents ( void  )
static

Definition at line 567 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_dup()

static void test_pair_dup ( void  )
static

Definition at line 810 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_find_basic()

static void test_pair_find_basic ( void  )
static

Definition at line 431 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_find_missing()

static void test_pair_find_missing ( void  )
static

Definition at line 449 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_find_next()

static void test_pair_find_next ( void  )
static

Definition at line 465 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_first_next()

static void test_pair_first_next ( void  )
static

Definition at line 491 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_in_table_found()

static void test_pair_in_table_found ( void  )
static

Definition at line 1140 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_in_table_invalid()

static void test_pair_in_table_invalid ( void  )
static

Definition at line 1160 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_parse_octets_quote()

static void test_pair_parse_octets_quote ( void  )
static

The quotes around a value are the type hint for an octets item.

The parser reads a bare word that starts with 0x as hexadecimal bytes. A quoted value is text, even when the text starts with 0x, so "0xff" is the four characters of the text and not one byte. The parser processes escape sequences in the text.

Definition at line 1316 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_prev()

static void test_pair_prev ( void  )
static

Definition at line 523 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_replace()

static void test_pair_replace ( void  )
static

Definition at line 215 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_pair_to_item_roundtrip()

static void test_pair_to_item_roundtrip ( void  )
static

Definition at line 234 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_reference_item_missing()

static void test_reference_item_missing ( void  )
static

Definition at line 1115 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_reference_item_pair()

static void test_reference_item_pair ( void  )
static

Definition at line 1072 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_reference_item_section()

static void test_reference_item_section ( void  )
static

Definition at line 1094 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_alloc_name1_name2()

static void test_section_alloc_name1_name2 ( void  )
static

Definition at line 74 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_alloc_name1_only()

static void test_section_alloc_name1_only ( void  )
static

Definition at line 60 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_alloc_parent()

static void test_section_alloc_parent ( void  )
static

Definition at line 87 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_dup_basic()

static void test_section_dup_basic ( void  )
static

Definition at line 709 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_dup_nested_pairs()

static void test_section_dup_nested_pairs ( void  )
static

Definition at line 769 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_dup_rename()

static void test_section_dup_rename ( void  )
static

Definition at line 743 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_find_child()

static void test_section_find_child ( void  )
static

Definition at line 260 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_find_missing()

static void test_section_find_missing ( void  )
static

Definition at line 307 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_find_name1_name2()

static void test_section_find_name1_name2 ( void  )
static

Definition at line 285 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_find_next()

static void test_section_find_next ( void  )
static

Definition at line 322 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_first_next()

static void test_section_first_next ( void  )
static

Definition at line 347 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_name_cmp()

static void test_section_name_cmp ( void  )
static

Definition at line 103 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_prev()

static void test_section_prev ( void  )
static

Definition at line 378 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_to_item_roundtrip()

static void test_section_to_item_roundtrip ( void  )
static

Definition at line 117 of file cf_tests.c.

+ Here is the call graph for this function:

◆ test_section_value_find()

static void test_section_value_find ( void  )
static

Definition at line 406 of file cf_tests.c.

+ Here is the call graph for this function:

Variable Documentation

◆ autofree

TALLOC_CTX* autofree
static

Definition at line 34 of file cf_tests.c.

◆ TEST_LIST

TEST_LIST

Definition at line 1355 of file cf_tests.c.

◆ test_octets_rules

conf_parser_t const test_octets_rules[]
static
Initial value:
= {
{ FR_CONF_OFFSET("bare", test_octets_t, bare) },
{ FR_CONF_OFFSET("quoted_hex", test_octets_t, quoted_hex) },
{ FR_CONF_OFFSET("quoted_text", test_octets_t, quoted_text) },
{ FR_CONF_OFFSET("quoted_escape", test_octets_t, quoted_escape) },
}
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:712
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:280

Definition at line 1301 of file cf_tests.c.

◆ test_table

fr_table_num_sorted_t const test_table[] ( void  )
static
Initial value:
= {
{ L("bar"), 2 },
{ L("foo"), 1 },
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition build.h:245

Definition at line 1134 of file cf_tests.c.

◆ test_table_len

size_t test_table_len = NUM_ELEMENTS(test_table)
static

Definition at line 1138 of file cf_tests.c.