From 9a9d19902133ffd8215e5a9ec687480571c3e8f0 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 9 May 2018 06:59:29 -0700 Subject: [PATCH] [make] fix toplevel Summary: I needed it for debugging but, to my dismay, it was borked again. This time it was because `jbuilder` moved the object files to another directory since the last jbuilder update. Reviewed By: mbouaziz Differential Revision: D7926267 fbshipit-source-id: 42ad26a --- Makefile | 4 +--- infer/src/jbuild.in | 4 +--- infer/tests/build_systems/infertop/toplevel.exp | 2 +- scripts/infer_repl | 6 ++---- scripts/toplevel_init | 2 ++ 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 34ab77a0d..b9d0edcdb 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,7 @@ BUILD_MODE ?= opt MAKE_SOURCE = $(MAKE) -C $(SRC_DIR) INFER_BUILD_DIR=_build/$(BUILD_MODE) ifneq ($(UTOP),no) -# TODO: turn this back on -#BUILD_SYSTEMS_TESTS += infertop -#build_infertop_print build_infertop_test: test_build +BUILD_SYSTEMS_TESTS += infertop endif ifeq ($(BUILD_C_ANALYZERS),yes) diff --git a/infer/src/jbuild.in b/infer/src/jbuild.in index 85a09e7cb..e36e91318 100644 --- a/infer/src/jbuild.in +++ b/infer/src/jbuild.in @@ -83,14 +83,12 @@ let stanzas = (executable ((name infertop) (flags (%s)) - (ocamlopt_flags (%s)) (libraries (utop InferModules)) (modules (Infertop)) (preprocess (pps (ppx_compare ppx_sexp_conv -no-check))) (link_flags (-linkall -warn-error -31)))) |} - (String.concat " " infer_cflags) - (String.concat " " common_optflags) ] + (String.concat " " infer_cflags) ] @ ( List.map (fun source_dir -> [ Printf.sprintf "(copy_files# %s/*.ml{,i,l})" source_dir diff --git a/infer/tests/build_systems/infertop/toplevel.exp b/infer/tests/build_systems/infertop/toplevel.exp index 5272fa1cc..f280f100c 100644 --- a/infer/tests/build_systems/infertop/toplevel.exp +++ b/infer/tests/build_systems/infertop/toplevel.exp @@ -7,5 +7,5 @@ Findlib has been successfully loaded. Additional directives: Topfind.reset();; to force that packages will be reloaded #thread;; to enable threads -n$2 +n$13 false diff --git a/scripts/infer_repl b/scripts/infer_repl index ee9191e60..b97903c60 100755 --- a/scripts/infer_repl +++ b/scripts/infer_repl @@ -6,6 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # where to find toplevel.bc, can be overridden TOPLEVEL_DIR=${TOPLEVEL_DIR:-"$SCRIPT_DIR"/../infer/src/_build/default} +INCLUDE_FLAGS=$(find "$TOPLEVEL_DIR" -type d -name '*.objs' -exec printf -- '-I {}\n' \;) # The -init option is effective only in interactive mode. # In batch mode, scripts need to import toplevel_init themselves. @@ -20,9 +21,6 @@ set -x cd "$SCRIPT_DIR"/../infer "$TOPLEVEL_DIR"/infertop.bc \ -init "$SCRIPT_DIR"/toplevel_init \ - -I "$TOPLEVEL_DIR" \ - -I "$TOPLEVEL_DIR"/atd \ - -I "$TOPLEVEL_DIR"/istd \ - -I "$TOPLEVEL_DIR"/scripts \ + $INCLUDE_FLAGS \ -I "$SCRIPT_DIR" \ "$@" diff --git a/scripts/toplevel_init b/scripts/toplevel_init index 994c85980..9443358b9 100644 --- a/scripts/toplevel_init +++ b/scripts/toplevel_init @@ -16,6 +16,8 @@ open InferStdlib;; open InferGenerated;; +open InferBase;; +open InferIR;; open InferModules;; (* Most of infer uses this, useful for copy/pasting. Can be (partially) countered by typing `open