2019-04-18 17:51:19 +00:00
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
2019-11-06 04:19:17 +00:00
|
|
|
#
|
|
|
|
# defs.bzl - Definitions for Facebook-specific buck build integration
|
|
|
|
# in TARGETS
|
2019-04-18 17:51:19 +00:00
|
|
|
|
2019-02-28 19:35:30 +00:00
|
|
|
load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
|
|
|
|
load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest")
|
|
|
|
|
|
|
|
def test_binary(
|
|
|
|
test_name,
|
|
|
|
test_cc,
|
|
|
|
parallelism,
|
|
|
|
rocksdb_arch_preprocessor_flags,
|
2019-07-25 18:42:31 +00:00
|
|
|
rocksdb_os_preprocessor_flags,
|
2019-02-28 19:35:30 +00:00
|
|
|
rocksdb_compiler_flags,
|
|
|
|
rocksdb_preprocessor_flags,
|
2019-07-25 18:42:31 +00:00
|
|
|
rocksdb_external_deps,
|
2019-08-02 17:40:32 +00:00
|
|
|
rocksdb_os_deps,
|
|
|
|
extra_deps,
|
|
|
|
extra_compiler_flags):
|
2019-02-28 19:35:30 +00:00
|
|
|
TEST_RUNNER = native.package_name() + "/buckifier/rocks_test_runner.sh"
|
|
|
|
|
|
|
|
ttype = "gtest" if parallelism == "parallel" else "simple"
|
|
|
|
test_bin = test_name + "_bin"
|
|
|
|
|
|
|
|
cpp_binary(
|
|
|
|
name = test_bin,
|
|
|
|
srcs = [test_cc],
|
|
|
|
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
|
2019-07-25 18:42:31 +00:00
|
|
|
os_preprocessor_flags = rocksdb_os_preprocessor_flags,
|
2019-08-02 17:40:32 +00:00
|
|
|
compiler_flags = rocksdb_compiler_flags + extra_compiler_flags,
|
2019-02-28 19:35:30 +00:00
|
|
|
preprocessor_flags = rocksdb_preprocessor_flags,
|
2019-08-02 17:40:32 +00:00
|
|
|
deps = [":rocksdb_test_lib"] + extra_deps,
|
2019-07-25 18:42:31 +00:00
|
|
|
os_deps = rocksdb_os_deps,
|
2019-02-28 19:35:30 +00:00
|
|
|
external_deps = rocksdb_external_deps,
|
|
|
|
)
|
|
|
|
|
|
|
|
custom_unittest(
|
|
|
|
name = test_name,
|
|
|
|
command = [TEST_RUNNER, "$(location :{})".format(test_bin)],
|
|
|
|
type = ttype,
|
|
|
|
)
|