From 479f99dcab41a325597496611ec511758213befc Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Sat, 1 May 2021 07:15:40 -0700 Subject: [PATCH] GD: Split tests into module vs unit tests Move simpler, single-threaded tests into their own set of unit tests. Bug: 176832968 Test: atest bluetooth_test_gd_unit Tag: #gd-refactor Change-Id: Ic3fa06454d119764aa547f975843583c00c32fc4 --- gd/Android.bp | 82 +++++++++++++++++++++++++++++++++++++++++++++++++- gd/hci/Android.bp | 16 +++++++--- gd/l2cap/Android.bp | 8 ++++- gd/security/Android.bp | 10 ++++-- gd/storage/Android.bp | 8 ++++- 5 files changed, 114 insertions(+), 10 deletions(-) diff --git a/gd/Android.bp b/gd/Android.bp index f1444c73f..eb5cac294 100644 --- a/gd/Android.bp +++ b/gd/Android.bp @@ -280,6 +280,87 @@ cc_binary { } cc_test { + name: "bluetooth_test_gd_unit", + test_suites: ["device-tests"], + defaults: [ + "gd_defaults", + "gd_clang_coverage_bin", + ], + host_supported: true, + test_options: { + unit_test: true, + }, + target: { + linux: { + srcs: [ + ":BluetoothOsTestSources_linux_generic", + ], + }, + host: { + srcs: [ + ":BluetoothHalTestSources_hci_host", + ":BluetoothOsTestSources_host", + ], + }, + android: { + srcs: [ + ":BluetoothHalTestSources_hci_android_hidl", + ":BluetoothOsTestSources_android", + ], + shared_libs: [ + "android.hardware.bluetooth@1.0", + "android.hardware.bluetooth@1.1", + "android.system.suspend.control-V1-ndk", + "libbinder_ndk", + "libhidlbase", + "libutils", + "libcutils", + "libstatslog", + ], + }, + }, + srcs: [ + "module_unittest.cc", + "stack_manager_unittest.cc", + ":BluetoothCommonTestSources", + ":BluetoothCryptoToolboxTestSources", + ":BluetoothDumpsysTestSources", + ":BluetoothHalTestSources", + ":BluetoothHciUnitTestSources", + ":BluetoothL2capUnitTestSources", + ":BluetoothPacketTestSources", + ":BluetoothShimTestSources", + ":BluetoothSecurityUnitTestSources", + ":BluetoothStorageUnitTestSources", + ], + generated_headers: [ + "BluetoothGeneratedBundlerSchema_h_bfbs", + "BluetoothGeneratedDumpsysBundledSchema_h", + "BluetoothGeneratedDumpsysBundledTestSchema_h", + "BluetoothGeneratedDumpsysDataSchema_h", + "BluetoothGeneratedDumpsysTestData_h", + "BluetoothGeneratedPackets_h", + ], + static_libs: [ + "libbluetooth-protos", + "libbluetooth_gd", + "libc++fs", + "libflatbuffers-cpp", + "libgmock", + "libbluetooth_rust_interop", + ], + shared_libs: [ + "libchrome", + "libcrypto", + "libgrpc++", + "libgrpc_wrap", + ], + sanitize: { + address: true, + }, +} + +cc_test { name: "bluetooth_test_gd", test_suites: ["device-tests"], defaults: [ @@ -333,7 +414,6 @@ cc_test { ":BluetoothNeighborTestSources", ":BluetoothPacketTestSources", ":BluetoothSecurityTestSources", - ":BluetoothShimTestSources", ":BluetoothStorageTestSources", ], generated_headers: [ diff --git a/gd/hci/Android.bp b/gd/hci/Android.bp index 6561334b6..662a8c491 100644 --- a/gd/hci/Android.bp +++ b/gd/hci/Android.bp @@ -30,21 +30,27 @@ filegroup { } filegroup { - name: "BluetoothHciTestSources", + name: "BluetoothHciUnitTestSources", srcs: [ "acl_builder_test.cc", - "acl_manager/round_robin_scheduler_test.cc", - "acl_manager_test.cc", "address_unittest.cc", "address_with_type_test.cc", "class_of_device_unittest.cc", + "hci_packets_test.cc", + "uuid_unittest.cc", + ], +} + +filegroup { + name: "BluetoothHciTestSources", + srcs: [ + "acl_manager/round_robin_scheduler_test.cc", + "acl_manager_test.cc", "controller_test.cc", "hci_layer_test.cc", - "hci_packets_test.cc", "le_address_manager_test.cc", "le_advertising_manager_test.cc", "le_scanning_manager_test.cc", - "uuid_unittest.cc", ], } diff --git a/gd/l2cap/Android.bp b/gd/l2cap/Android.bp index 13852229e..bdec3a653 100644 --- a/gd/l2cap/Android.bp +++ b/gd/l2cap/Android.bp @@ -69,11 +69,17 @@ filegroup { "internal/receiver_test.cc", "internal/scheduler_fifo_test.cc", "internal/sender_test.cc", - "l2cap_packet_test.cc", "le/internal/dynamic_channel_service_manager_test.cc", "le/internal/fixed_channel_impl_test.cc", "le/internal/fixed_channel_service_manager_test.cc", "le/internal/link_manager_test.cc", + ], +} + +filegroup { + name: "BluetoothL2capUnitTestSources", + srcs: [ + "l2cap_packet_test.cc", "signal_id_test.cc", ], } diff --git a/gd/security/Android.bp b/gd/security/Android.bp index 1a7436495..17ab2b901 100644 --- a/gd/security/Android.bp +++ b/gd/security/Android.bp @@ -28,11 +28,17 @@ filegroup { } filegroup { - name: "BluetoothSecurityTestSources", + name: "BluetoothSecurityUnitTestSources", srcs: [ "ecc/multipoint_test.cc", - "pairing_handler_le_unittest.cc", "test/ecdh_keys_test.cc", + ], +} + +filegroup { + name: "BluetoothSecurityTestSources", + srcs: [ + "pairing_handler_le_unittest.cc", "test/fake_l2cap_test.cc", "test/pairing_handler_le_pair_test.cc", ":BluetoothSecurityChannelTestSources", diff --git a/gd/storage/Android.bp b/gd/storage/Android.bp index ce900a6e1..6644da1d4 100644 --- a/gd/storage/Android.bp +++ b/gd/storage/Android.bp @@ -24,7 +24,7 @@ filegroup { } filegroup { - name: "BluetoothStorageTestSources", + name: "BluetoothStorageUnitTestSources", srcs: [ "adapter_config_test.cc", "classic_device_test.cc", @@ -34,6 +34,12 @@ filegroup { "le_device_test.cc", "legacy_config_file_test.cc", "mutation_test.cc", + ], +} + +filegroup { + name: "BluetoothStorageTestSources", + srcs: [ "storage_module_test.cc", ], } -- 2.11.0