From 943cb5436e3fb4110e8a64a60d524bc728a6af04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hinderer?= Date: Mon, 16 Apr 2018 15:46:41 +0200 Subject: [PATCH] ocamltest: define a file type for object files --- ocamltest/ocaml_actions.ml | 2 +- ocamltest/ocaml_filetypes.ml | 7 ++++++- ocamltest/ocaml_filetypes.mli | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ocamltest/ocaml_actions.ml b/ocamltest/ocaml_actions.ml index aca041190..3555157f9 100644 --- a/ocamltest/ocaml_actions.ml +++ b/ocamltest/ocaml_actions.ml @@ -152,7 +152,7 @@ let prepare_module ocamlsrcdir output_variable log env input = let input_type = snd input in let open Ocaml_filetypes in match input_type with - | Implementation | Interface | C -> [input] + | Implementation | Interface | C | Obj -> [input] | Binary_interface -> [input] | Backend_specific _ -> [input] | C_minus_minus -> assert false diff --git a/ocamltest/ocaml_filetypes.ml b/ocamltest/ocaml_filetypes.ml index 997cc1b74..6b5884e82 100644 --- a/ocamltest/ocaml_filetypes.ml +++ b/ocamltest/ocaml_filetypes.ml @@ -25,6 +25,7 @@ type t = | Lexer | Grammar | Binary_interface + | Obj | Backend_specific of Ocaml_backends.t * backend_specific | Text (* used by ocamldoc for text only documentation *) @@ -41,6 +42,7 @@ let string_of_filetype = function | Lexer -> "lexer" | Grammar -> "grammar" | Binary_interface -> "binary interface" + | Obj -> "object" | Backend_specific (backend, filetype) -> ((Ocaml_backends.string_of_backend backend) ^ " " ^ (string_of_backend_specific filetype)) @@ -54,6 +56,7 @@ let extension_of_filetype = function | Lexer -> "mll" | Grammar -> "mly" | Binary_interface -> "cmi" + | Obj -> Ocamltest_config.objext | Backend_specific (backend, filetype) -> begin match (backend, filetype) with | (Ocaml_backends.Native, Object) -> "cmx" @@ -73,6 +76,8 @@ let filetype_of_extension = function | "mll" -> Lexer | "mly" -> Grammar | "cmi" -> Binary_interface + | "o" -> Obj + | "obj" -> Obj | "cmx" -> Backend_specific (Ocaml_backends.Native, Object) | "cmxa" -> Backend_specific (Ocaml_backends.Native, Library) | "opt" -> Backend_specific (Ocaml_backends.Native, Program) @@ -80,7 +85,7 @@ let filetype_of_extension = function | "cma" -> Backend_specific (Ocaml_backends.Bytecode, Library) | "byte" -> Backend_specific (Ocaml_backends.Bytecode, Program) | "txt" -> Text - | _ -> raise Not_found + | _ as e -> Printf.eprintf "Unknown file extension %s\n%!" e; exit 2 let split_filename name = let l = String.length name in diff --git a/ocamltest/ocaml_filetypes.mli b/ocamltest/ocaml_filetypes.mli index 89911d4b2..542d13ae0 100644 --- a/ocamltest/ocaml_filetypes.mli +++ b/ocamltest/ocaml_filetypes.mli @@ -25,6 +25,7 @@ type t = | Lexer | Grammar | Binary_interface + | Obj | Backend_specific of Ocaml_backends.t * backend_specific | Text (** text-only documentation file *)