1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Sebastien Hinderer, projet Gallium, INRIA Paris *)
6 (* *)
7 (* Copyright 2016 Institut National de Recherche en Informatique et *)
8 (* en Automatique. *)
9 (* *)
10 (* All rights reserved. This file is distributed under the terms of *)
11 (* the GNU Lesser General Public License version 2.1, with the *)
12 (* special exception on linking described in the file LICENSE. *)
13 (* *)
14 (**************************************************************************)
15
16 (* Tests specific to the OCaml compiler *)
17
18 open Tests
19 open Builtin_actions
20 open Ocaml_actions
21
22 let bytecode =
23 let opt_actions =
24 [
25 setup_ocamlc_opt_build_env;
26 ocamlc_opt;
27 check_ocamlc_opt_output;
28 compare_bytecode_programs
29 ] in
30 {
31 test_name = "bytecode";
32 test_run_by_default = true;
33 test_actions =
34 [
35 setup_ocamlc_byte_build_env;
36 ocamlc_byte;
37 check_ocamlc_byte_output;
38 run;
39 check_program_output;
40 ] @ (if Ocamltest_config.arch<>"none" then opt_actions else [])
41 }
42
43 let native =
44 let opt_actions =
45 [
46 setup_ocamlopt_byte_build_env;
47 ocamlopt_byte;
48 check_ocamlopt_byte_output;
49 run;
50 check_program_output;
51 setup_ocamlopt_opt_build_env;
52 ocamlopt_opt;
53 check_ocamlopt_opt_output;
54 compare_native_programs;
55 ] in
56 {
57 test_name = "native";
58 test_run_by_default = true;
59 test_actions =
60 (if Ocamltest_config.arch<>"none" then opt_actions else [skip])
61 }
62
63 let toplevel = {
64 test_name = "toplevel";
65 test_run_by_default = false;
66 test_actions =
67 [
68 setup_ocaml_build_env;
69 ocaml;
70 check_ocaml_output;
71 (*
72 setup_ocamlnat_build_env;
73 ocamlnat;
74 check_ocamlnat_output;
75 *)
76 ]
77 }
78
79 let expect =
80 {
81 test_name = "expect";
82 test_run_by_default = false;
83 test_actions =
84 [
85 setup_simple_build_env;
86 run_expect;
87 check_program_output
88 ]
89 }
90
91 let ocamldoc =
92 {
93 test_name = "ocamldoc";
94 test_run_by_default = false;
95 test_actions =
96 if Ocamltest_config.ocamldoc then
97 [
98 shared_libraries;
99 setup_ocamldoc_build_env;
100 run_ocamldoc;
101 check_program_output;
102 check_ocamldoc_output
103 ]
104 else
105 [ skip ]
106 }
107
108 let asmgen_skip_on_bytecode_only =
109 Actions_helpers.skip_with_reason "native compiler disabled"
110
111 let asmgen_skip_on_spacetime =
112 Actions_helpers.skip_with_reason "not ported to Spacetime yet"
113
114 let msvc64 =
115 Ocamltest_config.ccomptype = "msvc" && Ocamltest_config.arch="amd64"
116
117 let asmgen_skip_on_msvc64 =
118 Actions_helpers.skip_with_reason "not ported to MSVC64 yet"
119
120 let asmgen_actions =
121 if Ocamltest_config.arch="none" then [asmgen_skip_on_bytecode_only]
122 else if Ocamltest_config.spacetime then [asmgen_skip_on_spacetime]
123 else if msvc64 then [asmgen_skip_on_msvc64]
124 else [
125 setup_simple_build_env;
126 codegen;
127 cc;
128 ]
129
130 let asmgen =
131 {
132 test_name = "asmgen";
133 test_run_by_default = false;
134 test_actions = asmgen_actions
135 }
136
137 let _ =
138 List.iter register
139 [
140 bytecode;
141 native;
142 toplevel;
143 expect;
144 ocamldoc;
145 asmgen;
146 ]
147