Skip to content

Commit

Permalink
pw_bluetooth_proxy: Split RFCOMM tests into own file
Browse files Browse the repository at this point in the history
Move common test utilities to private test only library.

Change-Id: I0943dcaca4c70df6fc5211391552d431b904bdbe
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/252573
Reviewed-by: Ben Lawson <[email protected]>
Reviewed-by: David Rees <[email protected]>
Pigweed-Auto-Submit: Austin Foxley <[email protected]>
Lint: Lint 🤖 <[email protected]>
Docs-Not-Needed: Ben Lawson <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
  • Loading branch information
afoxley authored and CQ Bot Account committed Dec 6, 2024
1 parent b336566 commit 4954f2e
Show file tree
Hide file tree
Showing 7 changed files with 1,137 additions and 902 deletions.
19 changes: 19 additions & 0 deletions pw_bluetooth_proxy/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,34 @@ cc_library(
],
)

cc_library(
name = "test_utils",
testonly = True,
srcs = ["test_utils.cc"],
hdrs = ["pw_bluetooth_proxy_private/test_utils.h"],
deps = [
":pw_bluetooth_proxy",
"//pw_bluetooth:emboss_att",
"//pw_bluetooth:emboss_hci_commands",
"//pw_bluetooth:emboss_hci_common",
"//pw_bluetooth:emboss_hci_events",
"//pw_bluetooth:emboss_hci_h4",
"//pw_bluetooth:emboss_util",
"//pw_unit_test",
],
)

pw_cc_test(
name = "pw_bluetooth_proxy_test",
srcs = [
"h4_packet_test.cc",
"proxy_host_test.cc",
"rfcomm_fcs_test.cc",
"rfcomm_test.cc",
],
deps = [
":pw_bluetooth_proxy",
":test_utils",
"//pw_bluetooth:emboss_att",
"//pw_bluetooth:emboss_hci_commands",
"//pw_bluetooth:emboss_hci_common",
Expand Down
21 changes: 21 additions & 0 deletions pw_bluetooth_proxy/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,38 @@ pw_source_set("pw_bluetooth_proxy") {
]
}

pw_source_set("test_utils") {
# TODO: b/303282642 - Remove this testonly
testonly = pw_unit_test_TESTONLY

public_deps = [
":pw_bluetooth_proxy",
"$dir_pw_third_party/fuchsia:stdcompat",
"//pw_bluetooth:emboss_hci_commands",
"//pw_bluetooth:emboss_hci_common",
"//pw_bluetooth:emboss_hci_events",
"//pw_bluetooth:emboss_hci_h4",
"//pw_bluetooth:emboss_util",
"//pw_unit_test",
]
public = [ "pw_bluetooth_proxy_private/test_utils.h" ]
sources = [ "test_utils.cc" ]
visibility = [ ":*" ]
}

pw_test("pw_bluetooth_proxy_test") {
enable_if =
dir_pw_third_party_emboss != "" && pw_chrono_SYSTEM_CLOCK_BACKEND != ""
sources = [
"h4_packet_test.cc",
"proxy_host_test.cc",
"rfcomm_fcs_test.cc",
"rfcomm_test.cc",
]
include_dirs = [ "." ]
deps = [
":pw_bluetooth_proxy",
":test_utils",
"$dir_pw_third_party/fuchsia:stdcompat",
"//pw_bluetooth:emboss_att",
"//pw_bluetooth:emboss_hci_commands",
Expand Down
17 changes: 17 additions & 0 deletions pw_bluetooth_proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,30 @@ pw_add_library(pw_bluetooth_proxy STATIC
rfcomm_fcs.cc
)

pw_add_library(pw_bluetooth_proxy.test_utils STATIC
HEADERS
pw_bluetooth_proxy_private/test_utils.h
PUBLIC_DEPS
pw_bluetooth_proxy
pw_third_party.fuchsia.stdcompat
pw_bluetooth.emboss_hci_commands
pw_bluetooth.emboss_hci_common
pw_bluetooth.emboss_hci_events
pw_bluetooth.emboss_hci_h4
pw_unit_test
SOURCES
test_utils.cc
)

pw_add_test(pw_bluetooth_proxy.pw_bluetooth_proxy_test
SOURCES
proxy_host_test.cc
h4_packet_test.cc
rfcomm_fcs_test.cc
rfcomm_test.cc
PRIVATE_DEPS
pw_bluetooth_proxy
pw_bluetooth_proxy.test_utils
pw_third_party.fuchsia.stdcompat
pw_bluetooth.emboss_att
pw_bluetooth.emboss_hci_commands
Expand Down
Loading

0 comments on commit 4954f2e

Please sign in to comment.