• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

CMakeLists.txtD11-Mar-202422.9 KiB1,232959

README.mdD11-Mar-20241.5 KiB5838

test_address_sanitizer.cppD11-Mar-20241.9 KiB4814

test_aes.cppD11-Mar-20249.8 KiB264162

test_array.cppD11-Mar-202412.7 KiB432291

test_binary_search.cppD11-Mar-20243.7 KiB10152

test_checksum.cppD11-Mar-202416.8 KiB482298

test_child.cppD11-Mar-202412 KiB353234

test_child_table.cppD11-Mar-202413.9 KiB404273

test_cmd_line_parser.cppD11-Mar-202416.3 KiB363277

test_data.cppD11-Mar-20247.6 KiB213145

test_dns.cppD11-Mar-202462.9 KiB1,4911,074

test_dns_client.cppD11-Mar-202441.8 KiB1,139755

test_dso.cppD11-Mar-202450.5 KiB1,236913

test_ecdsa.cppD11-Mar-20248.4 KiB198124

test_flash.cppD11-Mar-20245.8 KiB197119

test_frame_builder.cppD11-Mar-202410.1 KiB225158

test_hdlc.cppD11-Mar-202429.1 KiB657448

test_heap.cppD11-Mar-20245.4 KiB186110

test_heap_array.cppD11-Mar-202415.4 KiB495346

test_heap_string.cppD11-Mar-202410.6 KiB320220

test_hkdf_sha256.cppD11-Mar-20248.9 KiB168104

test_hmac_sha256.cppD11-Mar-202411.1 KiB294199

test_ip4_header.cppD11-Mar-20245.5 KiB13383

test_ip6_header.cppD11-Mar-20245.7 KiB14390

test_ip_address.cppD11-Mar-202435.6 KiB892679

test_link_metrics_manager.cppD11-Mar-20248.2 KiB223144

test_link_quality.cppD11-Mar-202418.4 KiB547377

test_linked_list.cppD11-Mar-202414.9 KiB447324

test_lowpan.cppD11-Mar-202478.8 KiB2,1011,251

test_lowpan.hppD11-Mar-20249.1 KiB291105

test_mac_frame.cppD11-Mar-202431.3 KiB784553

test_macros.cppD11-Mar-20244.9 KiB14580

test_meshcop.cppD11-Mar-20247 KiB165105

test_message.cppD11-Mar-202415.9 KiB410265

test_message_queue.cppD11-Mar-202412.8 KiB351222

test_mle.cppD11-Mar-20247.4 KiB187121

test_multicast_listeners_table.cppD11-Mar-20247.4 KiB201120

test_nat64.cppD11-Mar-202414.6 KiB315216

test_ndproxy_table.cppD11-Mar-20244.3 KiB11656

test_netif.cppD11-Mar-20247.8 KiB216133

test_network_data.cppD11-Mar-202437.9 KiB942755

test_network_name.cppD11-Mar-20245.1 KiB12470

test_platform.cppD11-Mar-202418.3 KiB627432

test_platform.hD11-Mar-20242.2 KiB5217

test_pool.cppD11-Mar-20244.2 KiB13780

test_power_calibration.cppD11-Mar-20247 KiB152100

test_priority_queue.cppD11-Mar-202415.6 KiB378264

test_pskc.cppD11-Mar-20245.4 KiB11878

test_routing_manager.cppD11-Mar-2024131.6 KiB3,4762,018

test_serial_number.cppD11-Mar-20249.3 KiB229160

test_smart_ptrs.cppD11-Mar-202412.2 KiB483319

test_spinel_buffer.cppD11-Mar-202444 KiB1,065804

test_spinel_decoder.cppD11-Mar-202424 KiB650462

test_spinel_encoder.cppD11-Mar-202414.2 KiB369278

test_srp_server.cppD11-Mar-202435.5 KiB1,049595

test_string.cppD11-Mar-202415.1 KiB395288

test_timer.cppD11-Mar-202428.2 KiB693463

test_tlv.cppD11-Mar-20247.1 KiB195113

test_toolchain.cppD11-Mar-20245.5 KiB180119

test_toolchain_c.cD11-Mar-20242 KiB5016

test_trickle_timer.cppD11-Mar-202415.5 KiB517296

test_util.cppD11-Mar-20242.5 KiB7233

test_util.hD11-Mar-20244.5 KiB8834

test_util.hppD11-Mar-20242.1 KiB476

README.md

1# OpenThread Unit Tests
2
3This page describes how to build and run OpenThread unit tests. It will be helpful for developers to debug failed unit test cases if they got one in CI or to add some new test cases.
4
5## Build Simulation
6
7The unit tests cannot be built solely without building the whole project. So first build OpenThread on the simulation platform, which will also build all unit tests:
8
9```
10# Go to the root directory of OpenThread
11$ script/cmake-build simulation
12```
13
14## List all tests
15
16To see what tests are available in OpenThread:
17
18```
19# Make sure you are at the simulation build directory (build/simulation)
20$ ctest -N
21```
22
23## Run the Unit Tests
24
25To run all the unit tests:
26
27```
28# Make sure you are at the simulation build directory (build/simulation)
29$ ctest
30```
31
32To run a specific unit test, for example, `ot-test-spinel`:
33
34```
35# Make sure you are at the simulation build directory (build/simulation)
36$ ctest -R ot-test-spinel
37```
38
39## Update a Test Case
40
41If you are developing a unit test case and have made some changes in the test source file, you will need rebuild the test before running it:
42
43```
44# Make sure you are at the simulation build directory (build/simulation)
45$ ninja <test_name>
46```
47
48This will only build the test and take a short time.
49
50If any changes or fixes were made to the OpenThread code, then you'll need to rebuild the entire project:
51
52```
53# Make sure you are at the simulation build directory (build/simulation)
54$ ninja
55```
56
57This will build the updated OpenThread code as well as the test cases.
58