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 num_queue_packets 57 num_overflow_packets 58 num_recent_overflow_packets 59 bredr: 60 num_sent_packets 61 le: 62 num_sent_packets 63 independent_from_bredr 64 metrics: 65 send_latency: 66 50th_percentile_us 67 95th_percentile_us 68 99th_percentile_us 69 send_size: 70 10th_percentile_bytes 71 50th_percentile_bytes 72 90th_percentile_bytes 73 low_energy_discovery_manager: 74 state 75 paused 76 failed_count 77 scan_interval_ms 78 scan_window_ms 79 bredr_discovery_manager: 80 discoverable_sessions 81 pending_discoverable 82 discoverable_sessions_count 83 last_discoverable_length_sec 84 discovery_sessions 85 inquiry_sessions_count 86 last_inquiry_length_sec 87 metrics: 88 bredr: 89 open_l2cap_channel_requests 90 outgoing_connection_requests 91 pair_requests 92 request_discoverable_events 93 request_discovery_events 94 set_connectable_false_events 95 set_connectable_true_events 96 le: 97 outgoing_connection_requests 98 pair_requests 99 start_advertising_events 100 start_discovery_events 101 stop_advertising_events 102 l2cap: 103 logical_links: 104 logical_link_0x0: 105 handle 106 link_type 107 flush_timeout_ms 108 channels: 109 channel_0x0: 110 local_id 111 remote_id 112 psm 113 services: 114 service_0x0: 115 psm 116 peer_cache: 117 metrics: 118 bredr: 119 bond_failure_events 120 bond_success_events 121 connection_events 122 disconnection_events 123 le: 124 bond_failure_events 125 bond_success_events 126 connection_events 127 disconnection_events 128 peer_0x0: 129 peer_id 130 technology 131 address 132 connectable 133 temporary 134 features 135 hci_version 136 manufacturer 137 bredr_data: 138 connection_state 139 services 140 link_key: 141 security_properties: 142 encrypted 143 secure_connections 144 authenticated 145 level 146 key_type 147 le_data: 148 connection_state 149 bonded 150 features 151 sdp_server: 152 record_0x2: 153 record 154 // TODO(fxbug.dev/42129247): Migrate this to UIntArray when support is better. 155 registered_psms: 156 psm_0x0: 157 psm 158 psm_0x1: 159 psm 160 record_0x3: 161 record 162 registered_psms: 163 (none) 164 low_energy_connection_manager: 165 disconnect_explicit_disconnect_count 166 disconnect_link_error_count 167 disconnect_remote_disconnection_count 168 disconnect_zero_ref_count 169 incoming_connection_failure_count 170 incoming_connection_success_count 171 outgoing_connection_failure_count 172 outgoing_connection_success_count 173 recent_connection_failures 174 pending_requests: 175 pending_request_0x0: 176 peer_id 177 callbacks 178 outbound_connector: 179 peer_id 180 is_outbound 181 connection_attempt 182 state 183 connections: 184 connection_0x0: 185 peer_id 186 peer_address 187 ref_count 188 bredr_connection_manager: 189 security_mode 190 disconnect_acl_link_error_count 191 disconnect_interrogation_failed_count 192 disconnect_local_api_request_count 193 disconnect_pairing_failed_count 194 disconnect_peer_disconnection_count 195 interrogation_complete_count 196 incoming: 197 connection_attempts 198 failed_connections 199 successful_connections 200 outgoing: 201 connection_attempts 202 failed_connections 203 successful_connections 204 connection_requests: 205 request_0x0: 206 peer_id 207 has_incoming 208 callbacks 209 connections: 210 connection_0x0: 211 peer_id 212 pairing_state: 213 encryption_status 214 security_properties: 215 encrypted 216 secure_connections 217 authenticated 218 level 219 key_type 220 last_disconnected: 221 0: 222 peer_id 223 duration_s 224 @time 225``` 226