Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Macros | |
#define | ztest_unit_test_setup_teardown(fn, setup, teardown) |
Define a test with setup and teardown functions. More... | |
#define | ztest_user_unit_test_setup_teardown(fn, setup, teardown) |
Define a user mode test with setup and teardown functions. More... | |
#define | ztest_unit_test(fn) ztest_unit_test_setup_teardown(fn, unit_test_noop, unit_test_noop) |
Define a test function. More... | |
#define | ztest_user_unit_test(fn) ztest_user_unit_test_setup_teardown(fn, unit_test_noop, unit_test_noop) |
Define a test function that should run as a user thread. More... | |
#define | ztest_1cpu_unit_test(fn) ztest_unit_test_setup_teardown(fn, z_test_1cpu_start, z_test_1cpu_stop) |
Define a SMP-unsafe test function. More... | |
#define | ztest_1cpu_user_unit_test(fn) ztest_user_unit_test_setup_teardown(fn, z_test_1cpu_start, z_test_1cpu_stop) |
Define a SMP-unsafe test function that should run as a user thread. More... | |
#define | ZTEST_DMEM K_APP_DMEM(ztest_mem_partition) |
#define | ZTEST_BMEM K_APP_BMEM(ztest_mem_partition) |
#define | ZTEST_SECTION K_APP_DMEM_SECTION(ztest_mem_partition) |
#define | ztest_test_suite(suite, ...) |
Define a test suite. More... | |
#define | ztest_run_test_suite(suite) z_ztest_run_test_suite(#suite, _##suite) |
Run the specified test suite. More... | |
Functions | |
void | ztest_test_fail (void) |
Fail the currently running test. More... | |
void | ztest_test_pass (void) |
Pass the currently running test. More... | |
void | ztest_test_skip (void) |
Skip the current test. More... | |
static void | unit_test_noop (void) |
Do nothing, successfully. More... | |
Variables | |
struct k_mem_partition | ztest_mem_partition |
This module eases the testing process by providing helpful macros and other testing structures.
#define ztest_1cpu_unit_test | ( | fn | ) | ztest_unit_test_setup_teardown(fn, z_test_1cpu_start, z_test_1cpu_stop) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Define a SMP-unsafe test function.
As ztest_unit_test(), but ensures all test code runs on only one CPU when in SMP.
fn | Test function |
#define ztest_1cpu_user_unit_test | ( | fn | ) | ztest_user_unit_test_setup_teardown(fn, z_test_1cpu_start, z_test_1cpu_stop) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Define a SMP-unsafe test function that should run as a user thread.
As ztest_user_unit_test(), but ensures all test code runs on only one CPU when in SMP.
fn | Test function |
#define ZTEST_BMEM K_APP_BMEM(ztest_mem_partition) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
#define ZTEST_DMEM K_APP_DMEM(ztest_mem_partition) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
#define ztest_run_test_suite | ( | suite | ) | z_ztest_run_test_suite(#suite, _##suite) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Run the specified test suite.
suite | Test suite to run. |
#define ZTEST_SECTION K_APP_DMEM_SECTION(ztest_mem_partition) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
#define ztest_test_suite | ( | suite, | |
... | |||
) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Define a test suite.
This function should be called in the following fashion:
suite | Name of the testing suite |
#define ztest_unit_test | ( | fn | ) | ztest_unit_test_setup_teardown(fn, unit_test_noop, unit_test_noop) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Define a test function.
This should be called as an argument to ztest_test_suite.
fn | Test function |
#define ztest_unit_test_setup_teardown | ( | fn, | |
setup, | |||
teardown | |||
) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Define a test with setup and teardown functions.
This should be called as an argument to ztest_test_suite. The test will be run in the following order: setup, fn, teardown.
fn | Main test function |
setup | Setup function |
teardown | Teardown function |
#define ztest_user_unit_test | ( | fn | ) | ztest_user_unit_test_setup_teardown(fn, unit_test_noop, unit_test_noop) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Define a test function that should run as a user thread.
This should be called as an argument to ztest_test_suite. If CONFIG_USERSPACE is not enabled, this is functionally identical to ztest_unit_test().
fn | Test function |
#define ztest_user_unit_test_setup_teardown | ( | fn, | |
setup, | |||
teardown | |||
) |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Define a user mode test with setup and teardown functions.
This should be called as an argument to ztest_test_suite. The test will be run in the following order: setup, fn, teardown. ALL test functions will be run in user mode, and only if CONFIG_USERSPACE is enabled, otherwise this is the same as ztest_unit_test_setup_teardown().
fn | Main test function |
setup | Setup function |
teardown | Teardown function |
#include <subsys/testsuite/ztest/include/ztest_test.h>
Do nothing, successfully.
Unit test / setup function / teardown function that does nothing, successfully. Can be used as a parameter to ztest_unit_test_setup_teardown().
#include <subsys/testsuite/ztest/include/ztest_test.h>
Fail the currently running test.
This is the function called from failed assertions and the like. You probably don't need to call it yourself.
#include <subsys/testsuite/ztest/include/ztest_test.h>
Pass the currently running test.
Normally a test passes just by returning without an assertion failure. However, if the success case for your test involves a fatal fault, you can call this function from k_sys_fatal_error_handler to indicate that the test passed before aborting the thread.
#include <subsys/testsuite/ztest/include/ztest_test.h>
Skip the current test.
|
extern |
#include <subsys/testsuite/ztest/include/ztest_test.h>