[make] generate test rules automatically, add cpp checkers tests

Summary: The direct test rules are very regular and depend only on their names, except for some *_infer_* rules that I had to change to *_errors_*. We can rename these directories if we want (to make them like Java).

Reviewed By: jeremydubreil

Differential Revision: D4081111

fbshipit-source-id: 3295acb
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 4af26064c1
commit 00129761be

@ -16,7 +16,7 @@ endif
DIRECT_TESTS= DIRECT_TESTS=
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)
DIRECT_TESTS += c_infer_test c_frontend_test cpp_infer_test cpp_frontend_test cpp_quandary_test DIRECT_TESTS += c_errors_test c_frontend_test cpp_checkers_test cpp_errors_test cpp_frontend_test cpp_quandary_test
endif endif
ifeq ($(BUILD_JAVA_ANALYZERS),yes) ifeq ($(BUILD_JAVA_ANALYZERS),yes)
DIRECT_TESTS += \ DIRECT_TESTS += \
@ -24,7 +24,7 @@ DIRECT_TESTS += \
java_quandary_test java_crashcontext_test java_harness_test java_quandary_test java_crashcontext_test java_harness_test
endif endif
ifneq ($(XCODE_SELECT),no) ifneq ($(XCODE_SELECT),no)
DIRECT_TESTS += objc_frontend_test objc_infer_test objc_linters objcpp_frontend_test objcpp_linters DIRECT_TESTS += objc_frontend_test objc_errors_test objc_linters_test objcpp_frontend_test objcpp_linters_test
endif endif
.PHONY: all .PHONY: all
@ -120,92 +120,22 @@ endif
ocaml_unit_test: test_this_build ocaml_unit_test: test_this_build
$(TEST_BUILD_DIR)/unit/inferunit.byte $(TEST_BUILD_DIR)/unit/inferunit.byte
.PHONY: frontend_replace DIRECT_TESTS_REPLACE = $(patsubst %_frontend_test,%_frontend_replace,$(filter %_frontend_test,$(DIRECT_TESTS)))
frontend_replace: c_frontend_replace cpp_frontend_replace objc_frontend_replace objcpp_frontend_replace
.PHONY: c_frontend_replace
c_frontend_replace:
$(MAKE) -C ./infer/tests/codetoanalyze/c/frontend replace
.PHONY: c_frontend_test
c_frontend_test:
$(MAKE) -C ./infer/tests/codetoanalyze/c/frontend test
.PHONY: c_infer_test
c_infer_test:
$(MAKE) -C ./infer/tests/codetoanalyze/c/errors test
.PHONY: cpp_frontend_replace
cpp_frontend_replace:
$(MAKE) -C ./infer/tests/codetoanalyze/cpp/frontend replace
.PHONY: cpp_frontend_test
cpp_frontend_test:
$(MAKE) -C ./infer/tests/codetoanalyze/cpp/frontend test
.PHONY: cpp_infer_test
cpp_infer_test:
$(MAKE) -C ./infer/tests/codetoanalyze/cpp/errors test
.PHONY: cpp_quandary_test
cpp_quandary_test:
$(MAKE) -C ./infer/tests/codetoanalyze/cpp/quandary test
.PHONY: java_checkers_test
java_checkers_test:
$(MAKE) -C ./infer/tests/codetoanalyze/java/checkers test
.PHONY: java_crashcontext_test
java_crashcontext_test:
$(MAKE) -C ./infer/tests/codetoanalyze/java/crashcontext test
.PHONY: java_eradicate_test
java_eradicate_test:
$(MAKE) -C ./infer/tests/codetoanalyze/java/eradicate test
.PHONY: java_harness_test .PHONY: frontend_replace
java_harness_test: frontend_replace: $(DIRECT_TESTS_REPLACE)
$(MAKE) -C ./infer/tests/codetoanalyze/java/harness test
define gen_direct_test_rule
.PHONY: java_infer_test .PHONY: $(1)
java_infer_test: $(1):
$(MAKE) -C ./infer/tests/codetoanalyze/java/infer test $(MAKE) -C \
infer/tests/codetoanalyze/$(shell printf $(1) | cut -f 1 -d _)/$(shell printf $(1) | cut -f 2 -d _) \
.PHONY: java_tracing_test $(shell printf $(1) | cut -f 3 -d _)
java_tracing_test: endef
$(MAKE) -C ./infer/tests/codetoanalyze/java/tracing test
$(foreach test,$(DIRECT_TESTS) $(DIRECT_TESTS_REPLACE),\
.PHONY: java_quandary_test $(eval \
java_quandary_test: $(call gen_direct_test_rule,$(test))))
$(MAKE) -C ./infer/tests/codetoanalyze/java/quandary test
.PHONY: objc_frontend_replace
objc_frontend_replace:
$(MAKE) -C ./infer/tests/codetoanalyze/objc/frontend replace
.PHONY: objc_frontend_test
objc_frontend_test:
$(MAKE) -C ./infer/tests/codetoanalyze/objc/frontend test
.PHONY: objc_infer_test
objc_infer_test:
$(MAKE) -C ./infer/tests/codetoanalyze/objc/errors test
.PHONY: objc_linters
objc_linters:
$(MAKE) -C ./infer/tests/codetoanalyze/objc/linters test
.PHONY: objcpp_frontend_replace
objcpp_frontend_replace:
$(MAKE) -C ./infer/tests/codetoanalyze/objcpp/frontend replace
.PHONY: objcpp_frontend_test
objcpp_frontend_test:
$(MAKE) -C ./infer/tests/codetoanalyze/objcpp/frontend test
.PHONY: objcpp_linters
objcpp_linters:
$(MAKE) -C ./infer/tests/codetoanalyze/objcpp/linters test
.PHONY: direct_tests .PHONY: direct_tests
direct_tests: direct_tests:

Loading…
Cancel
Save