Simon Glass | 93e2673 | 2022-10-29 19:47:11 -0600 | [diff] [blame^] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | ut command |
| 4 | ========== |
| 5 | |
| 6 | Synopis |
| 7 | ------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | ut [-r<runs>] [-f] [<suite> [<test>]] |
| 12 | |
| 13 | <runs> Number of times to run each test |
| 14 | -f Force 'manual' tests to run as well |
| 15 | <suite> Test suite to run, or `all` |
| 16 | <test> Name of single test to run |
| 17 | |
| 18 | Description |
| 19 | ----------- |
| 20 | |
| 21 | The ut command runs unit tests written in C. |
| 22 | |
| 23 | Typically the command is run on :ref:`arch/sandbox/sandbox:sandbox` since it |
| 24 | includes a near-complete set of emulators, no code-size limits, many CONFIG |
| 25 | options enabled and runs easily in CI without needing QEMU. It is also possible |
| 26 | to run some tests on real boards. |
| 27 | |
| 28 | For a list of available test suites, type `ut` by itself. |
| 29 | |
| 30 | Each test is normally run once, although those marked with `UT_TESTF_DM` are |
| 31 | run with livetree and flattree where possible. To run a test more than once, |
| 32 | use the `-r` flag. |
| 33 | |
| 34 | Manual tests are normally skipped by this command. Use `-f` to run them. See |
| 35 | See :ref:`develop/tests_writing:mixing python and c` for more information on |
| 36 | manual test. |
| 37 | |
| 38 | Generally all tests in the suite are run. To run just a single test from the |
| 39 | suite, provide the <test> argument. |
| 40 | |
| 41 | See :ref:`develop/tests_writing:writing c tests` for more information on how to |
| 42 | write unit tests. |
| 43 | |
| 44 | Example |
| 45 | ------- |
| 46 | |
| 47 | List available unit-test suites:: |
| 48 | |
| 49 | => ut |
| 50 | ut - unit tests |
| 51 | |
| 52 | Usage: |
| 53 | ut [-r] [-f] [<suite>] - run unit tests |
| 54 | -r<runs> Number of times to run each test |
| 55 | -f Force 'manual' tests to run as well |
| 56 | <suite> Test suite to run, or all |
| 57 | |
| 58 | Suites: |
| 59 | all - execute all enabled tests |
| 60 | addrmap - very basic test of addrmap command |
| 61 | bloblist - bloblist implementation |
| 62 | bootstd - standard boot implementation |
| 63 | compression - compressors and bootm decompression |
| 64 | dm - driver model |
| 65 | env - environment |
| 66 | fdt - fdt command |
| 67 | loadm - loadm command parameters and loading memory blob |
| 68 | lib - library functions |
| 69 | log - logging functions |
| 70 | mem - memory-related commands |
| 71 | overlay - device tree overlays |
| 72 | print - printing things to the console |
| 73 | setexpr - setexpr command |
| 74 | str - basic test of string functions |
| 75 | time - very basic test of time functions |
| 76 | unicode - Unicode functions |
| 77 | |
| 78 | Run one of the suites:: |
| 79 | |
| 80 | => ut bloblist |
| 81 | Running 14 bloblist tests |
| 82 | Test: bloblist_test_align: bloblist.c |
| 83 | Test: bloblist_test_bad_blob: bloblist.c |
| 84 | Test: bloblist_test_blob: bloblist.c |
| 85 | Test: bloblist_test_blob_ensure: bloblist.c |
| 86 | Test: bloblist_test_blob_maxsize: bloblist.c |
| 87 | Test: bloblist_test_checksum: bloblist.c |
| 88 | Test: bloblist_test_cmd_info: bloblist.c |
| 89 | Test: bloblist_test_cmd_list: bloblist.c |
| 90 | Test: bloblist_test_grow: bloblist.c |
| 91 | Test: bloblist_test_init: bloblist.c |
| 92 | Test: bloblist_test_reloc: bloblist.c |
| 93 | Test: bloblist_test_resize_fail: bloblist.c |
| 94 | Test: bloblist_test_resize_last: bloblist.c |
| 95 | Test: bloblist_test_shrink: bloblist.c |
| 96 | Failures: 0 |
| 97 | |
| 98 | Run just a single test in a suite:: |
| 99 | |
| 100 | => ut bloblist bloblist_test_grow |
| 101 | Test: bloblist_test_grow: bloblist.c |
| 102 | Failures: 0 |