1# bt-host 2 3## Test 4 5`$ fx test $dir_pw_bluetooth_sapphire/host` 6 7### Fuzz Testing 8 9bt-host contains fuzz tests for several libraries. Make sure to include the desired fuzzing target 10in your `fx set`. For example, to include all bt-host fuzzing targets, use: 11 12``` 13fx set core.x64 --fuzz-with asan --with $dir_pw_bluetooth_sapphire/host:fuzzers 14``` 15 16Before running the test, ensure QEMU is running. 17 18Run `fx fuzz list` to see the full list of available fuzzing targets. To run a specific fuzz test, 19do `fx fuzz $package/$fuzzer` where `$package` and `$fuzzer` match those reported by `fx fuzz list`. 20 21 22 23See the [fuzzing documentation](https://fuchsia.dev/fuchsia-src/development/testing/fuzzing/overview?hl=en) 24for a more in depth guide. 25 26## Inspect 27 28`bt-host` uses the [standard driver processes](https://fuchsia.googlesource.com/fuchsia/+/57edce1df72b148c33e8f219bddbd038cdbb861b/zircon/system/ulib/inspect/) to expose its inspect hierarchy 29to the Fuchsia system. 30 31### Usage 32 33To query the current state of the `bt-host` Inspect hierarchy through `ffx` tooling, run 34 35`ffx inspect show bootstrap/driver_manager --file class/bt-host/000.inspect` 36 37### Hierarchy 38``` 39adapter: 40 adapter_id 41 hci_version 42 bredr_max_num_packets 43 bredr_max_data_length 44 le_max_num_packets 45 le_max_data_length 46 sco_max_num_packets 47 sco_max_data_length 48 lmp_features 49 le_features 50 hci: 51 command_channel: 52 allowed_command_packets 53 next_event_handler_id 54 next_transaction_id 55 acl_data_channel: 56 bredr: 57 num_sent_packets 58 le: 59 num_sent_packets 60 independent_from_bredr 61 low_energy_discovery_manager: 62 state 63 paused 64 failed_count 65 scan_interval_ms 66 scan_window_ms 67 bredr_discovery_manager: 68 discoverable_sessions 69 pending_discoverable 70 discoverable_sessions_count 71 last_discoverable_length_sec 72 discovery_sessions 73 inquiry_sessions_count 74 last_inquiry_length_sec 75 metrics: 76 bredr: 77 open_l2cap_channel_requests 78 outgoing_connection_requests 79 pair_requests 80 request_discoverable_events 81 request_discovery_events 82 set_connectable_false_events 83 set_connectable_true_events 84 le: 85 open_l2cap_channel_requests 86 outgoing_connection_requests 87 pair_requests 88 start_advertising_events 89 start_discovery_events 90 stop_advertising_events 91 l2cap: 92 logical_links: 93 logical_link_0x0: 94 handle 95 link_type 96 flush_timeout_ms 97 channels: 98 channel_0x0: 99 local_id 100 remote_id 101 psm 102 services: 103 service_0x0: 104 psm 105 peer_cache: 106 metrics: 107 bredr: 108 bond_failure_events 109 bond_success_events 110 connection_events 111 disconnection_events 112 le: 113 bond_failure_events 114 bond_success_events 115 connection_events 116 disconnection_events 117 peer_0x0: 118 peer_id 119 technology 120 address 121 connectable 122 temporary 123 features 124 hci_version 125 manufacturer 126 bredr_data: 127 connection_state 128 services 129 link_key: 130 security_properties: 131 encrypted 132 secure_connections 133 authenticated 134 level 135 key_type 136 le_data: 137 connection_state 138 bonded 139 features 140 sdp_server: 141 record_0x2: 142 record 143 // TODO(fxbug.dev/42129247): Migrate this to UIntArray when support is better. 144 registered_psms: 145 psm_0x0: 146 psm 147 psm_0x1: 148 psm 149 record_0x3: 150 record 151 registered_psms: 152 (none) 153 low_energy_connection_manager: 154 disconnect_explicit_disconnect_count 155 disconnect_link_error_count 156 disconnect_remote_disconnection_count 157 disconnect_zero_ref_count 158 incoming_connection_failure_count 159 incoming_connection_success_count 160 outgoing_connection_failure_count 161 outgoing_connection_success_count 162 recent_connection_failures 163 pending_requests: 164 pending_request_0x0: 165 peer_id 166 callbacks 167 outbound_connector: 168 peer_id 169 is_outbound 170 connection_attempt 171 state 172 connections: 173 connection_0x0: 174 peer_id 175 peer_address 176 ref_count 177 bredr_connection_manager: 178 security_mode 179 disconnect_acl_link_error_count 180 disconnect_interrogation_failed_count 181 disconnect_local_api_request_count 182 disconnect_pairing_failed_count 183 disconnect_peer_disconnection_count 184 interrogation_complete_count 185 incoming: 186 connection_attempts 187 failed_connections 188 successful_connections 189 outgoing: 190 connection_attempts 191 failed_connections 192 successful_connections 193 connection_requests: 194 request_0x0: 195 peer_id 196 has_incoming 197 callbacks 198 connections: 199 connection_0x0: 200 peer_id 201 pairing_state_manager: 202 pairing_state_type 203 legacy_pairing_state: 204 encryption_status 205 security_properties: 206 encrypted 207 secure_connections 208 authenticated 209 level 210 key_type 211 secure_simple_pairing_state: 212 encryption_status 213 security_properties: 214 encrypted 215 secure_connections 216 authenticated 217 level 218 key_type 219 last_disconnected: 220 0: 221 peer_id 222 duration_s 223 @time 224``` 225