defs.bzl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
  6. load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest")
  7. def test_binary(
  8. test_name,
  9. test_cc,
  10. parallelism,
  11. rocksdb_arch_preprocessor_flags,
  12. rocksdb_os_preprocessor_flags,
  13. rocksdb_compiler_flags,
  14. rocksdb_preprocessor_flags,
  15. rocksdb_external_deps,
  16. rocksdb_os_deps,
  17. extra_deps,
  18. extra_compiler_flags):
  19. TEST_RUNNER = native.package_name() + "/buckifier/rocks_test_runner.sh"
  20. ttype = "gtest" if parallelism == "parallel" else "simple"
  21. test_bin = test_name + "_bin"
  22. cpp_binary(
  23. name = test_bin,
  24. srcs = [test_cc],
  25. arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
  26. os_preprocessor_flags = rocksdb_os_preprocessor_flags,
  27. compiler_flags = rocksdb_compiler_flags + extra_compiler_flags,
  28. preprocessor_flags = rocksdb_preprocessor_flags,
  29. deps = [":rocksdb_test_lib"] + extra_deps,
  30. os_deps = rocksdb_os_deps,
  31. external_deps = rocksdb_external_deps,
  32. )
  33. custom_unittest(
  34. name = test_name,
  35. command = [TEST_RUNNER, "$(location :{})".format(test_bin)],
  36. type = ttype,
  37. )