From 0793e0ff40aac30d1798a20e20824043a79ebad3 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Mon, 31 Jul 2017 08:22:25 -0700 Subject: [PATCH] [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 --- Makefile | 90 +++++++++----------- infer/tests/build_systems/tracebugs/Makefile | 57 +++++++++++++ 2 files changed, 97 insertions(+), 50 deletions(-) create mode 100644 infer/tests/build_systems/tracebugs/Makefile diff --git a/Makefile b/Makefile index 962ec899d..0c00ba947 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ BUILD_SYSTEMS_TESTS += \ project_root_rel \ reactive \ run_hidden_linters \ + tracebugs \ utf8_in_procname \ DIRECT_TESTS += \ @@ -226,7 +227,7 @@ endef .PHONY: $(DIRECT_TESTS:%=direct_%_test) $(DIRECT_TESTS:%=direct_%_test): infer - $(QUIET)$(call silent_on_success,Running $(subst _, ,$@),\ + $(QUIET)$(call silent_on_success,Running test: $(subst _, ,$@),\ $(call silence_make,\ $(MAKE) -C \ $(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) $(DIRECT_TESTS:%=direct_%_print): infer - $(QUIET)$(call silence_make,\ + $(QUIET)$(call silent_on_success,Running: $(subst _, ,$@),\ + $(call silence_make,\ $(MAKE) -C \ $(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \ - print) + print)) .PHONY: $(DIRECT_TESTS:%=direct_%_clean) $(DIRECT_TESTS:%=direct_%_clean): - $(QUIET)$(call silence_make,\ + $(QUIET)$(call silent_on_success,Cleaning: $(subst _, ,$@),\ + $(call silence_make,\ $(MAKE) -C \ $(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \ - clean) + clean)) .PHONY: $(DIRECT_TESTS:%=direct_%_replace) $(DIRECT_TESTS:%=direct_%_replace): infer - $(QUIET)$(call silence_make,\ + $(QUIET)$(call silent_on_success,Recording: $(subst _, ,$@),\ + $(call silence_make,\ $(MAKE) -C \ $(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \ - replace) + replace)) .PHONY: direct_tests direct_tests: $(DIRECT_TESTS:%=direct_%_test) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_test) $(BUILD_SYSTEMS_TESTS:%=build_%_test): infer - $(QUIET)$(call silent_on_success,Running $(subst _, ,$@),\ + $(QUIET)$(call silent_on_success,Running test: $(subst _, ,$@),\ $(call silence_make,\ $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_test,%,$@) test)) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_print) $(BUILD_SYSTEMS_TESTS:%=build_%_print): infer - $(QUIET)$(call silence_make,\ - $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_print,%,$@) print) + $(QUIET)$(call silent_on_success,Running: $(subst _, ,$@),\ + $(call silence_make,\ + $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_print,%,$@) print)) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_clean) $(BUILD_SYSTEMS_TESTS:%=build_%_clean): - $(QUIET)$(call silence_make,\ - $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_clean,%,$@) clean) + $(QUIET)$(call silent_on_success,Cleaning: $(subst _, ,$@),\ + $(call silence_make,\ + $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_clean,%,$@) clean)) .PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_replace) $(BUILD_SYSTEMS_TESTS:%=build_%_replace): infer - $(QUIET)$(call silence_make,\ - $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace) + $(QUIET)$(call silent_on_success,Recording: $(subst _, ,$@),\ + $(call silence_make,\ + $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace)) .PHONY: build_systems_tests build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test) @@ -283,32 +290,6 @@ build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test) .PHONY: endtoend_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 check_missing_mli: $(QUIET)for x in $$(find $(INFER_DIR)/src -name "*.ml"); do \ @@ -360,7 +341,7 @@ else endif .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 $(QUIET)$(call silent_on_success,Building Infer source dependency graph,\ $(MAKE) -C $(SRC_DIR) mod_dep.dot) @@ -503,26 +484,35 @@ endif ocaml_clean: ifeq ($(IS_RELEASE_TREE),no) 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 - $(QUIET)$(MAKE) -C $(SRC_DIR) clean - $(QUIET)$(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot clean + $(QUIET)$(call silent_on_success,Cleaning infer OCaml build,\ + $(MAKE) -C $(SRC_DIR) clean) + $(QUIET)$(call silent_on_success,Cleaning ocamldot,\ + $(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot clean) .PHONY: clean clean: test_clean ocaml_clean ifeq ($(IS_RELEASE_TREE),no) 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 - $(QUIET)$(MAKE) -C $(ANNOTATIONS_DIR) clean - $(QUIET)$(MAKE) -C $(MODELS_DIR) clean + $(QUIET)$(call silent_on_success,Cleaning Java annotations,\ + $(MAKE) -C $(ANNOTATIONS_DIR) clean) + $(QUIET)$(call silent_on_success,Cleaning infer models,\ + $(MAKE) -C $(MODELS_DIR) clean) ifeq ($(IS_FACEBOOK_TREE),yes) - $(QUIET)$(MAKE) -C facebook clean + $(QUIET)$(call silent_on_success,Cleaning facebook/,\ + $(MAKE) -C facebook clean) endif - find $(INFER_DIR)/tests \( -name '*.o' -o -name '*.o.sh' \) -delete - $(QUIET)$(REMOVE_DIR) _build_logs $(MAN_DIR) + $(QUIET)$(call silent_on_success,Removing *.o and *.o.sh,\ + 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 conf-clean: clean diff --git a/infer/tests/build_systems/tracebugs/Makefile b/infer/tests/build_systems/tracebugs/Makefile new file mode 100644 index 000000000..e5eca6497 --- /dev/null +++ b/infer/tests/build_systems/tracebugs/Makefile @@ -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)