[test] test the correct version of toplevel.cmo

Summary:
There are 2 possible places where to find toplevel.cmo:
- infer/_build/infer/toplevel.cmo, built by `make toplevel`
- infer/_build/test/infer/toplevel.cmo, built by `make test`

The test loading and running toplevel.cmo would give priority to the non-test
version of toplevel.cmo, which might be stale because `make test` doesn't
rebuild it.

This diff makes sure we use the test version of toplevel.cmo in `make test`.

Reviewed By: akotulski

Differential Revision: D4960550

fbshipit-source-id: 9c817ba
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent c0c813c657
commit 35c7d67c5c

@ -289,7 +289,8 @@ toplevel: clang_plugin
.PHONY: inferScriptMode_test .PHONY: inferScriptMode_test
inferScriptMode_test: test_build inferScriptMode_test: test_build
$(QUIET)$(call silent_on_success,Testing infer OCaml REPL,\ $(QUIET)$(call silent_on_success,Testing infer OCaml REPL,\
INFER_REPL_BINARY=ocaml $(SCRIPT_DIR)/infer_repl $(INFER_DIR)/tests/repl/infer_batch_script.ml) INFER_REPL_BINARY=ocaml TOPLEVEL_DIR=$(BUILD_DIR)/test/infer $(SCRIPT_DIR)/infer_repl \
$(INFER_DIR)/tests/repl/infer_batch_script.ml)
.PHONY: checkCopyright .PHONY: checkCopyright
checkCopyright: checkCopyright:

@ -2,14 +2,11 @@
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# _build/infer is first so that it takes precedence. This way if someone explicitly builds the # where to find toplevel.cmo, can be overridden
# toplevel (`make toplevel`) they get the expected version of infer. The _build/test toplevel is TOPLEVEL_DIR=${TOPLEVEL_DIR:-"$SCRIPT_DIR"/../infer/_build/infer}
# built during `make test` which is probably run less often, hence why it doesn't take
# precedence. Of course this cannot be perfect so caution is advised. # how to load the toplevel; can be overridden (with "ocaml" for example)
TOPLEVEL_INCLUDES=( INFER_REPL_BINARY=${INFER_REPL_BINARY:-"utop"}
-I "$SCRIPT_DIR"/../infer/_build/infer
-I "$SCRIPT_DIR"/../infer/_build/test/infer
)
# to build new toplevel, run `make toplevel` # to build new toplevel, run `make toplevel`
# -init option is used only in interactive mode # -init option is used only in interactive mode
@ -20,9 +17,4 @@ TOPLEVEL_INCLUDES=(
# so they can be located anywhere and still find toplevel_init # so they can be located anywhere and still find toplevel_init
# file. In interactive mode $SCRIPT_DIR isn't needed # file. In interactive mode $SCRIPT_DIR isn't needed
# by default utop is used, pass `INFER_REPL_BINARY` to change the toplevel "$INFER_REPL_BINARY" -init "$SCRIPT_DIR"/toplevel_init -I "$TOPLEVEL_DIR" -I "$SCRIPT_DIR" $@
# binary (to `ocaml` for example)
if [ -z "$INFER_REPL_BINARY" ]; then
INFER_REPL_BINARY="utop"
fi
$INFER_REPL_BINARY -init $SCRIPT_DIR/toplevel_init ${TOPLEVEL_INCLUDES[@]} -I $SCRIPT_DIR $@

Loading…
Cancel
Save