From dbf5c55812050f7472492746cc427cebdfff29cf Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Tue, 7 Jul 2020 11:24:02 -0700 Subject: [PATCH] Exclude c_test from buck build opt mode (#7093) Summary: Fix a Facebook internal build Pull Request resolved: https://github.com/facebook/rocksdb/pull/7093 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) Reviewed By: ajkr Differential Revision: D22412528 Pulled By: pdillinger fbshipit-source-id: 8e55c43dbf95386597e4cc690c41d9cbdcee03aa --- TARGETS | 36 +++++++++++++++++++----------------- buckifier/targets_builder.py | 36 +++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/TARGETS b/TARGETS index c7ce57fe2..becaff39f 100644 --- a/TARGETS +++ b/TARGETS @@ -449,24 +449,26 @@ cpp_library( external_deps = ROCKSDB_EXTERNAL_DEPS, ) -cpp_binary( - name = "c_test_bin", - srcs = ["db/c_test.c"], - arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, - os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, - compiler_flags = ROCKSDB_COMPILER_FLAGS, - preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, - deps = [":rocksdb_test_lib"], -) +if not is_opt_mode: + cpp_binary( + name = "c_test_bin", + srcs = ["db/c_test.c"], + arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, + os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, + compiler_flags = ROCKSDB_COMPILER_FLAGS, + preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, + deps = [":rocksdb_test_lib"], + ) -custom_unittest( - "c_test", - command = [ - native.package_name() + "/buckifier/rocks_test_runner.sh", - "$(location :{})".format("c_test_bin"), - ], - type = "simple", -) +if not is_opt_mode: + custom_unittest( + "c_test", + command = [ + native.package_name() + "/buckifier/rocks_test_runner.sh", + "$(location :{})".format("c_test_bin"), + ], + type = "simple", + ) cpp_library( name = "env_basic_test_lib", diff --git a/buckifier/targets_builder.py b/buckifier/targets_builder.py index a86c0a40c..73c289a8a 100644 --- a/buckifier/targets_builder.py +++ b/buckifier/targets_builder.py @@ -78,24 +78,26 @@ class TARGETSBuilder(object): def add_c_test(self): self.targets_file.write(""" -cpp_binary( - name = "c_test_bin", - srcs = ["db/c_test.c"], - arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, - os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, - compiler_flags = ROCKSDB_COMPILER_FLAGS, - preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, - deps = [":rocksdb_test_lib"], -) +if not is_opt_mode: + cpp_binary( + name = "c_test_bin", + srcs = ["db/c_test.c"], + arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS, + os_preprocessor_flags = ROCKSDB_OS_PREPROCESSOR_FLAGS, + compiler_flags = ROCKSDB_COMPILER_FLAGS, + preprocessor_flags = ROCKSDB_PREPROCESSOR_FLAGS, + deps = [":rocksdb_test_lib"], + ) -custom_unittest( - "c_test", - command = [ - native.package_name() + "/buckifier/rocks_test_runner.sh", - "$(location :{})".format("c_test_bin"), - ], - type = "simple", -) +if not is_opt_mode: + custom_unittest( + "c_test", + command = [ + native.package_name() + "/buckifier/rocks_test_runner.sh", + "$(location :{})".format("c_test_bin"), + ], + type = "simple", + ) """) def register_test(self,