]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
[sync fix] Add defs.bzl
authorFosco Marotto <fjm@fb.com>
Thu, 28 Feb 2019 19:35:30 +0000 (11:35 -0800)
committerFosco Marotto <fjm@fb.com>
Fri, 1 Mar 2019 18:30:34 +0000 (10:30 -0800)
defs.bzl [new file with mode: 0644]

diff --git a/defs.bzl b/defs.bzl
new file mode 100644 (file)
index 0000000..4468ceb
--- /dev/null
+++ b/defs.bzl
@@ -0,0 +1,31 @@
+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,
+        rocksdb_compiler_flags,
+        rocksdb_preprocessor_flags,
+        rocksdb_external_deps):
+    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,
+        compiler_flags = rocksdb_compiler_flags,
+        preprocessor_flags = rocksdb_preprocessor_flags,
+        deps = [":rocksdb_test_lib"],
+        external_deps = rocksdb_external_deps,
+    )
+
+    custom_unittest(
+        name = test_name,
+        command = [TEST_RUNNER, "$(location :{})".format(test_bin)],
+        type = ttype,
+    )