[make] move inferTraceBugs tests to build systems, hide more output

Summary:
Cosmetic changes to the output of `make clean` and `make test-replace`.

Run the inferTraceBugs tests from tests/build_systems/ like other such e2e
tests, so that they can run in parallel with other tests instead of
sequentially at the end.

Reviewed By: dulmarod

Differential Revision: D5526599

fbshipit-source-id: 57231bd
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 6b792e0015
commit 0793e0ff40

@ -27,6 +27,7 @@ BUILD_SYSTEMS_TESTS += \
project_root_rel \ project_root_rel \
reactive \ reactive \
run_hidden_linters \ run_hidden_linters \
tracebugs \
utf8_in_procname \ utf8_in_procname \
DIRECT_TESTS += \ DIRECT_TESTS += \
@ -226,7 +227,7 @@ endef
.PHONY: $(DIRECT_TESTS:%=direct_%_test) .PHONY: $(DIRECT_TESTS:%=direct_%_test)
$(DIRECT_TESTS:%=direct_%_test): infer $(DIRECT_TESTS:%=direct_%_test): infer
$(QUIET)$(call silent_on_success,Running $(subst _, ,$@),\ $(QUIET)$(call silent_on_success,Running test: $(subst _, ,$@),\
$(call silence_make,\ $(call silence_make,\
$(MAKE) -C \ $(MAKE) -C \
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \ $(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
@ -234,48 +235,54 @@ $(DIRECT_TESTS:%=direct_%_test): infer
.PHONY: $(DIRECT_TESTS:%=direct_%_print) .PHONY: $(DIRECT_TESTS:%=direct_%_print)
$(DIRECT_TESTS:%=direct_%_print): infer $(DIRECT_TESTS:%=direct_%_print): infer
$(QUIET)$(call silence_make,\ $(QUIET)$(call silent_on_success,Running: $(subst _, ,$@),\
$(call silence_make,\
$(MAKE) -C \ $(MAKE) -C \
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \ $(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
print) print))
.PHONY: $(DIRECT_TESTS:%=direct_%_clean) .PHONY: $(DIRECT_TESTS:%=direct_%_clean)
$(DIRECT_TESTS:%=direct_%_clean): $(DIRECT_TESTS:%=direct_%_clean):
$(QUIET)$(call silence_make,\ $(QUIET)$(call silent_on_success,Cleaning: $(subst _, ,$@),\
$(call silence_make,\
$(MAKE) -C \ $(MAKE) -C \
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \ $(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
clean) clean))
.PHONY: $(DIRECT_TESTS:%=direct_%_replace) .PHONY: $(DIRECT_TESTS:%=direct_%_replace)
$(DIRECT_TESTS:%=direct_%_replace): infer $(DIRECT_TESTS:%=direct_%_replace): infer
$(QUIET)$(call silence_make,\ $(QUIET)$(call silent_on_success,Recording: $(subst _, ,$@),\
$(call silence_make,\
$(MAKE) -C \ $(MAKE) -C \
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \ $(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
replace) replace))
.PHONY: direct_tests .PHONY: direct_tests
direct_tests: $(DIRECT_TESTS:%=direct_%_test) direct_tests: $(DIRECT_TESTS:%=direct_%_test)
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_test) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_test)
$(BUILD_SYSTEMS_TESTS:%=build_%_test): infer $(BUILD_SYSTEMS_TESTS:%=build_%_test): infer
$(QUIET)$(call silent_on_success,Running $(subst _, ,$@),\ $(QUIET)$(call silent_on_success,Running test: $(subst _, ,$@),\
$(call silence_make,\ $(call silence_make,\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_test,%,$@) test)) $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_test,%,$@) test))
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_print) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_print)
$(BUILD_SYSTEMS_TESTS:%=build_%_print): infer $(BUILD_SYSTEMS_TESTS:%=build_%_print): infer
$(QUIET)$(call silence_make,\ $(QUIET)$(call silent_on_success,Running: $(subst _, ,$@),\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_print,%,$@) print) $(call silence_make,\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_print,%,$@) print))
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_clean) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_clean)
$(BUILD_SYSTEMS_TESTS:%=build_%_clean): $(BUILD_SYSTEMS_TESTS:%=build_%_clean):
$(QUIET)$(call silence_make,\ $(QUIET)$(call silent_on_success,Cleaning: $(subst _, ,$@),\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_clean,%,$@) clean) $(call silence_make,\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_clean,%,$@) clean))
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_replace) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_replace)
$(BUILD_SYSTEMS_TESTS:%=build_%_replace): infer $(BUILD_SYSTEMS_TESTS:%=build_%_replace): infer
$(QUIET)$(call silence_make,\ $(QUIET)$(call silent_on_success,Recording: $(subst _, ,$@),\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace) $(call silence_make,\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace))
.PHONY: build_systems_tests .PHONY: build_systems_tests
build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test) build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test)
@ -283,32 +290,6 @@ build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test)
.PHONY: endtoend_test .PHONY: endtoend_test
endtoend_test: $(BUILD_SYSTEMS_TESTS:%=build_%_test) $(DIRECT_TESTS:%=direct_%_test) endtoend_test: $(BUILD_SYSTEMS_TESTS:%=build_%_test) $(DIRECT_TESTS:%=direct_%_test)
.PHONY: inferTraceBugs_test
inferTraceBugs_test: infer
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: running infer,\
$(INFER_BIN) -o __test-infer-out__ -- \
$(JAVAC) $(EXAMPLES_DIR)/Hello.java)
else
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: running infer,\
$(INFER_BIN) -o __test-infer-out__ -- \
clang -c $(EXAMPLES_DIR)/hello.c)
endif
$(QUIET)$(REMOVE) Hello.class
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --max-level=max,\
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--select 0 --max-level max)
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --max-level=0,\
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--select 0 --max-level 0)
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --max-level=max --no-source,\
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--select 0 --max-level max --no-source)
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --only-show,\
$(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \
--only-show)
$(QUIET)$(REMOVE_DIR) __test-infer-out__
.PHONY: check_missing_mli .PHONY: check_missing_mli
check_missing_mli: check_missing_mli:
$(QUIET)for x in $$(find $(INFER_DIR)/src -name "*.ml"); do \ $(QUIET)for x in $$(find $(INFER_DIR)/src -name "*.ml"); do \
@ -360,7 +341,7 @@ else
endif endif
.PHONY: config_tests .PHONY: config_tests
config_tests: test_build ocaml_unit_test endtoend_test inferTraceBugs_test inferScriptMode_test \ config_tests: test_build ocaml_unit_test endtoend_test inferScriptMode_test \
checkCopyright validate-skel checkCopyright validate-skel
$(QUIET)$(call silent_on_success,Building Infer source dependency graph,\ $(QUIET)$(call silent_on_success,Building Infer source dependency graph,\
$(MAKE) -C $(SRC_DIR) mod_dep.dot) $(MAKE) -C $(SRC_DIR) mod_dep.dot)
@ -503,26 +484,35 @@ endif
ocaml_clean: ocaml_clean:
ifeq ($(IS_RELEASE_TREE),no) ifeq ($(IS_RELEASE_TREE),no)
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)
$(QUIET)$(MAKE) -C $(FCP_DIR)/clang-ocaml clean $(QUIET)$(call silent_on_success,Cleaning facebook-clang-plugins OCaml build,\
$(MAKE) -C $(FCP_DIR)/clang-ocaml clean)
endif endif
endif endif
$(QUIET)$(MAKE) -C $(SRC_DIR) clean $(QUIET)$(call silent_on_success,Cleaning infer OCaml build,\
$(QUIET)$(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot clean $(MAKE) -C $(SRC_DIR) clean)
$(QUIET)$(call silent_on_success,Cleaning ocamldot,\
$(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot clean)
.PHONY: clean .PHONY: clean
clean: test_clean ocaml_clean clean: test_clean ocaml_clean
ifeq ($(IS_RELEASE_TREE),no) ifeq ($(IS_RELEASE_TREE),no)
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)
$(QUIET)$(MAKE) -C $(FCP_DIR) clean $(QUIET)$(call silent_on_success,Cleaning facebook-clang-plugins C++ build,\
$(MAKE) -C $(FCP_DIR) clean)
endif endif
endif endif
$(QUIET)$(MAKE) -C $(ANNOTATIONS_DIR) clean $(QUIET)$(call silent_on_success,Cleaning Java annotations,\
$(QUIET)$(MAKE) -C $(MODELS_DIR) clean $(MAKE) -C $(ANNOTATIONS_DIR) clean)
$(QUIET)$(call silent_on_success,Cleaning infer models,\
$(MAKE) -C $(MODELS_DIR) clean)
ifeq ($(IS_FACEBOOK_TREE),yes) ifeq ($(IS_FACEBOOK_TREE),yes)
$(QUIET)$(MAKE) -C facebook clean $(QUIET)$(call silent_on_success,Cleaning facebook/,\
$(MAKE) -C facebook clean)
endif endif
find $(INFER_DIR)/tests \( -name '*.o' -o -name '*.o.sh' \) -delete $(QUIET)$(call silent_on_success,Removing *.o and *.o.sh,\
$(QUIET)$(REMOVE_DIR) _build_logs $(MAN_DIR) find $(INFER_DIR)/tests \( -name '*.o' -o -name '*.o.sh' \) -delete)
$(QUIET)$(call silent_on_success,Removing build logs,\
$(REMOVE_DIR) _build_logs $(MAN_DIR))
.PHONY: conf-clean .PHONY: conf-clean
conf-clean: clean conf-clean: clean

@ -0,0 +1,57 @@
# Copyright (c) 2017 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
TESTS_DIR = ../..
include $(TESTS_DIR)/base.make
SOURCES = ../codetoanalyze/hello.c
OBJECTS = $(SOURCES:.c=.o)
default: print
infer-out/report.json: $(SOURCES) $(CLANG_DEPS)
$(QUIET)$(call silent_on_success,Running infer,\
$(INFER_BIN) run -- clang -c $(SOURCES))
.PHONY: test1
test1: infer-out/report.json
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --max-level=max,\
$(PYTHON_DIR)/inferTraceBugs -o infer-out \
--select 0 --max-level max)
.PHONY: test2
test2: infer-out/report.json
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --max-level=0,\
$(PYTHON_DIR)/inferTraceBugs -o infer-out \
--select 0 --max-level 0)
.PHONY: test3
test3: infer-out/report.json
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --max-level=max --no-source,\
$(PYTHON_DIR)/inferTraceBugs -o infer-out \
--select 0 --max-level max --no-source)
.PHONY: test4
test4: infer-out/report.json
$(QUIET)$(call silent_on_success,Testing inferTraceBugs: --only-show,\
$(PYTHON_DIR)/inferTraceBugs -o infer-out \
--only-show)
.PHONY: print
print: test1 test2 test3 test4
.PHONY: test
test: print
.PHONY: replace
replace: test
.PHONY: clean
clean:
$(REMOVE_DIR) $(OBJECTS) infer-out $(CLEAN_EXTRA)
Loading…
Cancel
Save