![]() |
The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
|
Tests for the queue bio's shutdown and error handling. 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/bio/mem.h>#include <freeradius-devel/bio/null.h>#include <freeradius-devel/bio/pipe.h>#include <freeradius-devel/bio/queue.h>
Include dependency graph for bio_queue_tests.c:Go to the source code of this file.
Data Structures | |
| struct | stub_t |
| A stub transport which fails recoverably or fatally, as each test chooses. More... | |
Macros | |
| #define | _BIO_PRIVATE 1 |
Functions | |
| static void | cb_eof (fr_bio_t *bio) |
| static int | cb_noop (fr_bio_t *bio) |
| static int | cb_shutdown (fr_bio_t *bio) |
| static void | queue_cancel (fr_bio_t *bio, void *packet_ctx, void const *buffer, size_t size) |
| static bool | queue_fill (fr_bio_t *head) |
| Leave one packet partly written in the queue. | |
| static fr_bio_t * | stub_alloc (TALLOC_CTX *ctx) |
| static ssize_t | stub_write_all (UNUSED fr_bio_t *bio, UNUSED void *packet_ctx, UNUSED void const *buffer, size_t size) |
| A transport which accepts every write in full. | |
| static ssize_t | stub_write_fail (fr_bio_t *bio, UNUSED void *packet_ctx, UNUSED void const *buffer, UNUSED size_t size) |
| static ssize_t | stub_write_one (UNUSED fr_bio_t *bio, UNUSED void *packet_ctx, UNUSED void const *buffer, UNUSED size_t size) |
| A transport which accepts one byte of each write, so the queue bio saves the rest of the packet. | |
| static void | test_fatal_flush_from_next (void) |
| When the next bio shuts the chain down on a fatal flush error, fr_bio_queue_shutdown() cancels the saved packet. | |
| static fr_bio_t * | test_queue_saved_alloc (TALLOC_CTX *ctx, fr_bio_t **stub_p) |
| Build a queue in front of a stub, with one packet saved after a partial write. | |
| static void | test_recoverable_flush_passes_up (void) |
| The queue bio passes a recoverable flush error up to the application, and keeps the saved packet. | |
| static void | test_recoverable_write_passes_up (void) |
| The queue bio passes a recoverable write error up to the application, and keeps working. | |
| static void | test_shutdown_keeps_app_callback (void) |
| The application installs its callbacks on a queue bio at the head of the chain. | |
| static void | test_shutdown_not_head (void) |
| A queue bio in the middle of a chain is not the head, so only the private slot reaches it. | |
Variables | |
| static int | cancel_count |
| static uint8_t | fill [1000] |
| static uint8_t | overflow [100] |
| static int | shutdown_count |
| static fr_bio_cb_funcs_t | test_cb |
| TEST_LIST | |
Tests for the queue bio's shutdown and error handling.
Definition in file bio_queue_tests.c.
| struct stub_t |
A stub transport which fails recoverably or fatally, as each test chooses.
On a recoverable failure, the stub returns an error and changes nothing else. On a fatal failure, the stub first shuts the chain down, as the fd bio does. Only the failing bio decides whether a failure is recoverable or fatal.
Definition at line 288 of file bio_mem_tests.c.
| Data Fields | ||
|---|---|---|
| bool | data_sent | the first read has returned "abcde" |
| bool | fatal | shut the chain down before failing |
| FR_BIO_COMMON | ||
| #define _BIO_PRIVATE 1 |
Definition at line 26 of file bio_queue_tests.c.
|
static |
Definition at line 36 of file bio_queue_tests.c.
|
static |
Definition at line 38 of file bio_queue_tests.c.
|
static |
Definition at line 37 of file bio_queue_tests.c.
Leave one packet partly written in the queue.
Definition at line 111 of file bio_queue_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 96 of file bio_queue_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
A transport which accepts every write in full.
Definition at line 91 of file bio_queue_tests.c.
Here is the caller graph for this function:
|
static |
Definition at line 72 of file bio_queue_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
A transport which accepts one byte of each write, so the queue bio saves the rest of the packet.
Definition at line 84 of file bio_queue_tests.c.
Here is the caller graph for this function:
|
static |
When the next bio shuts the chain down on a fatal flush error, fr_bio_queue_shutdown() cancels the saved packet.
Definition at line 284 of file bio_queue_tests.c.
Here is the call graph for this function:Build a queue in front of a stub, with one packet saved after a partial write.
Definition at line 200 of file bio_queue_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
The queue bio passes a recoverable flush error up to the application, and keeps the saved packet.
Definition at line 256 of file bio_queue_tests.c.
Here is the call graph for this function:
|
static |
The queue bio passes a recoverable write error up to the application, and keeps working.
Definition at line 223 of file bio_queue_tests.c.
Here is the call graph for this function:
|
static |
The application installs its callbacks on a queue bio at the head of the chain.
The queue's own shutdown routine must survive that, and still cancel the saved packet.
Definition at line 122 of file bio_queue_tests.c.
Here is the call graph for this function:
|
static |
A queue bio in the middle of a chain is not the head, so only the private slot reaches it.
Definition at line 159 of file bio_queue_tests.c.
Here is the call graph for this function:
|
static |
Definition at line 33 of file bio_queue_tests.c.
|
static |
Definition at line 58 of file bio_queue_tests.c.
|
static |
Definition at line 59 of file bio_queue_tests.c.
|
static |
Definition at line 34 of file bio_queue_tests.c.
|
static |
Definition at line 46 of file bio_queue_tests.c.
| TEST_LIST |
Definition at line 309 of file bio_queue_tests.c.
1.9.8