From c8cb87b77ecf329faa0c96fbc205c88db4a11b7e Mon Sep 17 00:00:00 2001 From: Seb Hinderer Date: Tue, 31 Oct 2023 09:13:47 +0100 Subject: [PATCH] Merge testsuite/tools/Makefile into the root Makefile --- .depend | 117 ++++++++++++++++++ .gitignore | 7 +- Makefile | 44 ++++++- Makefile.build_config.in | 2 + configure | 10 +- configure.ac | 8 +- ocamltest/ocaml_actions.ml | 2 +- ocamltest/ocaml_commands.ml | 4 +- ocamltest/ocaml_commands.mli | 2 +- ocamltest/ocaml_files.ml | 4 +- ocamltest/ocaml_files.mli | 2 +- testsuite/Makefile | 19 +-- .../shadow_include/cannot_shadow_error.ml | 2 +- testsuite/tools/Makefile | 99 --------------- testsuite/tools/codegen_main.mli | 16 +++ testsuite/tools/{expect_test.ml => expect.ml} | 4 +- testsuite/tools/expect.mli | 25 ++++ testsuite/tools/parsecmm.mly | 2 +- 18 files changed, 233 insertions(+), 136 deletions(-) delete mode 100644 testsuite/tools/Makefile create mode 100644 testsuite/tools/codegen_main.mli rename testsuite/tools/{expect_test.ml => expect.ml} (99%) create mode 100644 testsuite/tools/expect.mli diff --git a/.depend b/.depend index 5965ad57ecd..c4f551c697e 100644 --- a/.depend +++ b/.depend @@ -9496,3 +9496,120 @@ testsuite/lib/testing.cmo : \ testsuite/lib/testing.cmx : \ testsuite/lib/testing.cmi testsuite/lib/testing.cmi : +testsuite/tools/codegen_main.cmo : \ + utils/profile.cmi \ + testsuite/tools/parsecmmaux.cmi \ + testsuite/tools/parsecmm.cmi \ + testsuite/tools/lexcmm.cmi \ + asmcomp/emitaux.cmi \ + asmcomp/emit.cmi \ + middle_end/compilenv.cmi \ + utils/clflags.cmi \ + asmcomp/asmgen.cmi \ + testsuite/tools/codegen_main.cmi +testsuite/tools/codegen_main.cmx : \ + utils/profile.cmx \ + testsuite/tools/parsecmmaux.cmx \ + testsuite/tools/parsecmm.cmx \ + testsuite/tools/lexcmm.cmx \ + asmcomp/emitaux.cmx \ + asmcomp/emit.cmx \ + middle_end/compilenv.cmx \ + utils/clflags.cmx \ + asmcomp/asmgen.cmx \ + testsuite/tools/codegen_main.cmi +testsuite/tools/codegen_main.cmi : +testsuite/tools/expect.cmo : \ + utils/warnings.cmi \ + toplevel/toploop.cmi \ + parsing/printast.cmi \ + parsing/pprintast.cmi \ + parsing/parsetree.cmi \ + parsing/parse.cmi \ + utils/misc.cmi \ + driver/main_args.cmi \ + parsing/location.cmi \ + utils/load_path.cmi \ + driver/compmisc.cmi \ + driver/compenv.cmi \ + utils/clflags.cmi \ + typing/btype.cmi \ + parsing/asttypes.cmi \ + parsing/ast_mapper.cmi \ + testsuite/tools/expect.cmi +testsuite/tools/expect.cmx : \ + utils/warnings.cmx \ + toplevel/toploop.cmx \ + parsing/printast.cmx \ + parsing/pprintast.cmx \ + parsing/parsetree.cmi \ + parsing/parse.cmx \ + utils/misc.cmx \ + driver/main_args.cmx \ + parsing/location.cmx \ + utils/load_path.cmx \ + driver/compmisc.cmx \ + driver/compenv.cmx \ + utils/clflags.cmx \ + typing/btype.cmx \ + parsing/asttypes.cmi \ + parsing/ast_mapper.cmx \ + testsuite/tools/expect.cmi +testsuite/tools/expect.cmi : \ + parsing/location.cmi +testsuite/tools/lexcmm.cmo : \ + testsuite/tools/parsecmm.cmi \ + utils/misc.cmi \ + parsing/location.cmi \ + lambda/lambda.cmi \ + testsuite/tools/lexcmm.cmi +testsuite/tools/lexcmm.cmx : \ + testsuite/tools/parsecmm.cmx \ + utils/misc.cmx \ + parsing/location.cmx \ + lambda/lambda.cmx \ + testsuite/tools/lexcmm.cmi +testsuite/tools/lexcmm.cmi : \ + testsuite/tools/parsecmm.cmi +testsuite/tools/parsecmm.cmo : \ + testsuite/tools/parsecmmaux.cmi \ + utils/misc.cmi \ + parsing/location.cmi \ + lambda/lambda.cmi \ + lambda/debuginfo.cmi \ + utils/config.cmi \ + asmcomp/cmm.cmi \ + parsing/asttypes.cmi \ + asmcomp/arch.cmi \ + testsuite/tools/parsecmm.cmi +testsuite/tools/parsecmm.cmx : \ + testsuite/tools/parsecmmaux.cmx \ + utils/misc.cmx \ + parsing/location.cmx \ + lambda/lambda.cmx \ + lambda/debuginfo.cmx \ + utils/config.cmx \ + asmcomp/cmm.cmx \ + parsing/asttypes.cmi \ + asmcomp/arch.cmx \ + testsuite/tools/parsecmm.cmi +testsuite/tools/parsecmm.cmi : \ + parsing/location.cmi \ + lambda/lambda.cmi \ + asmcomp/cmm.cmi +testsuite/tools/parsecmmaux.cmo : \ + parsing/location.cmi \ + lambda/lambda.cmi \ + lambda/debuginfo.cmi \ + middle_end/backend_var.cmi \ + testsuite/tools/parsecmmaux.cmi +testsuite/tools/parsecmmaux.cmx : \ + parsing/location.cmx \ + lambda/lambda.cmx \ + lambda/debuginfo.cmx \ + middle_end/backend_var.cmx \ + testsuite/tools/parsecmmaux.cmi +testsuite/tools/parsecmmaux.cmi : \ + parsing/location.cmi \ + lambda/debuginfo.cmi \ + middle_end/backend_var.cmi diff --git a/.gitignore b/.gitignore index f8fd91ce5ca..f0ca32d4688 100644 --- a/.gitignore +++ b/.gitignore @@ -195,11 +195,7 @@ META /ocamldoc/odoc_text_parser.ml /ocamldoc/odoc_text_parser.mli /ocamldoc/*.output -/ocamldoc/test_stdlib -/ocamldoc/test_latex -/ocamldoc/test -/ocamltest/.dep /ocamltest/ocamltest /ocamltest/ocamltest.opt /ocamltest/ocamltest_config.ml @@ -273,9 +269,8 @@ META /testsuite/_retries - /testsuite/tools/codegen -/testsuite/tools/expect_test +/testsuite/tools/expect /testsuite/tools/lexcmm.ml /testsuite/tools/parsecmm.ml /testsuite/tools/parsecmm.mli diff --git a/Makefile b/Makefile index 28374bbe28d..9fe3e140bd4 100644 --- a/Makefile +++ b/Makefile @@ -540,14 +540,15 @@ $(foreach PROGRAM, $(OCAML_PROGRAMS),\ OCAML_BYTECODE_PROGRAMS = expunge \ $(TOOLS_BYT_PROGRAMS) \ $(addprefix tools/, cvt_emit make_opcodes ocamltex) \ - debugger/ocamldebug + $(OPTIONAL_BYTECODE_TOOLS) $(foreach PROGRAM, $(OCAML_BYTECODE_PROGRAMS),\ $(eval $(call OCAML_BYTECODE_PROGRAM,$(PROGRAM)))) # OCaml programs that are compiled only in native code -OCAML_NATIVE_PROGRAMS = ocamlnat tools/lintapidiff.opt +OCAML_NATIVE_PROGRAMS = \ + ocamlnat tools/lintapidiff.opt $(OPTIONAL_NATIVE_TOOLS) $(foreach PROGRAM, $(OCAML_NATIVE_PROGRAMS),\ $(eval $(call OCAML_NATIVE_PROGRAM,$(PROGRAM)))) @@ -1806,7 +1807,7 @@ $(ocamltest_DEP_FILES): $(DEPDIR)/ocamltest/%.$(D): ocamltest/%.c ocamltest/%: CAMLC = $(BEST_OCAMLC) $(STDLIBFLAGS) ocamltest: ocamltest/ocamltest$(EXE) \ - testsuite/lib/lib.cmo testsuite/lib/testing.cma + testsuite/lib/lib.cmo testsuite/lib/testing.cma testsuite/tools/expect$(EXE) testsuite/lib/%: VPATH += testsuite/lib @@ -1816,11 +1817,39 @@ testing_LIBRARIES = $(addprefix testsuite/lib/testing., cma cmxa): \ OC_COMMON_LINKFLAGS += -linkall +testsuite/tools/%: VPATH += testsuite/tools + +expect_SOURCES = $(addprefix testsuite/tools/,expect.mli expect.ml) +expect_LIBRARIES = $(addprefix compilerlibs/,\ + ocamlcommon ocamlbytecomp ocamltoplevel) + +testsuite/tools/expect$(EXE): OC_BYTECODE_LINKFLAGS += -linkall + +codegen_SOURCES = $(addprefix testsuite/tools/,\ + parsecmmaux.mli parsecmmaux.ml \ + parsecmm.mly \ + lexcmm.mli lexcmm.mll \ + codegen_main.mli codegen_main.ml) +codegen_LIBRARIES = $(addprefix compilerlibs/,ocamlcommon ocamloptcomp) + +# The asmgen tests are not ported to MSVC64 yet, so make sure +# to compile the arch specific module they require only if necessary +ifeq "$(CCOMPTYPE)-$(ARCH)" "msvc-amd64" +asmgen_OBJECT = +else +asmgen_MODULE = testsuite/tools/asmgen_$(ARCH) +asmgen_SOURCE = $(asmgen_MODULE).S +asmgen_OBJECT = $(asmgen_MODULE).$(O) +$(asmgen_OBJECT): $(asmgen_SOURCE) + $(V_ASM)$(ASPP) $(OC_ASPPFLAGS) -o $@ $< || $(ASPP_ERROR) +endif + ocamltest/ocamltest$(EXE): OC_BYTECODE_LINKFLAGS += -custom ocamltest/ocamltest$(EXE): ocamlc ocamlyacc ocamllex -ocamltest.opt: ocamltest/ocamltest.opt$(EXE) testsuite/lib/testing.cmxa +ocamltest.opt: ocamltest/ocamltest.opt$(EXE) \ + testsuite/lib/testing.cmxa $(asmgen_OBJECT) testsuite/tools/codegen$(EXE) ocamltest/ocamltest.opt$(EXE): ocamlc.opt ocamlyacc ocamllex @@ -1848,6 +1877,11 @@ partialclean:: rm -rf $(ocamltest_GENERATED_FILES) rm -f ocamltest/ocamltest.html rm -f $(addprefix testsuite/lib/*.,cm* o obj a lib) + rm -f $(addprefix testsuite/tools/*.,cm* o obj a lib) + rm -f testsuite/tools/codegen testsuite/tools/codegen.exe + rm -f testsuite/tools/expect testsuite/tools/expect.exe + rm -f testsuite/tools/lexcmm.ml + rm -f $(addprefix testsuite/tools/parsecmm., ml mli output) # Documentation @@ -2347,7 +2381,7 @@ depend: beforedepend lambda file_formats middle_end/closure middle_end/flambda \ middle_end/flambda/base_types \ driver toplevel toplevel/byte toplevel/native lex tools debugger \ - ocamldoc ocamltest testsuite/lib; \ + ocamldoc ocamltest testsuite/lib testsuite/tools; \ do \ $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) -I $$d $(INCLUDES) \ $(OCAMLDEPFLAGS) $$d/*.mli $$d/*.ml \ diff --git a/Makefile.build_config.in b/Makefile.build_config.in index 764b3da8f73..4df7f517841 100644 --- a/Makefile.build_config.in +++ b/Makefile.build_config.in @@ -53,6 +53,8 @@ lib_systhreads = @lib_systhreads@ lib_unix = @lib_unix@ OPTIONAL_LIBRARIES = @optional_libraries@ +OPTIONAL_BYTECODE_TOOLS = @optional_bytecode_tools@ +OPTIONAL_NATIVE_TOOLS = @optional_native_tools@ # Whether to install the native toplevel (ocamlnat) INSTALL_OCAMLNAT = @install_ocamlnat@ diff --git a/configure b/configure index b1d73fae71d..5baeb22ec68 100755 --- a/configure +++ b/configure @@ -833,6 +833,8 @@ unix_directory unix_library ocamltest_libunix ocamltest_CPP +optional_native_tools +optional_bytecode_tools optional_libraries lib_unix lib_systhreads @@ -3285,6 +3287,8 @@ lib_str=false lib_systhreads=false lib_unix=false optional_libraries='' +optional_bytecode_tools='' +optional_native_tools='' ocamltest_libunix=None ocamltest_unix_impl="dummy" unix_library="" @@ -3424,6 +3428,8 @@ LINEAR_MAGIC_NUMBER=Caml1999L033 + + @@ -18636,6 +18642,7 @@ printf "%s\n" "$as_me: ocamldebug disabled" >&6;} ;; #( then : with_debugger="ocamldebug" build_ocamldebug=true + optional_bytecode_tools="$optional_bytecode_tools debugger/ocamldebug" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: ocamldebug supported" >&5 printf "%s\n" "$as_me: ocamldebug supported" >&6;} else $as_nop @@ -19840,7 +19847,8 @@ case $enable_ocamltest,true in #( ocamltest_target=ocamltest ocamltest_opt_target=ocamltest.opt ocamltest='ocamltest' - ;; #( + testsuite_tools='testsuite/tools/codegen testsuite/tools/expect' + optional_bytecode_tools="$optional_bytecode_tools $testsuite_tools" ;; #( *) : build_ocamltest=false ocamltest='' ;; diff --git a/configure.ac b/configure.ac index fae3467d5e1..ee79df22761 100644 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,8 @@ lib_str=false lib_systhreads=false lib_unix=false optional_libraries='' +optional_bytecode_tools='' +optional_native_tools='' ocamltest_libunix=None ocamltest_unix_impl="dummy" unix_library="" @@ -191,6 +193,8 @@ AC_SUBST([lib_str]) AC_SUBST([lib_systhreads]) AC_SUBST([lib_unix]) AC_SUBST([optional_libraries]) +AC_SUBST([optional_bytecode_tools]) +AC_SUBST([optional_native_tools]) AC_SUBST([ocamltest_CPP]) AC_SUBST([ocamltest_libunix]) AC_SUBST([unix_library]) @@ -2181,6 +2185,7 @@ AS_CASE([$enable_ocamldebug], [AS_IF([$sockets], [with_debugger="ocamldebug" build_ocamldebug=true + optional_bytecode_tools="$optional_bytecode_tools debugger/ocamldebug" AC_MSG_NOTICE([ocamldebug supported])], [with_debugger="" build_ocamldebug=false @@ -2314,7 +2319,8 @@ AS_CASE([$enable_ocamltest,OCAML__DEVELOPMENT_VERSION], ocamltest_target=ocamltest ocamltest_opt_target=ocamltest.opt ocamltest='ocamltest' - ], + testsuite_tools='testsuite/tools/codegen testsuite/tools/expect' + optional_bytecode_tools="$optional_bytecode_tools $testsuite_tools"], [build_ocamltest=false ocamltest='']) diff --git a/ocamltest/ocaml_actions.ml b/ocamltest/ocaml_actions.ml index 05262bcd89f..7f116d2aed9 100644 --- a/ocamltest/ocaml_actions.ml +++ b/ocamltest/ocaml_actions.ml @@ -794,7 +794,7 @@ let run_expect_once input_file principal log env = let principal_flag = if principal then "-principal" else "" in let commandline = [ - Ocaml_commands.ocamlrun_expect_test; + Ocaml_commands.ocamlrun_expect; expect_flags; flags env; repo_root; diff --git a/ocamltest/ocaml_commands.ml b/ocamltest/ocaml_commands.ml index 3d6834a0db6..ef213876ad4 100644 --- a/ocamltest/ocaml_commands.ml +++ b/ocamltest/ocaml_commands.ml @@ -24,8 +24,8 @@ let ocamlrun_ocamlopt = ocamlrun Ocaml_files.ocamlopt let ocamlrun_ocaml = ocamlrun Ocaml_files.ocaml -let ocamlrun_expect_test = - ocamlrun Ocaml_files.expect_test +let ocamlrun_expect = + ocamlrun Ocaml_files.expect let ocamlrun_ocamllex = ocamlrun Ocaml_files.ocamllex diff --git a/ocamltest/ocaml_commands.mli b/ocamltest/ocaml_commands.mli index 3cacfaef2be..200c3143082 100644 --- a/ocamltest/ocaml_commands.mli +++ b/ocamltest/ocaml_commands.mli @@ -21,7 +21,7 @@ val ocamlrun_ocamlopt : string val ocamlrun_ocaml : string -val ocamlrun_expect_test : string +val ocamlrun_expect : string val ocamlrun_ocamllex : string diff --git a/ocamltest/ocaml_files.ml b/ocamltest/ocaml_files.ml index 1e3c7dfa139..74b17193030 100644 --- a/ocamltest/ocaml_files.ml +++ b/ocamltest/ocaml_files.ml @@ -58,10 +58,10 @@ let cmpbyt = Filename.make_path [Ocaml_directories.srcdir; "tools"; Filename.mkexe "cmpbyt"] -let expect_test = +let expect = Filename.make_path [Ocaml_directories.srcdir; "testsuite"; "tools"; - Filename.mkexe "expect_test"] + Filename.mkexe "expect"] let ocamllex = Filename.make_path diff --git a/ocamltest/ocaml_files.mli b/ocamltest/ocaml_files.mli index 56566454f2a..d7ac01c5929 100644 --- a/ocamltest/ocaml_files.mli +++ b/ocamltest/ocaml_files.mli @@ -38,7 +38,7 @@ val ocamlnat : string val cmpbyt : string -val expect_test : string +val expect : string val ocamllex : string diff --git a/testsuite/Makefile b/testsuite/Makefile index 6399399d57a..55f55ec79de 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -141,7 +141,6 @@ default: @echo " ... DIR=d ... the tests located in the directory d" @echo " ... LIST=f ... the tests listed in the file f (one \ per line)" - @echo " tools build test tools" @echo " clean delete generated files" @echo " report print the report for the last execution" @echo @@ -158,7 +157,7 @@ all: @$(MAKE) --no-print-directory report .PHONY: new-without-report -new-without-report: tools +new-without-report: @rm -f $(failstamp) @($(ocamltest) -find-test-dirs tests | while $(IFS_LINE) read -r dir; do \ echo Running tests from \'$$dir\' ... ; \ @@ -177,7 +176,7 @@ check-failstamp: fi .PHONY: all-% -all-%: tools +all-%: @for dir in tests/$**; do \ $(MAKE) --no-print-directory exec-one DIR=$$dir; \ done 2>&1 | tee $(TESTLOG) @@ -215,7 +214,7 @@ all-%: tools J_ARGUMENT = $(filter-out -j,$(filter -j%,$(MAKEFLAGS))) .PHONY: parallel-% -parallel-%: tools +parallel-%: @echo | parallel >/dev/null 2>/dev/null \ || (echo "Unable to run the GNU parallel tool;";\ echo "You should install it before using the parallel* targets.";\ @@ -234,7 +233,7 @@ parallel-%: tools parallel: parallel-* .PHONY: list -list: tools +list: @if [ -z "$(FILE)" ]; \ then echo "No value set for variable 'FILE'."; \ exit 1; \ @@ -242,7 +241,7 @@ list: tools @$(MAKE) --no-print-directory one LIST="$(FILE)" .PHONY: one -one: tools +one: @case "$(words $(DIR) $(LIST) $(TEST))" in \ 0) echo 'No value set for variable DIR, LIST or TEST'>&2; exit 1;; \ 1) exit 0;; \ @@ -303,23 +302,17 @@ clean-one: fi .PHONY: promote -promote: tools +promote: @$(MAKE) one PROMOTE=true -.PHONY: tools -tools: - @cd tools && $(MAKE) -s BASEDIR=$(BASEDIR) - .PHONY: clean clean: - @cd tools && $(MAKE) BASEDIR=$(BASEDIR) clean find . -name '*_ocamltest*' | xargs rm -rf rm -f $(failstamp) .PHONY: distclean distclean: clean rm -f _log* - $(MAKE) -C tools distclean .PHONY: report report: diff --git a/testsuite/tests/shadow_include/cannot_shadow_error.ml b/testsuite/tests/shadow_include/cannot_shadow_error.ml index 0432f082a3d..94181c4b12b 100644 --- a/testsuite/tests/shadow_include/cannot_shadow_error.ml +++ b/testsuite/tests/shadow_include/cannot_shadow_error.ml @@ -7,7 +7,7 @@ *) (* Same example as in tests/typing-sigsubst/sigsubst.ml, but not as an - expect_test so we get the full error. *) + expect test so we get the full error. *) module type Printable = sig type t diff --git a/testsuite/tools/Makefile b/testsuite/tools/Makefile deleted file mode 100644 index 9cc1133449f..00000000000 --- a/testsuite/tools/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -#************************************************************************** -#* * -#* OCaml * -#* * -#* Jeremie Dimino, Jane Street Europe * -#* * -#* Copyright 2016 Jane Street Group LLC * -#* * -#* All rights reserved. This file is distributed under the terms of * -#* the GNU Lesser General Public License version 2.1, with the * -#* special exception on linking described in the file LICENSE. * -#* * -#************************************************************************** - -.NOTPARALLEL: - -ROOTDIR = ../.. - -COMPILERLIBSDIR = $(ROOTDIR)/compilerlibs - -RUNTIME_VARIANT ?= - -include $(ROOTDIR)/Makefile.common -include $(ROOTDIR)/Makefile.best_binaries - -OCAMLC ?= $(BEST_OCAMLC) $(STDLIBFLAGS) - -expect_MAIN=expect_test -expect_PROG=$(expect_MAIN)$(EXE) -expect_DIRS = parsing utils driver typing toplevel -expect_OCAMLFLAGS = $(addprefix -I $(ROOTDIR)/,$(expect_DIRS)) -expect_LIBS := $(addsuffix .cma,$(addprefix $(COMPILERLIBSDIR)/,\ - ocamlcommon ocamlbytecomp ocamltoplevel)) - -codegen_PROG = codegen$(EXE) -codegen_DIRS = parsing utils typing middle_end bytecomp lambda asmcomp -codegen_OCAMLFLAGS = $(addprefix -I $(ROOTDIR)/, $(codegen_DIRS)) -w +40 -g - -codegen_LIBS = $(addsuffix .cma, $(addprefix $(COMPILERLIBSDIR)/,\ - ocamlcommon ocamloptcomp)) - -codegen_CMI_FILES = $(addsuffix .cmi,\ - parsecmmaux parsecmm lexcmm) -codegen_CMO_FILES = $(addsuffix .cmo,\ - parsecmmaux parsecmm lexcmm codegen_main) - -tools := $(expect_PROG) - -ifeq "$(NATIVE_COMPILER)" "true" -tools += $(codegen_PROG) -ifneq "$(CCOMPTYPE)-$(ARCH)" "msvc-amd64" -# The asmgen tests are not ported to MSVC64 yet -# so do not compile any arch-specific module -tools += asmgen_$(ARCH).$(O) -endif -endif - -.PHONY: all -all: $(tools) - -$(expect_PROG): $(expect_LIBS) $(expect_MAIN).cmo - $(OCAMLC) -linkall -o $@ $^ - -$(expect_PROG): COMPFLAGS = $(expect_OCAMLFLAGS) - -$(codegen_PROG): COMPFLAGS = $(codegen_OCAMLFLAGS) - -codegen_main.cmo: parsecmm.cmo - -$(codegen_PROG): $(codegen_LIBS) $(codegen_CMO_FILES) - $(OCAMLC) -o $@ $(COMPFLAGS) $^ - -parsecmmaux.cmo: parsecmmaux.cmi - -lexcmm.cmo: lexcmm.cmi - -parsecmm.cmo: parsecmm.cmi - -expect_test.cmo: $(expect_LIBS) - -$(codegen_CMI_FILES) $(codegen_CMO_FILES): $(codegen_LIBS) - -%.cmi: %.mli - $(OCAMLC) $(COMPFLAGS) -c $< - -%.cmo: %.ml - $(OCAMLC) $(COMPFLAGS) -c $< - -%.$(O): %.S - $(ASPP) $(OC_ASPPFLAGS) -o $@ $< - -.PHONY: clean -clean: - rm -f *.cm* *.o *.obj - rm -f expect_test expect_test.exe codegen codegen.exe - rm -f parsecmm.ml parsecmm.mli parsecmm.output lexcmm.ml - -.PHONY: distclean -distclean: clean diff --git a/testsuite/tools/codegen_main.mli b/testsuite/tools/codegen_main.mli new file mode 100644 index 00000000000..8167c234595 --- /dev/null +++ b/testsuite/tools/codegen_main.mli @@ -0,0 +1,16 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Sebastien Hinderer, Tarides *) +(* *) +(* Copyright 2023 Institut National de Recherche en Informatique et *) +(* en Automatique. *) +(* *) +(* All rights reserved. This file is distributed under the terms of *) +(* the GNU Lesser General Public License version 2.1, with the *) +(* special exception on linking described in the file LICENSE. *) +(* *) +(**************************************************************************) + +(* Empty interface file *) diff --git a/testsuite/tools/expect_test.ml b/testsuite/tools/expect.ml similarity index 99% rename from testsuite/tools/expect_test.ml rename to testsuite/tools/expect.ml index 7896f8b037c..be0e5dbd4a5 100644 --- a/testsuite/tools/expect_test.ml +++ b/testsuite/tools/expect.ml @@ -361,7 +361,7 @@ let args = ] @ Options.list ) -let usage = "Usage: expect_test [script-file [arguments]]\n\ +let usage = "Usage: expect [script-file [arguments]]\n\ options are:" let () = @@ -372,7 +372,7 @@ let () = in try Arg.parse args main usage; - Printf.eprintf "expect_test: no input file\n"; + Printf.eprintf "expect: no input file\n"; exit 2 with exn -> Location.report_exception Format.err_formatter exn; diff --git a/testsuite/tools/expect.mli b/testsuite/tools/expect.mli new file mode 100644 index 00000000000..06025618f8c --- /dev/null +++ b/testsuite/tools/expect.mli @@ -0,0 +1,25 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Jeremie Dimino, Jane Street Europe *) +(* *) +(* Copyright 2016 Jane Street Group LLC *) +(* *) +(* All rights reserved. This file is distributed under the terms of *) +(* the GNU Lesser General Public License version 2.1, with the *) +(* special exception on linking described in the file LICENSE. *) +(* *) +(**************************************************************************) + +type string_constant = + { str : string + ; tag : string + } + +type expectation = + { extid_loc : Location.t (* Location of "expect" in "[%%expect ...]" *) + ; payload_loc : Location.t (* Location of the whole payload *) + ; normal : string_constant (* expectation without -principal *) + ; principal : string_constant (* expectation with -principal *) + } diff --git a/testsuite/tools/parsecmm.mly b/testsuite/tools/parsecmm.mly index d9807e24d5f..2e61069dd61 100644 --- a/testsuite/tools/parsecmm.mly +++ b/testsuite/tools/parsecmm.mly @@ -172,7 +172,7 @@ phrase: ; fundecl: LPAREN FUNCTION fun_name LPAREN params RPAREN sequence RPAREN - { List.iter (fun (id, ty) -> unbind_ident id) $5; + { List.iter (fun (id, _ty) -> unbind_ident id) $5; {fun_name = $3; fun_args = $5; fun_body = $7; fun_codegen_options = if Config.flambda then [