Test misc

Overview

Miscellaneous definitions useful for test scenarios. More…

// global functions

void te_test_sig_handler(int signum);
static unsigned int test_sleep_scale(void);

// macros

#define CHECK_BUFS_EQUAL(buf1_, buf2_, buf_len_)
#define CHECK_LENGTH(expr_, exp_length_)
#define CHECK_NOT_NULL(expr_)
#define CHECK_RC(expr_)
#define CHECK_RC_ARTIFACT(expr_, artifact_...)
#define CHECK_RC_VERDICT(expr_, verdict_...)
#define CLEANUP_CHECK_RC(expr_)
#define FREE_AND_CLEAN(ptr_)
#define MSLEEP(_to_sleep)
#define SLEEP(_to_sleep)
#define TAPI_WAIT_NETWORK
#define TAPI_WAIT_NETWORK_DELAY
#define TE_MAX_SCALE
#define USLEEP(_to_sleep)
#define VSLEEP(_to_sleep, _msg)

Detailed Documentation

Miscellaneous definitions useful for test scenarios.

Global Functions

void te_test_sig_handler(int signum)

Signal handler to close TE when Ctrl-C is pressed.

Parameters:

signum

  • signal number

static unsigned int test_sleep_scale(void)

Function to get sleep scale.

Returns:

Scale.

Macros

#define CHECK_BUFS_EQUAL(buf1_, buf2_, buf_len_)

Check that two buffers of specified length have the same content and reports an error in case they are not

Parameters:

buf1_

First buffer

buf2_

Second buffer

buf_len_

Buffer length

#define CHECK_NOT_NULL(expr_)

Check that the expression is not NULL

#define CHECK_RC(expr_)

Check an expression passed as the argument against zero. If the expression is something not zero the macro reports an error, sets ‘result’ variable to EXIT_FAILURE and goes to ‘cleanup’ label.

Parameters:

expr_

Expression to be checked

#define CHECK_RC_ARTIFACT(expr_, artifact_...)

Same as CHECK_RC_VERDICT, but log an artifact instead of verdict The macro will terminate(fail) the test after logging the artifact.

Parameters:

expr_

Expression to be checked

artifact_

Artifact to be logged (supports format string)

#define CHECK_RC_VERDICT(expr_, verdict_...)

Same as CHECK_RC, but verdict in case RC expression result is not ZERO. The macro will terminate(fail) the test after logging the verdict.

Parameters:

expr_

Expression to be checked

verdict_

Verdict to be logged (supports format string)

#define CLEANUP_CHECK_RC(expr_)

Check an expression passed as the argument against zero. The same as CHECK_RC, but does not go to ‘cleanup’ label.

Parameters:

expr_

Expression to be checked

#define FREE_AND_CLEAN(ptr_)

Free variable and set its value to NULL

#define MSLEEP(_to_sleep)

Scalable sleep (sleep scale times for _to_sleep milliseconds).

Parameters:

_to_sleep

number of seconds to sleep is scale is 1

#define SLEEP(_to_sleep)

Scalable sleep (sleep scale times for _to_sleep seconds). Logs function name. Use VSLEEP() instead unless you’re absolutely sure what you’re doing.

Parameters:

_to_sleep

number of seconds to sleep is scale is 1

#define TAPI_WAIT_NETWORK

Wait for network action to complete. Typically, send() on one side and wait before non-blocing recv() on another side.

#define TAPI_WAIT_NETWORK_DELAY

Time to wait for a network activity, milliseconds.

#define TE_MAX_SCALE

Maximum allowed sleep scale

#define USLEEP(_to_sleep)

Scalable sleep (sleep scale times for _to_sleep microseconds).

Parameters:

_to_sleep

number of seconds to sleep is scale is 1

#define VSLEEP(_to_sleep, _msg)

Scalable sleep (sleep scale times for _to_sleep seconds) that logs extra information.

Parameters:

_to_sleep

number of seconds to sleep is scale is 1

_msg

message to be logged