[toplevel] install infertop in infer/bin/ to get models and stuff

Summary:
Some paths are hardcoded in infer as being relative to the current executable,
for instance the directory where to find the models. By copying infertop.bc to
infer/bin like we do for `infer` these relative paths lead to the expected
place, which means models can be loaded in the toplevel like they would be in a
normal infer execution. This is more useful for debugging than previously.

Reviewed By: jeremydubreil, mbouaziz

Differential Revision: D9197142

fbshipit-source-id: 48c4f82fb
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 69142ccad4
commit 9ea6d4723f

1
.gitignore vendored

@ -105,6 +105,7 @@ buck-out/
/infer/bin/infer-run /infer/bin/infer-run
/infer/bin/InferCreateTraceViewLinks /infer/bin/InferCreateTraceViewLinks
/infer/bin/InferUnit /infer/bin/InferUnit
/infer/bin/infertop.bc
/infer/bin/llvm_sil /infer/bin/llvm_sil
/infer/man /infer/man

@ -202,14 +202,20 @@ endif
endif endif
.PHONY: toplevel .PHONY: toplevel toplevel_test
toplevel: src_build_common toplevel toplevel_test: src_build_common
toplevel:
$(QUIET)$(call silent_on_success,Building Infer REPL,\ $(QUIET)$(call silent_on_success,Building Infer REPL,\
$(MAKE_SOURCE) toplevel) $(MAKE_SOURCE) toplevel)
$(QUIET)echo $(QUIET)echo
$(QUIET)echo "You can now use the infer REPL:" $(QUIET)echo "You can now use the infer REPL:"
$(QUIET)echo " \"$(ABSOLUTE_ROOT_DIR)/scripts/infer_repl\"" $(QUIET)echo " \"$(ABSOLUTE_ROOT_DIR)/scripts/infer_repl\""
toplevel_test: test_build
$(QUIET)$(call silent_on_success,Building Infer REPL (test mode),\
$(MAKE_SOURCE) BUILD_MODE=test toplevel)
ifeq ($(IS_FACEBOOK_TREE),yes) ifeq ($(IS_FACEBOOK_TREE),yes)
byte src_build_common src_build test_build: fb-setup byte src_build_common src_build test_build: fb-setup
endif endif
@ -355,7 +361,7 @@ $(BUILD_SYSTEMS_TESTS:%=build_%_replace): infer
$(call silence_make,\ $(call silence_make,\
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace)) $(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace))
build_infertop_print build_infertop_test build_infertop_replace: test_build build_infertop_print build_infertop_test build_infertop_replace: toplevel_test
.PHONY: build_systems_tests .PHONY: build_systems_tests
build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test) build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test)

@ -52,7 +52,6 @@ PYTHON_DIR = $(LIB_DIR)/python
PYTHON_LIB_DIR = $(PYTHON_DIR)/inferlib PYTHON_LIB_DIR = $(PYTHON_DIR)/inferlib
CAPTURE_LIB_DIR = $(PYTHON_LIB_DIR)/capture CAPTURE_LIB_DIR = $(PYTHON_LIB_DIR)/capture
INFERUNIT_BIN = $(BIN_DIR)/InferUnit
INFER_BIN = $(BIN_DIR)/infer INFER_BIN = $(BIN_DIR)/infer
INFER_COMMANDS = \ INFER_COMMANDS = \
infer-analyze \ infer-analyze \
@ -63,6 +62,9 @@ INFER_COMMANDS = \
infer-reportdiff \ infer-reportdiff \
infer-run \ infer-run \
INFERTOP_BIN = $(BIN_DIR)/infertop.bc
INFERUNIT_BIN = $(BIN_DIR)/InferUnit
INFER_CREATE_TRACEVIEW_LINKS = InferCreateTraceViewLinks INFER_CREATE_TRACEVIEW_LINKS = InferCreateTraceViewLinks
INFER_CREATE_TRACEVIEW_LINKS_BIN = $(BIN_DIR)/$(INFER_CREATE_TRACEVIEW_LINKS) INFER_CREATE_TRACEVIEW_LINKS_BIN = $(BIN_DIR)/$(INFER_CREATE_TRACEVIEW_LINKS)

