]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/defs.bzl
buildsys: change download over to reef release
[ceph.git] / ceph / src / rocksdb / defs.bzl
CommitLineData
f67539c2
TL
1# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2#
3# defs.bzl - Definitions for Facebook-specific buck build integration
4# in TARGETS
5
20effc67 6load("@fbcode_macros//build_defs:coverage.bzl", "coverage")
494da23a
TL
7load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
8load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest")
9
10def test_binary(
11 test_name,
12 test_cc,
13 parallelism,
14 rocksdb_arch_preprocessor_flags,
f67539c2 15 rocksdb_os_preprocessor_flags,
494da23a
TL
16 rocksdb_compiler_flags,
17 rocksdb_preprocessor_flags,
f67539c2
TL
18 rocksdb_external_deps,
19 rocksdb_os_deps,
20 extra_deps,
21 extra_compiler_flags):
494da23a
TL
22 TEST_RUNNER = native.package_name() + "/buckifier/rocks_test_runner.sh"
23
24 ttype = "gtest" if parallelism == "parallel" else "simple"
25 test_bin = test_name + "_bin"
26
27 cpp_binary(
28 name = test_bin,
29 srcs = [test_cc],
30 arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
f67539c2
TL
31 os_preprocessor_flags = rocksdb_os_preprocessor_flags,
32 compiler_flags = rocksdb_compiler_flags + extra_compiler_flags,
494da23a 33 preprocessor_flags = rocksdb_preprocessor_flags,
f67539c2
TL
34 deps = [":rocksdb_test_lib"] + extra_deps,
35 os_deps = rocksdb_os_deps,
494da23a
TL
36 external_deps = rocksdb_external_deps,
37 )
38
20effc67
TL
39 binary_path = "$(location :{})".format(test_bin)
40
41 base_path = native.package_name()
42 tags = []
43 if coverage.is_coverage_enabled(base_path):
44 # This tag instructs testpilot to use
45 # the lower-memory coverage runner
46 # (e.g. it tells testpilot that the binary
47 # is actually instrumented with coverage info)
48 tags = ["coverage"]
49
494da23a
TL
50 custom_unittest(
51 name = test_name,
20effc67 52 command = [TEST_RUNNER, binary_path],
494da23a 53 type = ttype,
20effc67
TL
54 env = {"BUCK_BASE_BINARY": binary_path},
55 tags = tags,
494da23a 56 )