The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Macros | Functions | Variables
bio_base_tests.c File Reference

Tests for chaining, EOF and shutdown. 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/pipe.h>
+ Include dependency graph for bio_base_tests.c:

Go to the source code of this file.

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 test_chain (void)
 
static fr_bio_t * test_chain_alloc (TALLOC_CTX *ctx, fr_bio_t **sink_p)
 A pipe in front of a sink, which is the smallest chain we can build without a socket.
 
static void test_shutdown_discard (void)
 fr_bio_shutdown_discard() does not wait, and throws the buffered data away.
 
static void test_shutdown_drains_reads (void)
 A bio which still holds data defers the teardown until the application has drained it.
 
static void test_shutdown_free_completes (void)
 A free completes a shutdown which is still waiting for a drain.
 
static void test_shutdown_immediate (void)
 With nothing buffered, a shutdown tears the chain down at once.
 
static void test_strerror (void)
 

Variables

static int eof_count
 
static int shutdown_count
 
static fr_bio_cb_funcs_t test_cb
 
 TEST_LIST
 

Detailed Description

Tests for chaining, EOF and shutdown.

Definition in file bio_base_tests.c.

Macro Definition Documentation

◆ _BIO_PRIVATE

#define _BIO_PRIVATE   1

Definition at line 26 of file bio_base_tests.c.

Function Documentation

◆ cb_eof()

static void cb_eof ( fr_bio_t *  bio)
static

Definition at line 34 of file bio_base_tests.c.

◆ cb_noop()

static int cb_noop ( fr_bio_t *  bio)
static

Definition at line 36 of file bio_base_tests.c.

◆ cb_shutdown()

static int cb_shutdown ( fr_bio_t *  bio)
static

Definition at line 35 of file bio_base_tests.c.

◆ test_chain()

static void test_chain ( void  )
static

Definition at line 70 of file bio_base_tests.c.

+ Here is the call graph for this function:

◆ test_chain_alloc()

static fr_bio_t * test_chain_alloc ( TALLOC_CTX *  ctx,
fr_bio_t **  sink_p 
)
static

A pipe in front of a sink, which is the smallest chain we can build without a socket.

The pipe is the head, and is the bio which can hold data for the application. The sink stands in for the transport.

Definition at line 52 of file bio_base_tests.c.

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

◆ test_shutdown_discard()

static void test_shutdown_discard ( void  )
static

fr_bio_shutdown_discard() does not wait, and throws the buffered data away.

Definition at line 162 of file bio_base_tests.c.

+ Here is the call graph for this function:

◆ test_shutdown_drains_reads()

static void test_shutdown_drains_reads ( void  )
static

A bio which still holds data defers the teardown until the application has drained it.

Definition at line 123 of file bio_base_tests.c.

+ Here is the call graph for this function:

◆ test_shutdown_free_completes()

static void test_shutdown_free_completes ( void  )
static

A free completes a shutdown which is still waiting for a drain.

Definition at line 187 of file bio_base_tests.c.

+ Here is the call graph for this function:

◆ test_shutdown_immediate()

static void test_shutdown_immediate ( void  )
static

With nothing buffered, a shutdown tears the chain down at once.

Definition at line 95 of file bio_base_tests.c.

+ Here is the call graph for this function:

◆ test_strerror()

static void test_strerror ( void  )
static

Definition at line 210 of file bio_base_tests.c.

+ Here is the call graph for this function:

Variable Documentation

◆ eof_count

int eof_count
static

Definition at line 31 of file bio_base_tests.c.

◆ shutdown_count

int shutdown_count
static

Definition at line 32 of file bio_base_tests.c.

◆ test_cb

fr_bio_cb_funcs_t test_cb
static
Initial value:
= {
.read_resume = cb_noop,
.write_resume = cb_noop,
.read_blocked = cb_noop,
.write_blocked = cb_noop,
.eof = cb_eof,
.shutdown = cb_shutdown,
}
static void cb_eof(fr_bio_t *bio)
static int cb_shutdown(fr_bio_t *bio)
static int cb_noop(fr_bio_t *bio)

Definition at line 38 of file bio_base_tests.c.

◆ TEST_LIST

TEST_LIST
Initial value:
= {
{ "chain", test_chain },
{ "shutdown_immediate", test_shutdown_immediate },
{ "shutdown_drains_reads", test_shutdown_drains_reads },
{ "shutdown_discard", test_shutdown_discard },
{ "shutdown_free_completes", test_shutdown_free_completes },
{ "strerror", test_strerror },
}
#define TEST_TERMINATOR
Definition acutest.h:77
static void test_strerror(void)
static void test_chain(void)
static void test_shutdown_drains_reads(void)
A bio which still holds data defers the teardown until the application has drained it.
static void test_shutdown_immediate(void)
With nothing buffered, a shutdown tears the chain down at once.
static void test_shutdown_discard(void)
fr_bio_shutdown_discard() does not wait, and throws the buffered data away.
static void test_shutdown_free_completes(void)
A free completes a shutdown which is still waiting for a drain.

Definition at line 227 of file bio_base_tests.c.