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

Tests for the pipe bio. 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_pipe_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_read_blocked (fr_bio_t *bio)
 
static void test_eof_on_empty_read (void)
 EOF is signalled even when the read which notices it returns no data.
 
static void test_eof_walk_continues (void)
 An empty pipe must not stop the EOF walk.
 
static fr_bio_t * test_pipe_alloc (TALLOC_CTX *ctx, size_t size)
 
static void test_write_after_eof (void)
 A write after EOF reports an error rather than "try again later".
 
static void test_write_clamped (void)
 A write larger than the buffer is clamped rather than refused.
 
static void test_write_read (void)
 

Variables

static int eof_count
 
static int read_blocked_count
 
static fr_bio_cb_funcs_t test_cb
 
 TEST_LIST
 

Detailed Description

Tests for the pipe bio.

Definition in file bio_pipe_tests.c.

Macro Definition Documentation

◆ _BIO_PRIVATE

#define _BIO_PRIVATE   1

Definition at line 26 of file bio_pipe_tests.c.

Function Documentation

◆ cb_eof()

static void cb_eof ( fr_bio_t *  bio)
static

Definition at line 34 of file bio_pipe_tests.c.

◆ cb_noop()

static int cb_noop ( fr_bio_t *  bio)
static

Definition at line 36 of file bio_pipe_tests.c.

◆ cb_read_blocked()

static int cb_read_blocked ( fr_bio_t *  bio)
static

Definition at line 35 of file bio_pipe_tests.c.

◆ test_eof_on_empty_read()

static void test_eof_on_empty_read ( void  )
static

EOF is signalled even when the read which notices it returns no data.

The pipe used to call read_blocked() in that case, telling an application which read until it got nothing that it was blocked rather than finished.

Definition at line 110 of file bio_pipe_tests.c.

+ Here is the call graph for this function:

◆ test_eof_walk_continues()

static void test_eof_walk_continues ( void  )
static

An empty pipe must not stop the EOF walk.

fr_bio_eof() stops when a handler returns zero or less. The pipe used to return zero for "nothing buffered", which stopped the walk and left a chain containing a pipe unable to finish.

Definition at line 150 of file bio_pipe_tests.c.

+ Here is the call graph for this function:

◆ test_pipe_alloc()

static fr_bio_t * test_pipe_alloc ( TALLOC_CTX *  ctx,
size_t  size 
)
static

Definition at line 46 of file bio_pipe_tests.c.

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

◆ test_write_after_eof()

static void test_write_after_eof ( void  )
static

A write after EOF reports an error rather than "try again later".

Definition at line 175 of file bio_pipe_tests.c.

+ Here is the call graph for this function:

◆ test_write_clamped()

static void test_write_clamped ( void  )
static

A write larger than the buffer is clamped rather than refused.

Definition at line 83 of file bio_pipe_tests.c.

+ Here is the call graph for this function:

◆ test_write_read()

static void test_write_read ( void  )
static

Definition at line 53 of file bio_pipe_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_pipe_tests.c.

◆ read_blocked_count

int read_blocked_count
static

Definition at line 32 of file bio_pipe_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_read_blocked,
.write_blocked = cb_noop,
.eof = cb_eof,
}
static void cb_eof(fr_bio_t *bio)
static int cb_read_blocked(fr_bio_t *bio)
static int cb_noop(fr_bio_t *bio)

Definition at line 38 of file bio_pipe_tests.c.

◆ TEST_LIST

TEST_LIST
Initial value:
= {
{ "write_read", test_write_read },
{ "write_clamped", test_write_clamped },
{ "eof_on_empty_read", test_eof_on_empty_read },
{ "eof_walk_continues", test_eof_walk_continues },
{ "write_after_eof", test_write_after_eof },
}
#define TEST_TERMINATOR
Definition acutest.h:77
static void test_write_read(void)
static void test_eof_walk_continues(void)
An empty pipe must not stop the EOF walk.
static void test_eof_on_empty_read(void)
EOF is signalled even when the read which notices it returns no data.
static void test_write_after_eof(void)
A write after EOF reports an error rather than "try again later".
static void test_write_clamped(void)
A write larger than the buffer is clamped rather than refused.

Definition at line 199 of file bio_pipe_tests.c.