From 38ae6bea501afe20192d23889db381f1f48804c2 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 2 Mar 2016 06:48:54 -0800 Subject: [PATCH] add e2e test of inferTraceBugs Summary:public Add very basic end-to-end tests that inferTraceBugs doesn't crash. Reviewed By: jeremydubreil Differential Revision: D2995427 fb-gh-sync-id: d9e969e shipit-source-id: d9e969e --- Makefile.config.in | 4 +++- Makefile.in | 28 ++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Makefile.config.in b/Makefile.config.in index 70942f483..6c0cf0e23 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -9,6 +9,7 @@ PLATFORM = $(shell uname) ABSOLUTE_ROOT_DIR = $(shell cd $(ROOT_DIR) && pwd) +EXAMPLES_DIR = $(ABSOLUTE_ROOT_DIR)/examples FCP_DIR = $(ABSOLUTE_ROOT_DIR)/facebook-clang-plugins INFER_DIR = $(ABSOLUTE_ROOT_DIR)/infer DEPENDENCIES_DIR = $(ABSOLUTE_ROOT_DIR)/dependencies @@ -24,9 +25,10 @@ MODELS_DIR = $(INFER_DIR)/models SRC_DIR = $(INFER_DIR)/src JAVA_LIB_DIR = $(LIB_DIR)/java -PYTHON_LIB_DIR = $(LIB_DIR)/python/inferlib SPECS_LIB_DIR = $(LIB_DIR)/specs +PYTHON_DIR = $(LIB_DIR)/python +PYTHON_LIB_DIR = $(PYTHON_DIR)/inferlib CAPTURE_LIB_DIR = $(PYTHON_LIB_DIR)/capture INFERANALYZE_BIN = $(BIN_DIR)/InferAnalyze diff --git a/Makefile.in b/Makefile.in index b0d863671..75a181721 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,7 +96,29 @@ ifeq (@BUILD_JAVA_ANALYZERS@,yes) NO_BUCKD=1 ./scripts/build_integration_tests.py endif -test: buck_test +inferTraceBugs_test: $(INFER_ANALYZERS) +ifeq (@BUILD_JAVA_ANALYZERS@,yes) + $(PYTHON_DIR)/infer -o __test-infer-out__ -- \ + javac $(EXAMPLES_DIR)/Hello.java \ + > /dev/null + @rm -f Hello.class +else + $(PYTHON_DIR)/infer -o __test-infer-out__ \ + -- clang -c $(EXAMPLES_DIR)/hello.c \ + > /dev/null + @rm -f hello.o +endif + $(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \ + --select 0 --max-level max > /dev/null + $(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \ + --select 0 --max-level 0 > /dev/null + $(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \ + --select 0 --max-level max --no-source > /dev/null + $(PYTHON_DIR)/inferTraceBugs -o __test-infer-out__ \ + --only-show > /dev/null + @rm -fr __test-infer-out__ + +test: buck_test inferTraceBugs_test test_xml: buck_test_xml @@ -108,4 +130,6 @@ ifeq (@BUILD_C_ANALYZERS@,yes) endif $(MAKE) -C $(INFER_DIR) clean -.PHONY: all build_integration_tests clean clang clang_plugin clang_setup java test test_xml test_build +.PHONY: all buck_test buck_test_xml build_integration_tests clean clang +.PHONY: clang_plugin clang_setup inferTraceBugs_test java +.PHONY: test test_xml test_build