From 212068f89bebd4eecf8f812af71d3236a24f87e5 Mon Sep 17 00:00:00 2001 From: Martin Trojer Date: Tue, 15 Dec 2020 04:02:48 -0800 Subject: [PATCH] Make buck tests more robust Summary: using 'buck clean' rather than 'rm -rf buck-out' makes buck happier, apply to all buck integration tests Reviewed By: ngorogiannis Differential Revision: D25558469 fbshipit-source-id: 6c07341d6 --- infer/tests/build_systems/buck-clang-db/Makefile | 1 + infer/tests/build_systems/buck_blacklist/Makefile | 2 +- .../build_systems/buck_clang_test_determinator/Makefile | 7 ++++--- infer/tests/build_systems/buck_combined/Makefile | 2 +- .../build_systems/buck_export_changed_functions/Makefile | 7 ++++--- infer/tests/build_systems/buck_flavors/Makefile | 2 +- infer/tests/build_systems/buck_flavors_diff/Makefile | 2 +- infer/tests/build_systems/buck_flavors_run/Makefile | 2 +- infer/tests/build_systems/buck_java_flavor/Makefile | 4 ++-- infer/tests/build_systems/genrulecapture/Makefile | 4 ++-- infer/tests/build_systems/objc_getters_setters/Makefile | 1 - infer/tests/build_systems/objc_missing_fld/Makefile | 1 - infer/tests/build_systems/objc_retain_cycles/Makefile | 1 - infer/tests/build_systems/objc_retain_cycles_weak/Makefile | 1 - 14 files changed, 18 insertions(+), 19 deletions(-) diff --git a/infer/tests/build_systems/buck-clang-db/Makefile b/infer/tests/build_systems/buck-clang-db/Makefile index 6546677f9..31a294627 100644 --- a/infer/tests/build_systems/buck-clang-db/Makefile +++ b/infer/tests/build_systems/buck-clang-db/Makefile @@ -17,6 +17,7 @@ include $(TESTS_DIR)/infer.make infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(QUIET)cd $(SOURCE_DIR) && \ + $(BUCK) clean && \ $(call silent_on_success,Testing Buck Clang compilation database integration,\ $(INFER_BIN) $(INFER_OPTIONS) -o $(CURDIR)/$(@D) \ --buck-compilation-database no-deps \ diff --git a/infer/tests/build_systems/buck_blacklist/Makefile b/infer/tests/build_systems/buck_blacklist/Makefile index 535573472..c40816b61 100644 --- a/infer/tests/build_systems/buck_blacklist/Makefile +++ b/infer/tests/build_systems/buck_blacklist/Makefile @@ -21,7 +21,7 @@ $(OBJECTS): $(JAVA_SOURCE_FILES) $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ + $(QUIET)$(BUCK) clean $(call silent_on_success,Testing Buck flavors integration,\ $(INFER_BIN) $(INFER_OPTIONS) capture --buck-clang --results-dir $(CURDIR)/infer-out \ @blacklist.txt --buck-blacklist '.*src/hello2\.c' \ diff --git a/infer/tests/build_systems/buck_clang_test_determinator/Makefile b/infer/tests/build_systems/buck_clang_test_determinator/Makefile index ca8522a40..3e3e095b4 100644 --- a/infer/tests/build_systems/buck_clang_test_determinator/Makefile +++ b/infer/tests/build_systems/buck_clang_test_determinator/Makefile @@ -25,12 +25,13 @@ $(DIFF_OUTPUT): $(QUIET)echo >> diff.mod.test $(TEST_DETERMINATOR_RESULT): $(DIFF_OUTPUT) - $(QUIET)$(call silent_on_success,Testing test-determinator for clang with set of changes,\ - $(INFER_BIN) $(INFER_OPTIONS) -- buck build --no-cache $(BUCK_TARGET)) + $(QUIET)$(BUCK) clean + $(call silent_on_success,Testing test-determinator for clang with set of changes,\ + $(INFER_BIN) $(INFER_OPTIONS) -- $(BUCK) build --no-cache $(BUCK_TARGET)) .PHONY: test test: $(TEST_DETERMINATOR_RESULT) - $(QUIET)$(call check_no_diff,test_determinator.json.exp,$(TEST_DETERMINATOR_RESULT)) + $(call check_no_diff,test_determinator.json.exp,$(TEST_DETERMINATOR_RESULT)) .PHONY: replace replace: $(TEST_DETERMINATOR_RESULT) diff --git a/infer/tests/build_systems/buck_combined/Makefile b/infer/tests/build_systems/buck_combined/Makefile index 2c97cb157..96da9795c 100644 --- a/infer/tests/build_systems/buck_combined/Makefile +++ b/infer/tests/build_systems/buck_combined/Makefile @@ -20,7 +20,7 @@ $(OBJECTS): $(SOURCES) $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ + $(QUIET)$(BUCK) clean $(call silent_on_success,Testing infer-run Buck combined genrule integration,\ $(INFER_BIN) $(INFER_OPTIONS) run --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --no-cache $(BUCK_TARGET)) diff --git a/infer/tests/build_systems/buck_export_changed_functions/Makefile b/infer/tests/build_systems/buck_export_changed_functions/Makefile index 84d5d4b0d..b80fc1e3d 100644 --- a/infer/tests/build_systems/buck_export_changed_functions/Makefile +++ b/infer/tests/build_systems/buck_export_changed_functions/Makefile @@ -24,12 +24,13 @@ $(DIFF_OUTPUT): $(QUIET)echo >> diff.mod.test $(TEST_DETERMINATOR_RESULT): $(DIFF_OUTPUT) - $(QUIET)$(call silent_on_success,Testing export-changed-functions with set of changes,\ - $(INFER_BIN) $(INFER_OPTIONS) -- buck build --no-cache $(BUCK_TARGET)) + $(QUIET)$(BUCK) clean + $(call silent_on_success,Testing export-changed-functions with set of changes,\ + $(INFER_BIN) $(INFER_OPTIONS) -- $(BUCK) build --no-cache $(BUCK_TARGET)) .PHONY: test test: $(TEST_DETERMINATOR_RESULT) - $(QUIET)$(call check_no_diff,changed_functions.json.exp,$(TEST_DETERMINATOR_RESULT)) + $(call check_no_diff,changed_functions.json.exp,$(TEST_DETERMINATOR_RESULT)) .PHONY: replace replace: $(TEST_DETERMINATOR_RESULT) diff --git a/infer/tests/build_systems/buck_flavors/Makefile b/infer/tests/build_systems/buck_flavors/Makefile index fbe70033e..a16075174 100644 --- a/infer/tests/build_systems/buck_flavors/Makefile +++ b/infer/tests/build_systems/buck_flavors/Makefile @@ -20,7 +20,7 @@ $(OBJECTS): $(JAVA_SOURCE_FILES) $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ + $(QUIET)$(BUCK) clean $(call silent_on_success,Testing Buck flavors integration,\ $(INFER_BIN) $(INFER_OPTIONS) capture --buck-clang --results-dir $(CURDIR)/infer-out -- \ $(BUCK) build --no-cache $(BUCK_TARGET) &&\ diff --git a/infer/tests/build_systems/buck_flavors_diff/Makefile b/infer/tests/build_systems/buck_flavors_diff/Makefile index df894ef10..303ca388a 100644 --- a/infer/tests/build_systems/buck_flavors_diff/Makefile +++ b/infer/tests/build_systems/buck_flavors_diff/Makefile @@ -39,7 +39,7 @@ print: current.exp.test previous.exp.test replace: replace_reports $(CURRENT_REPORT): - $(QUIET)$(REMOVE_DIR) buck-out + $(QUIET)$(BUCK) clean $(QUIET)$(COPY) $(CODETOANALYZE)/some_bugs.c src/hello.c $(QUIET)$(call silent_on_success,Running Buck diff analysis: current,\ $(INFER_BIN) $(INFER_OPTIONS) run --results-dir $(CURRENT_DIR) -- \ diff --git a/infer/tests/build_systems/buck_flavors_run/Makefile b/infer/tests/build_systems/buck_flavors_run/Makefile index ce50c8f98..99911e364 100644 --- a/infer/tests/build_systems/buck_flavors_run/Makefile +++ b/infer/tests/build_systems/buck_flavors_run/Makefile @@ -20,7 +20,7 @@ $(OBJECTS): $(SOURCES) $(BUCK) build --no-cache $(BUCK_TARGET)) infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ + $(QUIET)$(BUCK) clean $(call silent_on_success,Testing infer-run Buck flavors integration,\ $(INFER_BIN) $(INFER_OPTIONS) run --results-dir $(CURDIR)/infer-out --reactive -- \ $(BUCK) build --no-cache $(BUCK_TARGET)) diff --git a/infer/tests/build_systems/buck_java_flavor/Makefile b/infer/tests/build_systems/buck_java_flavor/Makefile index c2180b29a..4d44db2fa 100644 --- a/infer/tests/build_systems/buck_java_flavor/Makefile +++ b/infer/tests/build_systems/buck_java_flavor/Makefile @@ -16,6 +16,6 @@ INFER_OPTIONS = --buck-java-flavor --debug-exceptions include $(TESTS_DIR)/infer.make $(INFER_OUT)/report.json: $(MAKEFILE_LIST) $(SOURCES) - $(QUIET) $(REMOVE_DIR) buck-out && \ + $(QUIET)$(BUCK) clean $(call silent_on_success,Testing java flavor integration in $(TEST_REL_DIR),\ - $(INFER_BIN) --results-dir $(@D) $(INFER_OPTIONS) -- buck build --no-cache $(BUCK_TARGET)) + $(INFER_BIN) --results-dir $(@D) $(INFER_OPTIONS) -- $(BUCK) build --no-cache $(BUCK_TARGET)) diff --git a/infer/tests/build_systems/genrulecapture/Makefile b/infer/tests/build_systems/genrulecapture/Makefile index 877e8aff8..1c305faaa 100644 --- a/infer/tests/build_systems/genrulecapture/Makefile +++ b/infer/tests/build_systems/genrulecapture/Makefile @@ -15,7 +15,7 @@ INFER_OPTIONS = --buck-java --debug-exceptions include $(TESTS_DIR)/infer.make $(INFER_OUT)/report.json: $(MAKEFILE_LIST) $(SOURCES) - $(QUIET) $(REMOVE_DIR) buck-out && \ + $(QUIET)$(BUCK) clean $(call silent_on_success,Testing genrule capture integration in $(TEST_REL_DIR),\ $(INFER_BIN) --results-dir $(@D) $(INFER_OPTIONS) -- \ - buck build --no-cache $(BUCK_TARGET)) + $(BUCK) build --no-cache $(BUCK_TARGET)) diff --git a/infer/tests/build_systems/objc_getters_setters/Makefile b/infer/tests/build_systems/objc_getters_setters/Makefile index 3a810cb20..faa352550 100644 --- a/infer/tests/build_systems/objc_getters_setters/Makefile +++ b/infer/tests/build_systems/objc_getters_setters/Makefile @@ -17,6 +17,5 @@ include $(TESTS_DIR)/infer.make include $(TESTS_DIR)/objc.make infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing analysis with Objective-C getters and setters,\ $(INFER_BIN) $(INFER_OPTIONS) --results-dir $(CURDIR)/infer-out -- clang $(CLANG_OPTIONS) $(SOURCES)) diff --git a/infer/tests/build_systems/objc_missing_fld/Makefile b/infer/tests/build_systems/objc_missing_fld/Makefile index b7de25972..1b45be49f 100644 --- a/infer/tests/build_systems/objc_missing_fld/Makefile +++ b/infer/tests/build_systems/objc_missing_fld/Makefile @@ -17,6 +17,5 @@ include $(TESTS_DIR)/infer.make include $(TESTS_DIR)/objc.make infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing analysis with Objective-C Missing_fld,\ $(INFER_BIN) $(INFER_OPTIONS) --results-dir $(CURDIR)/infer-out -- clang $(CLANG_OPTIONS) $(SOURCES)) diff --git a/infer/tests/build_systems/objc_retain_cycles/Makefile b/infer/tests/build_systems/objc_retain_cycles/Makefile index e18b5ed1f..860e76038 100644 --- a/infer/tests/build_systems/objc_retain_cycles/Makefile +++ b/infer/tests/build_systems/objc_retain_cycles/Makefile @@ -17,6 +17,5 @@ include $(TESTS_DIR)/infer.make include $(TESTS_DIR)/objc.make infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing analysis with Objective-C Retain cycles,\ $(INFER_BIN) $(INFER_OPTIONS) --results-dir $(CURDIR)/infer-out -- clang $(CLANG_OPTIONS) -fobjc-arc $(SOURCES)) diff --git a/infer/tests/build_systems/objc_retain_cycles_weak/Makefile b/infer/tests/build_systems/objc_retain_cycles_weak/Makefile index 018b76151..2f7d39136 100644 --- a/infer/tests/build_systems/objc_retain_cycles_weak/Makefile +++ b/infer/tests/build_systems/objc_retain_cycles_weak/Makefile @@ -17,6 +17,5 @@ include $(TESTS_DIR)/infer.make include $(TESTS_DIR)/objc.make infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing analysis with Objective-C retain cycles on weak properties,\ $(INFER_BIN) $(INFER_OPTIONS) --results-dir $(CURDIR)/infer-out -- clang $(CLANG_OPTIONS) $(SOURCES))