@ -184,8 +184,12 @@ $(INFER_BUILD_DIR)/infertop.bc: $(SRC_DIR)/infertop.ml $(SRC_BUILD_COMMON) $(MAK
dune build $@ dune build $@
$(QUIET)touch $@ $(QUIET)touch $@
$(INFERTOP_BIN): $(INFER_BUILD_DIR)/infertop.bc
$(QUIET)$(INSTALL_PROGRAM) $< $@
$(QUIET)touch $@
.PHONY: toplevel .PHONY: toplevel
toplevel: $(INFER_BUILD_DIR)/infertop.bc toplevel: $(INFERTOP_BIN)
.PHONY: checkCopyright .PHONY: checkCopyright
checkCopyright: $(CHECKCOPYRIGHT_BIN) checkCopyright: $(CHECKCOPYRIGHT_BIN)

@ -11,8 +11,8 @@ include $(TESTS_DIR)/base.make
toplevel.exp.test: $(BUILD_DIR)/test/infertop.bc $(SCRIPT_DIR)/infer_repl \ toplevel.exp.test: $(BUILD_DIR)/test/infertop.bc $(SCRIPT_DIR)/infer_repl \
$(SCRIPT_DIR)/toplevel_init $(INFER_DIR)/tests/repl/infer_batch_script.mltop $(SCRIPT_DIR)/toplevel_init $(INFER_DIR)/tests/repl/infer_batch_script.mltop
$(QUIET)$(call silent_on_success,Testing infer OCaml REPL,\ $(QUIET)$(call silent_on_success,Testing infer OCaml REPL,\
TOPLEVEL_DIR=$(BUILD_DIR)/test $(SCRIPT_DIR)/infer_repl \ BUILD_DIR=$(BUILD_DIR)/test \
$(INFER_DIR)/tests/repl/infer_batch_script.mltop > $@) $(SCRIPT_DIR)/infer_repl $(INFER_DIR)/tests/repl/infer_batch_script.mltop > $@)
.PHONY: print .PHONY: print
print: toplevel.exp.test print: toplevel.exp.test

@ -5,8 +5,8 @@
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# where to find toplevel.bc, can be overridden # where to find toplevel.bc, can be overridden
TOPLEVEL_DIR=${TOPLEVEL_DIR:-"$SCRIPT_DIR"/../infer/src/_build/default} BUILD_DIR=${BUILD_DIR:-"$SCRIPT_DIR"/../infer/src/_build/default}
INCLUDE_FLAGS=$(find "$TOPLEVEL_DIR" -type d -name '*.objs' -exec printf -- '-I {}\n' \;) INCLUDE_FLAGS=$(find "$BUILD_DIR" -type d -name '*.objs' -exec printf -- '-I {}\n' \;)
# The -init option is effective only in interactive mode. # The -init option is effective only in interactive mode.
# In batch mode, scripts need to import toplevel_init themselves. # In batch mode, scripts need to import toplevel_init themselves.
@ -19,7 +19,7 @@ INCLUDE_FLAGS=$(find "$TOPLEVEL_DIR" -type d -name '*.objs' -exec printf -- '-I
set -x set -x
# infertop expects to be run from where dune is located # infertop expects to be run from where dune is located
cd "$SCRIPT_DIR"/../infer cd "$SCRIPT_DIR"/../infer
"$TOPLEVEL_DIR"/infertop.bc \ ./bin/infertop.bc \
-init "$SCRIPT_DIR"/toplevel_init \ -init "$SCRIPT_DIR"/toplevel_init \
$INCLUDE_FLAGS \ $INCLUDE_FLAGS \
-I "$SCRIPT_DIR" \ -I "$SCRIPT_DIR" \

Loading…
Cancel
Save