Exclude c_test from buck build opt mode

Summary: Fix a Facebook internal build

Test Plan: buck build @mode/opt :c_test :c_test_bin (was compilation
failure, now "not found")
buck build @mode/dev :c_test :c_test_bin (still passes)
This commit is contained in:
Peter Dillinger 2020-07-07 08:32:29 -07:00 committed by Andrew Kryczka
parent 0fdd019f62
commit 9912ebe1b5
2 changed files with 38 additions and 34 deletions

36
TARGETS
View File

@ -447,24 +447,26 @@ cpp_library(
external_deps = ROCKSDB_EXTERNAL_DEPS, external_deps = ROCKSDB_EXTERNAL_DEPS,
) )
cpp_binary( if not is_opt_mode:
name = "c_test_bin", cpp_binary(
srcs = ["db/c_test.c"], name = "c_test_bin",
arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, srcs = ["db/c_test.c"],
os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
compiler_flags = ROCKSDB_COMPILER_FLAGS, os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS,
preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, compiler_flags = ROCKSDB_COMPILER_FLAGS,
deps = [":rocksdb_test_lib"], preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
) deps = [":rocksdb_test_lib"],
)
custom_unittest( if not is_opt_mode:
"c_test", custom_unittest(
command = [ "c_test",
native.package_name() + "/buckifier/rocks_test_runner.sh", command = [
"$(location :{})".format("c_test_bin"), native.package_name() + "/buckifier/rocks_test_runner.sh",
], "$(location :{})".format("c_test_bin"),
type = "simple", ],
) type = "simple",
)
cpp_library( cpp_library(
name = "env_basic_test_lib", name = "env_basic_test_lib",

View File

@ -78,24 +78,26 @@ class TARGETSBuilder(object):
def add_c_test(self): def add_c_test(self):
self.targets_file.write(""" self.targets_file.write("""
cpp_binary( if not is_opt_mode:
name = "c_test_bin", cpp_binary(
srcs = ["db/c_test.c"], name = "c_test_bin",
arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, srcs = ["db/c_test.c"],
os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
compiler_flags = ROCKSDB_COMPILER_FLAGS, os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS,
preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, compiler_flags = ROCKSDB_COMPILER_FLAGS,
deps = [":rocksdb_test_lib"], preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS,
) deps = [":rocksdb_test_lib"],
)
custom_unittest( if not is_opt_mode:
"c_test", custom_unittest(
command = [ "c_test",
native.package_name() + "/buckifier/rocks_test_runner.sh", command = [
"$(location :{})".format("c_test_bin"), native.package_name() + "/buckifier/rocks_test_runner.sh",
], "$(location :{})".format("c_test_bin"),
type = "simple", ],
) type = "simple",
)
""") """)
def register_test(self, def register_test(self,