Lines Matching +full:driver +full:- +full:bar
1 .. _test-framework:
19 * ``suite_name`` - The name of the suite. This name must be unique within a single binary.
20 * :c:type:`ztest_suite_predicate_t` - An optional predicate function to allow choosing when the
23 * :c:type:`ztest_suite_setup_t` - An optional setup function which returns a test fixture. This
25 * :c:type:`ztest_suite_before_t` - An optional before function which will run before every single
27 * :c:type:`ztest_suite_after_t` - An optional after function which will run after every single
29 * :c:type:`ztest_suite_teardown_t` - An optional teardown function which will run at the end of
34 .. code-block:: C
41 return ((const struct test_state*)global_state)->x == 5;
51 * :c:macro:`ZTEST` ``(suite_name, test_name)`` - Which can be used to add a test by ``test_name`` t…
53 * :c:macro:`ZTEST_P` ``(suite_name, test_name)`` - Add a parameterized test to a given suite by spe…
56 * :c:macro:`ZTEST_USER` ``(suite_name, test_name)`` - Which behaves the same as :c:macro:`ZTEST`, o…
59 * :c:macro:`ZTEST_F` ``(suite_name, test_name)`` - Which behaves the same as :c:macro:`ZTEST`, only
62 * :c:macro:`ZTEST_USER_F` ``(suite_name, test_name)`` - Which combines the fixture feature of
72 .. code-block:: C
88 fixture->max_size = 256;
96 memset(fixture->buff, 0, fixture->max_size);
97 fixture->size = 0;
109 zassert_equal(0, fixture->size);
110 zassert_equal(256, fixture->max_size);
128 .. code-block:: C
159 .. code-block:: C
187 Assuming there's a board with several steps in the power-on sequence a test suite can be written
191 .. code-block:: C
218 Quick start - Integration testing
222 To make a test application for the **bar** component of **foo**, you should copy the
223 sample folder to ``tests/foo/bar`` and edit files there adjusting for your test
229 .. code-block:: console
231 ./scripts/twister -T tests/foo/bar/
233 To select just one of the test scenarios, run Twister with ``--scenario`` command:
235 .. code-block:: console
237 ./scripts/twister --scenario tests/foo/bar/your.test.scenario.name
239 In the command line above ``tests/foo/bar`` is the path to your test application and
290 .. code-block:: C
314 .. code-block:: console
316 ./scripts/twister --list-tests -T tests/kernel
321 Special- or architecture-specific tests cannot run on all
325 conditionals inside the test suite is sub-optimal. Tests that need
330 .. code-block:: C
354 Quick start - Unit testing
369 .. code-block:: cmake
401 high-level test application, particularly when tests do too
406 - Why not pre-scan with CPP and then parse? or post scan the ELF file?
408 If C pre-processing or building fails because of any issue, then we
411 - Why not declare them in the YAML test configuration?
415 themselves -- only one file to update when changes are made
457 .. code-block:: C
469 - :kconfig:option:`CONFIG_ZTRESS_MAX_THREADS` - number of supported threads.
470 - :kconfig:option:`CONFIG_ZTRESS_STACK_SIZE` - Stack size of created threads.
471 - :kconfig:option:`CONFIG_ZTRESS_REPORT_PROGRESS_MS` - Test progress report interval.
491 ``zassert_equal(buf->ref, 2, "Invalid refcount")``:
493 .. code-block:: none
495 … Assertion failed at main.c:62: test_get_single_buffer: Invalid refcount (buf->ref not equal to 2)
512 .. code-block:: C
514 zexpect_equal(buf->ref, 2, "Invalid refcount");
515 zexpect_equal(buf->ref, 1337, "Invalid refcount");
519 .. code-block:: none
521 START - test_get_single_buffer
522 …Expectation failed at main.c:62: test_get_single_buffer: Invalid refcount (buf->ref not equal to 2)
523 …Expectation failed at main.c:63: test_get_single_buffer: Invalid refcount (buf->ref not equal to 1…
524 FAIL - test_get_single_buffer in 0.0 seconds
538 ``zassume_equal(buf->ref, 2, "Invalid refcount")``:
540 .. code-block::none
542 START - test_get_single_buffer
543 … Assumption failed at main.c:62: test_get_single_buffer: Invalid refcount (buf->ref not equal to 2)
544 SKIP - test_get_single_buffer in 0.0 seconds
555 .. _mocking-fff:
563 .. code-block:: C
567 Zephyr provides several FFF-based fake drivers which can be used as either stubs or mocks. Fake
568 driver instances are configured via :ref:`devicetree` and :ref:`kconfig`. See the following
571 - :dtcompatible:`zephyr,fake-can`
572 - :dtcompatible:`zephyr,fake-eeprom`
575 See :ref:`FFF Extensions <fff-extensions>`.
589 .. code-block:: C
603 twister with ``--seed``.
624 .. code-block:: bash
626 $ zephyr.exe -list
627 $ zephyr.exe -test="fixture_tests::test_fixture_pointer,framework_tests::test_assert_mem_equal"
628 $ zephyr.exe -test="framework_tests::*"
631 .. _fff-extensions: