RTEMS: Test Support

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Test Support
API

Test support functions. More...

## Data Structures
struct | rtems_test_parallel_context
| Internal context for parallel job execution. More...
struct | rtems_test_parallel_job
| Basic parallel job description. More...

## Macros
#define | RTEMS_TEST_INITIAL_EXTENSION { NULL, NULL, NULL, NULL, NULL, NULL, NULL, rtems_test_fatal_extension }
| Initial extension for tests.
#define | TEST_STATE RTEMS_TEST_STATE_PASS
#define | RTEMS_TEST_PARALLEL_PROCESSOR_MAX 32

## Typedefs
typedef struct rtems_test_parallel_job | rtems_test_parallel_job
typedef void(* | rtems_test_parallel_worker_setup) (rtems_test_parallel_context *ctx, size_t worker_index, rtems_id worker_id)
| Worker task setup handler.

## Enumerations
enum | RTEMS_TEST_STATE { RTEMS_TEST_STATE_PASS , RTEMS_TEST_STATE_FAIL , RTEMS_TEST_STATE_USER_INPUT , RTEMS_TEST_STATE_INDETERMINATE , RTEMS_TEST_STATE_BENCHMARK }
| Test states.

## Functions
void | rtems_test_fatal_extension (rtems_fatal_source source, bool always_set_to_false, rtems_fatal_code code)
| Fatal extension for tests.
int | rtems_test_begin (const char *name, const RTEMS_TEST_STATE state)
| Prints a begin of test message using printf().
int | rtems_test_end (const char *name)
| Prints an end of test message using printf().
void | rtems_test_exit (int status) RTEMS_NO_RETURN
| Exit the test without calling exit() since it closes stdin, etc and pulls in stdio code.
int | rtems_test_printf (const char *format,...) RTEMS_PRINTFLIKE(1
| Prints via the RTEMS printer.
void | rtems_test_parallel (rtems_test_parallel_context *ctx, rtems_test_parallel_worker_setup worker_setup, const rtems_test_parallel_job *jobs, size_t job_count)
| Runs a bunch of jobs in parallel on all processors of the system.
void | rtems_test_busy_cpu_usage (time_t seconds, long nanoseconds)
| Performs a busy loop for the specified seconds and nanoseconds based on the CPU usage of the executing thread.
void | rtems_test_busy (uint_fast32_t count)
| Performs a busy loop with the specified iteration count.
uint_fast32_t | rtems_test_get_one_tick_busy_count (void)
| Returns a count value for rtems_test_busy() which yields roughly a duration of one clock tick.

## Variables
const char | rtems_test_name []
| Each test must define a test name string.
rtems_printer | rtems_test_printer
| Each test must define a printer.

## Detailed Description

Test support functions.

## Typedef Documentation

## ◆ rtems_test_parallel_worker_setup

typedef void(* rtems_test_parallel_worker_setup) (rtems_test_parallel_context *ctx, size_t worker_index, rtems_id worker_id)

Worker task setup handler.

Called during rtems_test_parallel() to optionally setup a worker task before it is started.

Parameters

  [in] | ctx | The parallel context.
  [in] | worker_index | The worker index.
  [in] | worker_id | The worker task identifier.

## Function Documentation

## ◆ rtems_test_begin()

int rtems_test_begin | ( | const char * | name,
|  | const RTEMS_TEST_STATE | state
| ) |  |

Prints a begin of test message using printf().

Returns
  As specified by printf().

## ◆ rtems_test_busy()

void rtems_test_busy | ( | uint_fast32_t | count | ) |

Performs a busy loop with the specified iteration count.

This function is optimized to not perform memory accesses and should have a small jitter.

Parameters

  [in] | count | The iteration count.

## ◆ rtems_test_busy_cpu_usage()

void rtems_test_busy_cpu_usage | ( | time_t | seconds,
|  | long | nanoseconds
| ) |  |

Performs a busy loop for the specified seconds and nanoseconds based on the CPU usage of the executing thread.

This function continuously reads the CPU usage of the executing thread. This operation may lead to a scheduler instance lock contention in SMP configurations.

Parameters

  [in] | seconds | The busy seconds.
  [in] | nanoseconds | The busy nanoseconds.

## ◆ rtems_test_end()

int rtems_test_end | ( | const char * | name | ) |

Prints an end of test message using printf().

Returns
  As specified by printf().

## ◆ rtems_test_parallel()

void rtems_test_parallel | ( | rtems_test_parallel_context * | ctx,
|  | rtems_test_parallel_worker_setup | worker_setup,
|  | const rtems_test_parallel_job * | jobs,
|  | size_t | job_count
| ) |  |

Runs a bunch of jobs in parallel on all processors of the system.

The worker tasks inherit the priority of the executing task.

There are SMP barriers before and after the job body.

Parameters

  [in] | ctx | The parallel context.
  [in] | worker_setup | Optional handler to setup a worker task before it is started.
  [in] | jobs | The table of jobs.
  [in] | job_count | The count of jobs in the job table.

## ◆ rtems_test_printf()

int rtems_test_printf | ( | const char * | format,
|  |  | ...
| ) |  |

Prints via the RTEMS printer.

Returns
  As specified by printf().