blob: a0f19d4ecb4670e4af03698df87299a0d0d049f2 [file] [edit]
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
package(
default_applicable_licenses = ["//:license"],
default_visibility = ["//:__subpackages__"],
)
filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//src/rust:__pkg__"],
)
rust_library(
name = "panic_handler",
srcs = ["panic_handler.rs"],
deps = [
"//src/main/protobuf:failure_details_rust_proto",
"@com_google_protobuf//rust:protobuf",
],
)
rust_binary(
name = "panic_handler_test_helper",
testonly = True,
srcs = ["panic_handler_test_helper.rs"],
deps = [":panic_handler"],
)
rust_test(
name = "panic_handler_test",
srcs = ["panic_handler_test.rs"],
data = [":panic_handler_test_helper"],
env = {
"PANIC_HANDLER_TEST_HELPER": "$(rlocationpath :panic_handler_test_helper)",
},
deps = [
"//src/main/protobuf:failure_details_rust_proto",
"@com_google_protobuf//rust:protobuf",
"@crates//googletest",
"@rules_rust//rust/runfiles",
],
)
rust_library(
name = "tracking_allocator",
srcs = ["tracking_allocator.rs"],
)
rust_library(
name = "tracking_allocator_ffi",
srcs = ["tracking_allocator_ffi.rs"],
deps = [":tracking_allocator"],
alwayslink = True,
)
rust_library(
name = "tracking_allocator_test_ffi",
testonly = True,
srcs = ["tracking_allocator_test_ffi.rs"],
alwayslink = True,
)
rust_test(
name = "tracking_allocator_test",
srcs = ["tracking_allocator_test.rs"],
# Tests inspect the process-wide global allocation counter.
args = ["--test-threads=1"],
deps = [
":tracking_allocator",
":tracking_allocator_ffi",
"@crates//googletest",
],
)