![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Tests for slab allocator. More...
#include "acutest.h"#include "acutest_helpers.h"#include <freeradius-devel/util/timer.h>#include <freeradius-devel/util/slab.h>
Include dependency graph for slab_tests.c:Go to the source code of this file.
Data Structures | |
| struct | test_conf_t |
| struct | test_element_t |
| struct | test_uctx_t |
Functions | |
| static void | test_alloc (void) |
| Test basic allocation and reservation of elements. | |
| static void | test_alloc_fail (void) |
| Test allocation beyond max fails correctly. | |
| static void | test_bulk_teardown (void) |
| Test that talloc free of the slab list with in-use elements does not assert. | |
| static void | test_child_alloc (void) |
| static void | test_clearup_1 (void) |
| Test of clearing unused slabs. | |
| static void | test_clearup_2 (void) |
| Test that slab clearing does not go beyond the minimum. | |
| static void | test_clearup_3 (void) |
| Test that repeated clearing frees more slabs. | |
| static int | test_element_alloc (test_element_t *elem, void *uctx) |
| static int | test_element_free (test_element_t *elem, void *uctx) |
| static int | test_element_reserve (test_element_t *elem, void *uctx) |
| static void | test_free (void) |
| Test that freeing an element results in the destructor being called, and that all accounting is correctly updated. | |
| static void | test_free_and_reserve (void) |
| Test that reserving after talloc_free of an element still works. | |
| static void | test_free_mixed (void) |
| Test mixed release and talloc_free of elements from the same slab. | |
| static void | test_free_multiple (void) |
| Test that talloc freeing multiple in-use elements correctly updates accounting. | |
| static void | test_init (void) |
| Test that a callback correctly initialises slab elements on first use. | |
| static void | test_init_reserve (void) |
| Test that reserve callback runs after init callback. | |
| static void | test_realloc (void) |
| Test that reserving after clearup results in new slab allocation. | |
| static void | test_reserve (void) |
| Test that a reserve callback correctly initialises slab elements. | |
| static void | test_reserve_mru (void) |
| Test that setting reserve_mru to true works. | |
| static void | test_reuse_noreset (void) |
| Test that freeing an element makes it available for reuse with the element not reset between uses. | |
| static void | test_reuse_reset (void) |
| Test that freeing an element makes it available for reuse with the element reset between uses. | |
| static fr_time_t | test_time (void) |
Variables | |
| static fr_slab_config_t | def_slab_config |
| TEST_LIST | |
| static fr_time_t | test_time_base = fr_time_wrap(1) |
Tests for slab allocator.
Definition in file slab_tests.c.
| struct test_conf_t |
Definition at line 21 of file slab_tests.c.
| Data Fields | ||
|---|---|---|
| int | initial | |
| struct test_element_t |
Definition at line 12 of file slab_tests.c.
| Data Fields | ||
|---|---|---|
| char * | name | |
| int | num | |
| struct test_uctx_t |
Definition at line 17 of file slab_tests.c.
| Data Fields | ||
|---|---|---|
| int | count | |
|
static |
Test basic allocation and reservation of elements.
Definition at line 54 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test allocation beyond max fails correctly.
Definition at line 124 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that talloc free of the slab list with in-use elements does not assert.
This exercises the being_freed flag path: the slab destructor sets being_freed = true before children are freed, so element destructors will see the flag and skip the direct-free assertion.
Definition at line 792 of file slab_tests.c.
Here is the call graph for this function:
|
static |
|
static |
Test of clearing unused slabs.
Definition at line 472 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that slab clearing does not go beyond the minimum.
Definition at line 525 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that repeated clearing frees more slabs.
Definition at line 589 of file slab_tests.c.
Here is the call graph for this function:
|
static |
|
static |
|
static |
|
static |
Test that freeing an element results in the destructor being called, and that all accounting is correctly updated.
Definition at line 316 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that reserving after talloc_free of an element still works.
Definition at line 880 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test mixed release and talloc_free of elements from the same slab.
Definition at line 831 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that talloc freeing multiple in-use elements correctly updates accounting.
Definition at line 745 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that a callback correctly initialises slab elements on first use.
Definition at line 354 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that reserve callback runs after init callback.
Definition at line 435 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that reserving after clearup results in new slab allocation.
Definition at line 682 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that a reserve callback correctly initialises slab elements.
Definition at line 391 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that setting reserve_mru to true works.
After releasing an element, a subsequent reserve should return the same element
Definition at line 272 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that freeing an element makes it available for reuse with the element not reset between uses.
Definition at line 220 of file slab_tests.c.
Here is the call graph for this function:
|
static |
Test that freeing an element makes it available for reuse with the element reset between uses.
Definition at line 161 of file slab_tests.c.
Here is the call graph for this function:
|
static |
|
static |
Definition at line 25 of file slab_tests.c.
| TEST_LIST |
Definition at line 956 of file slab_tests.c.
|
static |
Definition at line 42 of file slab_tests.c.
1.9.8