Tests for slab allocator.
More...
#include <freeradius-devel/util/acutest.h>
#include <freeradius-devel/util/acutest_helpers.h>
#include "slab.h"
Go to the source code of this file.
Tests for slab allocator.
- Copyright
- 2023 Network RADIUS SAS legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com
Definition in file slab_tests.c.
◆ test_conf_t
◆ test_element_t
Definition at line 12 of file slab_tests.c.
Data Fields |
char * |
name |
|
int |
num |
|
◆ test_uctx_t
◆ test_alloc()
static void test_alloc |
( |
void |
| ) |
|
|
static |
Test basic allocation and reservation of elements.
Definition at line 55 of file slab_tests.c.
◆ test_alloc_fail()
static void test_alloc_fail |
( |
void |
| ) |
|
|
static |
Test allocation beyond max fails correctly.
Definition at line 126 of file slab_tests.c.
◆ test_child_alloc()
static void test_child_alloc |
( |
void |
| ) |
|
|
static |
◆ test_clearup_1()
static void test_clearup_1 |
( |
void |
| ) |
|
|
static |
Test of clearing unused slabs.
Definition at line 478 of file slab_tests.c.
◆ test_clearup_2()
static void test_clearup_2 |
( |
void |
| ) |
|
|
static |
Test that slab clearing does not go beyond the minimum.
Definition at line 532 of file slab_tests.c.
◆ test_clearup_3()
static void test_clearup_3 |
( |
void |
| ) |
|
|
static |
Test that repeated clearing frees more slabs.
Definition at line 597 of file slab_tests.c.
◆ test_element_alloc()
◆ test_element_free()
◆ test_element_reserve()
static int test_element_reserve |
( |
test_element_t * |
elem, |
|
|
void * |
uctx |
|
) |
| |
|
static |
◆ test_free()
static void test_free |
( |
void |
| ) |
|
|
static |
Test that talloc freeing an element results in destructor being called.
Definition at line 323 of file slab_tests.c.
◆ test_init()
static void test_init |
( |
void |
| ) |
|
|
static |
Test that a callback correctly initialises slab elements on first use.
Definition at line 357 of file slab_tests.c.
◆ test_init_reserve()
static void test_init_reserve |
( |
void |
| ) |
|
|
static |
Test that reserve callback runs after init callback.
Definition at line 440 of file slab_tests.c.
◆ test_realloc()
static void test_realloc |
( |
void |
| ) |
|
|
static |
Test that reserving after clearup results in new slab allocation.
Definition at line 691 of file slab_tests.c.
◆ test_reserve()
static void test_reserve |
( |
void |
| ) |
|
|
static |
Test that a reserve callback correctly initialises slab elements.
Definition at line 395 of file slab_tests.c.
◆ test_reserve_mru()
static void test_reserve_mru |
( |
void |
| ) |
|
|
static |
Test that setting reserve_mru to true works.
After releasing an element, a subsequent reserve should return the same element
Definition at line 277 of file slab_tests.c.
◆ test_reuse_noreset()
static void test_reuse_noreset |
( |
void |
| ) |
|
|
static |
Test that freeing an element makes it available for reuse with the element not reset between uses.
Definition at line 224 of file slab_tests.c.
◆ test_reuse_reset()
static void test_reuse_reset |
( |
void |
| ) |
|
|
static |
Test that freeing an element makes it available for reuse with the element reset between uses.
Definition at line 164 of file slab_tests.c.
◆ test_time()
◆ def_slab_config
Initial value:
.elements_per_slab = 2,
.min_elements = 1,
.max_elements = 4,
.at_max_fail = false,
.num_children = 0,
.child_pool_size = 0,
.interval.value = 1 *
NSEC
}
Tuneable parameters for slabs.
Definition at line 25 of file slab_tests.c.
◆ TEST_LIST
Initial value:= {
{ NULL }
}
static void test_clearup_3(void)
Test that repeated clearing frees more slabs.
static void test_reserve(void)
Test that a reserve callback correctly initialises slab elements.
static void test_init_reserve(void)
Test that reserve callback runs after init callback.
static void test_reserve_mru(void)
Test that setting reserve_mru to true works.
static void test_clearup_2(void)
Test that slab clearing does not go beyond the minimum.
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_child_alloc(void)
static void test_clearup_1(void)
Test of clearing unused slabs.
static void test_free(void)
Test that talloc freeing an element results in destructor being called.
static void test_alloc(void)
Test basic allocation and reservation of elements.
static void test_reuse_reset(void)
Test that freeing an element makes it available for reuse with the element reset between uses.
static void test_init(void)
Test that a callback correctly initialises slab elements on first use.
static void test_alloc_fail(void)
Test allocation beyond max fails correctly.
static void test_realloc(void)
Test that reserving after clearup results in new slab allocation.
Definition at line 791 of file slab_tests.c.
◆ test_time_base