![]() |
The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
|
Tests for the dedup bio expiring entries after a reply. More...
#include <freeradius-devel/util/test/acutest_common_init.h>#include <freeradius-devel/util/test/acutest_helpers.h>#include <freeradius-devel/bio/bio_priv.h>#include <freeradius-devel/util/rb.h>#include <freeradius-devel/bio/dedup.h>
Include dependency graph for bio_dedup_tests.c:Go to the source code of this file.
Functions | |
| static fr_bio_dedup_entry_t * | dedup_get_item (UNUSED fr_bio_t *bio, UNUSED void *pctx) |
| static bool | dedup_receive (UNUSED fr_bio_t *bio, fr_bio_dedup_entry_t *dedup_ctx, UNUSED void *pctx) |
| static void | dedup_release (UNUSED fr_bio_t *bio, UNUSED fr_bio_dedup_entry_t *dedup_ctx, fr_bio_dedup_release_reason_t reason) |
| static fr_bio_t * | stub_alloc (TALLOC_CTX *ctx) |
| static ssize_t | stub_read (UNUSED fr_bio_t *bio, UNUSED void *pctx, void *buffer, size_t size) |
| The stub transport returns a copy of request on every read, and reports every write as complete. | |
| static ssize_t | stub_write_all (UNUSED fr_bio_t *bio, UNUSED void *pctx, void const *buffer, size_t size) |
| static ssize_t | stub_write_block (UNUSED fr_bio_t *bio, UNUSED void *pctx, UNUSED void const *buffer, UNUSED size_t size) |
| A stub transport write function which always returns IO_WOULD_BLOCK. | |
| static ssize_t | stub_write_one (UNUSED fr_bio_t *bio, UNUSED void *pctx, void const *buffer, UNUSED size_t size) |
| A stub transport write function which accepts one byte of each write. | |
| static fr_bio_t * | test_dedup_alloc (TALLOC_CTX *ctx, fr_bio_dedup_config_t *cfg) |
| Allocate a dedup bio with two entries and a one-second lifetime, in front of the stub transport. | |
| static void | test_entries_are_reused (void) |
| The expiry timer returns each expired entry to the free list, so the dedup bio reads more requests than the dedup bio has entries. | |
| static void | test_equal_expiry (void) |
| Two entries with the same expiry time both expire. | |
| static bool | test_pending_reply (fr_bio_t *dedup, fr_bio_t *stub, uint8_t *buffer, size_t size) |
| Read a request, and respond while the stub transport is blocked, so that the reply goes on the pending list. | |
| static bool | test_read_request (fr_bio_t *dedup, uint8_t *buffer, size_t size) |
| Read one request through the dedup bio, and attach reply to the dedup entry of the request. | |
| static void | test_respond_expires (void) |
| The dedup entry for a reply sent with fr_bio_dedup_respond() expires once the lifetime is over. | |
| static void | test_resume_partial (void) |
| When the stub transport writes only part of a pending reply, the next resume writes the rest. | |
| static void | test_resume_sends_pending (void) |
| write_resume sends a pending reply, and the dedup entry then expires once the lifetime is over. | |
| static void | test_resume_still_blocked (void) |
| write_resume keeps the pending reply when the stub transport is still blocked. | |
| static void | test_run_timers (fr_bio_dedup_config_t *cfg) |
| Run every timer which is due within the next five seconds. | |
| static void | test_write_expires (void) |
| The dedup entry for a reply sent with fr_bio_write() expires once the lifetime is over. | |
| static int | test_write_resume (fr_bio_t *dedup) |
| Call the dedup bio's write_resume callback, as fr_bio_packet_write_resume() does. | |
Variables | |
| static int | expired_count |
| static int | packet_ctx |
| the tests pass only the address of packet_ctx | |
| static uint8_t | reply [4] = { 5, 6, 7, 8 } |
| static uint8_t | request [4] = { 1, 2, 3, 4 } |
| static fr_bio_dedup_entry_t * | saved_item |
| static size_t | stub_bytes |
| bytes of reply data which the stub transport has accepted | |
| TEST_LIST | |
Tests for the dedup bio expiring entries after a reply.
Definition in file bio_dedup_tests.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 92 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The stub transport returns a copy of request on every read, and reports every write as complete.
Definition at line 57 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
A stub transport write function which always returns IO_WOULD_BLOCK.
Definition at line 77 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
A stub transport write function which accepts one byte of each write.
Definition at line 84 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
Allocate a dedup bio with two entries and a one-second lifetime, in front of the stub transport.
Definition at line 107 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The expiry timer returns each expired entry to the free list, so the dedup bio reads more requests than the dedup bio has entries.
The UDP bio of the RADIUS server has 256 entries. Without the fix for dedup.md finding 1, the UDP bio returned fr_bio_error(OOM) for every request after 256 replies.
Definition at line 213 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Two entries with the same expiry time both expire.
See finding 1 in dedup.md. The expiry tree compared only the expiry time, so the tree treated the second entry as a duplicate, and never inserted the second entry.
Definition at line 245 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Read a request, and respond while the stub transport is blocked, so that the reply goes on the pending list.
Definition at line 295 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:Read one request through the dedup bio, and attach reply to the dedup entry of the request.
Definition at line 128 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The dedup entry for a reply sent with fr_bio_dedup_respond() expires once the lifetime is over.
Regression test for dedup.md finding 1. fr_bio_dedup_respond() and fr_bio_dedup_write() did not arm the expiry timer, so no entry expired.
Definition at line 155 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
When the stub transport writes only part of a pending reply, the next resume writes the rest.
Definition at line 364 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
write_resume sends a pending reply, and the dedup entry then expires once the lifetime is over.
Definition at line 305 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
write_resume keeps the pending reply when the stub transport is still blocked.
Definition at line 336 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Run every timer which is due within the next five seconds.
Definition at line 143 of file bio_dedup_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The dedup entry for a reply sent with fr_bio_write() expires once the lifetime is over.
Definition at line 182 of file bio_dedup_tests.c.
Here is the call graph for this function:
|
static |
Call the dedup bio's write_resume callback, as fr_bio_packet_write_resume() does.
Definition at line 283 of file bio_dedup_tests.c.
Here is the caller graph for this function:
|
static |
Definition at line 31 of file bio_dedup_tests.c.
|
static |
the tests pass only the address of packet_ctx
Definition at line 36 of file bio_dedup_tests.c.
|
static |
Definition at line 35 of file bio_dedup_tests.c.
|
static |
Definition at line 34 of file bio_dedup_tests.c.
|
static |
Definition at line 32 of file bio_dedup_tests.c.
|
static |
bytes of reply data which the stub transport has accepted
Definition at line 65 of file bio_dedup_tests.c.
| TEST_LIST |
Definition at line 392 of file bio_dedup_tests.c.
1.9.8