From 63e04a55a02d0ac80b32872308bbedbc5aa9a87f Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 27 Mar 2018 08:05:14 -0700 Subject: [PATCH] [buck] disable buckd systematically Summary: It's already turned of systematically for the Java integration, this just generalises it. The Buck daemon seems to cause issues with infer from time to time that are hard to debug. Reviewed By: jeremydubreil Differential Revision: D7400068 fbshipit-source-id: f05ee07 --- infer/lib/python/inferlib/bucklib.py | 4 ---- infer/src/integration/Driver.ml | 2 ++ infer/tests/build_systems/buck-clang-db/Makefile | 1 - infer/tests/build_systems/buck/Makefile | 4 ++-- infer/tests/build_systems/buck_cross_module/Makefile | 4 ++-- infer/tests/build_systems/buck_flavors/Makefile | 3 +-- infer/tests/build_systems/buck_flavors_deterministic/Makefile | 4 +--- infer/tests/build_systems/buck_flavors_run/Makefile | 3 +-- infer/tests/build_systems/genrule/Makefile | 4 ++-- infer/tests/build_systems/threadsafety_traces/Makefile | 4 ++-- 10 files changed, 13 insertions(+), 20 deletions(-) diff --git a/infer/lib/python/inferlib/bucklib.py b/infer/lib/python/inferlib/bucklib.py index 5ad6eabd1..2dc2c7c18 100644 --- a/infer/lib/python/inferlib/bucklib.py +++ b/infer/lib/python/inferlib/bucklib.py @@ -72,10 +72,6 @@ def prepare_build(args): logging.error('Could not find infer') raise e - # disable the Buck daemon as changes in the Buck config - # may be missed otherwise - os.environ['NO_BUCKD'] = '1' - # Create a script to be called by buck infer_script = None with tempfile.NamedTemporaryFile(delete=False, diff --git a/infer/src/integration/Driver.ml b/infer/src/integration/Driver.ml index d257063a3..8936c29ff 100644 --- a/infer/src/integration/Driver.ml +++ b/infer/src/integration/Driver.ml @@ -544,6 +544,8 @@ let run_prologue mode = anyway, pretend that we are not called from another make to prevent make falling back to a mono-threaded execution. *) Unix.unsetenv "MAKEFLAGS" ; + (* disable the Buck daemon as changes in the Buck or infer config may be missed otherwise *) + Unix.putenv ~key:"NO_BUCKD" ~data:"1" ; () diff --git a/infer/tests/build_systems/buck-clang-db/Makefile b/infer/tests/build_systems/buck-clang-db/Makefile index 62c06c7f6..1180706e1 100644 --- a/infer/tests/build_systems/buck-clang-db/Makefile +++ b/infer/tests/build_systems/buck-clang-db/Makefile @@ -21,7 +21,6 @@ include $(TESTS_DIR)/infer.make infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(QUIET)cd $(SOURCE_DIR) && \ $(call silent_on_success,Testing Buck Clang compilation database integration,\ - NO_BUCKD=1 \ $(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -o $(CURDIR)/$(@D) \ --buck-compilation-database no-deps \ -- $(BUCK) build --no-cache '//clang_compilation_database:Hel lo#default' @clang_compilation_database/buck_target_hello_test.txt) diff --git a/infer/tests/build_systems/buck/Makefile b/infer/tests/build_systems/buck/Makefile index be3e0e72e..89581938a 100644 --- a/infer/tests/build_systems/buck/Makefile +++ b/infer/tests/build_systems/buck/Makefile @@ -22,13 +22,13 @@ include $(TESTS_DIR)/infer.make $(OBJECTS): $(JAVA_SOURCE_FILES) $(QUIET)cd $(ROOT_DIR) && \ $(call silent_on_success,Compiling Buck Java tests,\ - INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \ + INFER_BIN=$(INFER_BIN) \ $(BUCK) build --deep --no-cache $(BUCK_TARGET)) infer-out/report.json: $(JAVA_DEPS) $(JAVA_SOURCE_FILES) $(QUIET)cd $(ROOT_DIR) && \ $(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing Buck Java integration,\ - INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \ + INFER_BIN=$(INFER_BIN) \ $(INFER_BIN) $(INFER_OPTIONS) -a $(ANALYZER) --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --deep --no-cache $(BUCK_TARGET)) diff --git a/infer/tests/build_systems/buck_cross_module/Makefile b/infer/tests/build_systems/buck_cross_module/Makefile index 2b7554643..b22d99ea6 100644 --- a/infer/tests/build_systems/buck_cross_module/Makefile +++ b/infer/tests/build_systems/buck_cross_module/Makefile @@ -19,13 +19,13 @@ include $(TESTS_DIR)/infer.make $(OBJECTS): $(JAVA_SOURCE_FILES) $(QUIET)cd $(ROOT_DIR) && \ $(call silent_on_success,Compiling Buck cross module test tests,\ - INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \ + INFER_BIN=$(INFER_BIN) \ $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(JAVA_DEPS) $(JAVA_SOURCE_FILES) $(QUIET)cd $(ROOT_DIR) && \ $(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing Buck Java cross module integration,\ - INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \ + INFER_BIN=$(INFER_BIN) \ $(INFER_BIN) -a $(ANALYZER) --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --no-cache $(BUCK_TARGET)) diff --git a/infer/tests/build_systems/buck_flavors/Makefile b/infer/tests/build_systems/buck_flavors/Makefile index 3c6424e04..2343a2bae 100644 --- a/infer/tests/build_systems/buck_flavors/Makefile +++ b/infer/tests/build_systems/buck_flavors/Makefile @@ -20,12 +20,11 @@ include $(TESTS_DIR)/infer.make $(OBJECTS): $(JAVA_SOURCE_FILES) $(QUIET)$(call silent_on_success,Compiling Buck flavors tests,\ - NO_BUCKD=1 $(BUCK) build --no-cache $(BUCK_TARGET)) + $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing Buck flavors integration,\ - NO_BUCKD=1 \ $(INFER_BIN) $(INFER_OPTIONS) capture --flavors --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --no-cache $(BUCK_TARGET) &&\ $(INFER_BIN) $(INFER_OPTIONS) --merge analyze) diff --git a/infer/tests/build_systems/buck_flavors_deterministic/Makefile b/infer/tests/build_systems/buck_flavors_deterministic/Makefile index bb5af76a7..a22d6f8c3 100644 --- a/infer/tests/build_systems/buck_flavors_deterministic/Makefile +++ b/infer/tests/build_systems/buck_flavors_deterministic/Makefile @@ -20,18 +20,16 @@ include $(TESTS_DIR)/base.make $(OBJECTS): $(JAVA_SOURCE_FILES) $(QUIET)$(call silent_on_success,Compiling Buck flavors tests,\ - NO_BUCKD=1 $(BUCK) build --no-cache $(BUCK_TARGET)) + $(BUCK) build --no-cache $(BUCK_TARGET)) differences.exp.test: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Running Buck flavors capture a first time,\ - NO_BUCKD=1 \ $(INFER_BIN) $(INFER_OPTIONS) capture --flavors --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --no-cache $(BUCK_TARGET) && \ find buck-out/gen/src/infer-out-* -type f | xargs cat | $(SHASUM) > capture_hash-1.sha) $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Running Buck flavors capture a second time,\ - NO_BUCKD=1 \ $(INFER_BIN) $(INFER_OPTIONS) capture --flavors --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --no-cache $(BUCK_TARGET) && \ find buck-out/gen/src/infer-out-* -type f | xargs cat | $(SHASUM) > capture_hash-2.sha) diff --git a/infer/tests/build_systems/buck_flavors_run/Makefile b/infer/tests/build_systems/buck_flavors_run/Makefile index 164bcb532..72bf398c6 100644 --- a/infer/tests/build_systems/buck_flavors_run/Makefile +++ b/infer/tests/build_systems/buck_flavors_run/Makefile @@ -20,11 +20,10 @@ include $(TESTS_DIR)/infer.make $(OBJECTS): $(SOURCES) $(QUIET)$(call silent_on_success,Compiling Buck flavors tests,\ - NO_BUCKD=1 $(BUCK) build --no-cache $(BUCK_TARGET)) + $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing infer-run Buck flavors integration,\ - NO_BUCKD=1 \ $(INFER_BIN) $(INFER_OPTIONS) run --flavors --results-dir $(CURDIR)/infer-out --reactive -- \ $(BUCK) build --no-cache $(BUCK_TARGET)) diff --git a/infer/tests/build_systems/genrule/Makefile b/infer/tests/build_systems/genrule/Makefile index 1892fbfe2..477af51df 100644 --- a/infer/tests/build_systems/genrule/Makefile +++ b/infer/tests/build_systems/genrule/Makefile @@ -27,7 +27,7 @@ include $(TESTS_DIR)/infer.make $(OBJECTS): $(JAVA_SOURCE_FILES) $(QUIET)cd $(ROOT_DIR) && \ $(call silent_on_success,Compiling Buck genrule for Java sources,\ - NO_BUCKD=1 $(BUCK) build --no-cache $(BUCK_TARGET)) + $(BUCK) build --no-cache $(BUCK_TARGET)) .PHONY: genrule genrule: $(JSON_REPORT) @@ -37,7 +37,7 @@ $(JSON_REPORT): $(JAVA_DEPS) $(JAVA_SOURCE_FILES) $(MAKEFILE_LIST) $(QUIET)cd $(ROOT_DIR) && \ $(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing Buck genrule for Java integration,\ - INFER_BIN="$(INFER_BIN)" NO_BUCKD=1 $(BUCK) build --no-cache $(INFER_TARGET)) + INFER_BIN="$(INFER_BIN)" $(BUCK) build --no-cache $(INFER_TARGET)) $(QUIET)touch $@ report.json: $(JSON_REPORT) $(MAKEFILE_LIST) diff --git a/infer/tests/build_systems/threadsafety_traces/Makefile b/infer/tests/build_systems/threadsafety_traces/Makefile index 1cda770ae..5c84788cb 100644 --- a/infer/tests/build_systems/threadsafety_traces/Makefile +++ b/infer/tests/build_systems/threadsafety_traces/Makefile @@ -18,13 +18,13 @@ include $(TESTS_DIR)/infer.make $(OBJECTS): $(JAVA_SOURCE_FILES) $(QUIET)cd $(ROOT_DIR) && \ $(call silent_on_success,Compiling thread-safety trace tests,\ - INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \ + INFER_BIN=$(INFER_BIN) \ $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(JAVA_DEPS) $(JAVA_SOURCE_FILES) $(QUIET)cd $(ROOT_DIR) && \ $(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing thread-safety trace tests with Buck,\ - INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \ + INFER_BIN=$(INFER_BIN) \ $(INFER_BIN) -a $(ANALYZER) --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --no-cache $(BUCK_TARGET))