TARGETS file not include tests in opt mode

Summary:
Do not build the tests in opt mode, since SyncPoint and other test code will not be included.
Closes https://github.com/facebook/rocksdb/pull/3204

Differential Revision: D6431154

Pulled By: yiwu-arbug

fbshipit-source-id: c404ef042c1a6f679e5c1dc57600b3d8cb52fc28
main
Yi Wu 7 years ago committed by Facebook Github Bot
parent ffacaaa3ea
commit 54095d3389
  1. 52
      TARGETS
  2. 56
      buckifier/targets_cfg.py

@ -53,6 +53,15 @@ rocksdb_arch_preprocessor_flags = {
"x86_64": ["-DHAVE_SSE42"], "x86_64": ["-DHAVE_SSE42"],
} }
build_mode = read_config("fbcode", "build_mode")
is_opt_mode = build_mode.startswith("opt")
# -DNDEBUG is added by default in opt mode in fbcode. But adding it twice
# doesn't harm and avoid forgetting to add it.
if is_opt_mode:
rocksdb_compiler_flags.append("-DNDEBUG")
cpp_library( cpp_library(
name = "rocksdb_lib", name = "rocksdb_lib",
srcs = [ srcs = [
@ -1016,28 +1025,31 @@ ROCKS_TESTS = [
] ]
# Generate a test rule for each entry in ROCKS_TESTS # Generate a test rule for each entry in ROCKS_TESTS
for test_cfg in ROCKS_TESTS: # Do not build the tests in opt mode, since SyncPoint and other test code
test_name = test_cfg[0] # will not be included.
test_cc = test_cfg[1] if not is_opt_mode:
ttype = "gtest" if test_cfg[2] == "parallel" else "simple" for test_cfg in ROCKS_TESTS:
test_bin = test_name + "_bin" test_name = test_cfg[0]
test_cc = test_cfg[1]
ttype = "gtest" if test_cfg[2] == "parallel" else "simple"
test_bin = test_name + "_bin"
cpp_binary ( cpp_binary (
name = test_bin, name = test_bin,
srcs = [test_cc], srcs = [test_cc],
deps = [":rocksdb_test_lib"], deps = [":rocksdb_test_lib"],
preprocessor_flags = rocksdb_preprocessor_flags, preprocessor_flags = rocksdb_preprocessor_flags,
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
compiler_flags = rocksdb_compiler_flags, compiler_flags = rocksdb_compiler_flags,
external_deps = rocksdb_external_deps, external_deps = rocksdb_external_deps,
) )
custom_unittest( custom_unittest(
name = test_name, name = test_name,
type = ttype, type = ttype,
deps = [":" + test_bin], deps = [":" + test_bin],
command = [TEST_RUNNER, BUCK_BINS + test_bin] command = [TEST_RUNNER, BUCK_BINS + test_bin]
) )
custom_unittest( custom_unittest(
name = "make_rocksdbjavastatic", name = "make_rocksdbjavastatic",

@ -56,6 +56,15 @@ rocksdb_preprocessor_flags = [
rocksdb_arch_preprocessor_flags = { rocksdb_arch_preprocessor_flags = {
"x86_64": ["-DHAVE_SSE42"], "x86_64": ["-DHAVE_SSE42"],
} }
build_mode = read_config("fbcode", "build_mode")
is_opt_mode = build_mode.startswith("opt")
# -DNDEBUG is added by default in opt mode in fbcode. But adding it twice
# doesn't harm and avoid forgetting to add it.
if is_opt_mode:
rocksdb_compiler_flags.append("-DNDEBUG")
""" """
@ -97,28 +106,31 @@ ROCKS_TESTS = [
%s] %s]
# Generate a test rule for each entry in ROCKS_TESTS # Generate a test rule for each entry in ROCKS_TESTS
for test_cfg in ROCKS_TESTS: # Do not build the tests in opt mode, since SyncPoint and other test code
test_name = test_cfg[0] # will not be included.
test_cc = test_cfg[1] if not is_opt_mode:
ttype = "gtest" if test_cfg[2] == "parallel" else "simple" for test_cfg in ROCKS_TESTS:
test_bin = test_name + "_bin" test_name = test_cfg[0]
test_cc = test_cfg[1]
cpp_binary ( ttype = "gtest" if test_cfg[2] == "parallel" else "simple"
name = test_bin, test_bin = test_name + "_bin"
srcs = [test_cc],
deps = [":rocksdb_test_lib"], cpp_binary (
preprocessor_flags = rocksdb_preprocessor_flags, name = test_bin,
arch_preprocessor_flags = rocksdb_arch_preprocessor_flags, srcs = [test_cc],
compiler_flags = rocksdb_compiler_flags, deps = [":rocksdb_test_lib"],
external_deps = rocksdb_external_deps, preprocessor_flags = rocksdb_preprocessor_flags,
) arch_preprocessor_flags = rocksdb_arch_preprocessor_flags,
compiler_flags = rocksdb_compiler_flags,
custom_unittest( external_deps = rocksdb_external_deps,
name = test_name, )
type = ttype,
deps = [":" + test_bin], custom_unittest(
command = [TEST_RUNNER, BUCK_BINS + test_bin] name = test_name,
) type = ttype,
deps = [":" + test_bin],
command = [TEST_RUNNER, BUCK_BINS + test_bin]
)
custom_unittest( custom_unittest(
name = "make_rocksdbjavastatic", name = "make_rocksdbjavastatic",

Loading…
Cancel
Save