2017-07-21 07:43:36 -07:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* OCaml *)
|
|
|
|
(* *)
|
|
|
|
(* Sebastien Hinderer, projet Gallium, INRIA Paris *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 2016 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. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(* Definition of a few built-in actions *)
|
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
open Ocamltest_stdlib
|
2017-07-21 07:43:36 -07:00
|
|
|
open Actions
|
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let pass = make
|
|
|
|
"pass"
|
|
|
|
(fun log env ->
|
2017-10-09 02:36:40 -07:00
|
|
|
Printf.fprintf log "The pass action always succeeds.\n%!";
|
2017-11-03 10:52:11 -07:00
|
|
|
Pass env)
|
|
|
|
|
|
|
|
let skip = make
|
|
|
|
"skip"
|
|
|
|
(fun _log _env -> Skip "The skip action always skips.")
|
2017-10-09 02:36:40 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let fail = make
|
|
|
|
"fail"
|
|
|
|
(fun _log _env -> Fail "The fail action always fails.")
|
2017-10-09 02:36:40 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let dumpenv = make
|
|
|
|
"dumpenv"
|
|
|
|
(fun log env ->
|
|
|
|
Environments.dump log env; Pass env)
|
2017-10-09 02:36:40 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let unix = make
|
|
|
|
"unix"
|
2018-01-22 07:38:44 -08:00
|
|
|
(Actions_helpers.pass_or_skip Ocamltest_config.unix
|
|
|
|
"The unix action succeeds because we are on a Unix system.\n"
|
|
|
|
"The unix action skips because we are on a Windows system.")
|
2017-10-09 04:51:25 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let windows = make
|
|
|
|
"windows"
|
2018-01-22 07:38:44 -08:00
|
|
|
(Actions_helpers.pass_or_skip (not Ocamltest_config.unix)
|
|
|
|
"The windows action succeeds because we are on a Windows system.\n"
|
|
|
|
"The windows action skips because we are on a Unix system.")
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let setup_build_env = make
|
|
|
|
"setup-build-env"
|
|
|
|
(Actions_helpers.setup_build_env true [])
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2017-12-08 06:00:48 -08:00
|
|
|
let setup_simple_build_env = make
|
|
|
|
"setup-simple-build-env"
|
|
|
|
(Actions_helpers.setup_simple_build_env true [])
|
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let run = make
|
|
|
|
"run"
|
|
|
|
Actions_helpers.run_program
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let script = make
|
|
|
|
"script"
|
|
|
|
Actions_helpers.run_script
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let check_program_output = make
|
|
|
|
"check-program-output"
|
|
|
|
(Actions_helpers.check_output "program"
|
2017-07-21 07:43:36 -07:00
|
|
|
Builtin_variables.output
|
2017-11-03 10:52:11 -07:00
|
|
|
Builtin_variables.reference)
|
2017-07-21 07:43:36 -07:00
|
|
|
|
2017-11-03 10:52:11 -07:00
|
|
|
let initialize_test_exit_status_variables _log env =
|
|
|
|
Environments.add_bindings
|
2017-07-21 07:43:36 -07:00
|
|
|
[
|
2017-11-03 10:52:11 -07:00
|
|
|
Builtin_variables.test_pass, "0";
|
|
|
|
Builtin_variables.test_fail, "1";
|
|
|
|
Builtin_variables.test_skip, "125";
|
|
|
|
] env
|
2017-07-21 07:43:36 -07:00
|
|
|
|
|
|
|
let _ =
|
2017-11-03 10:52:11 -07:00
|
|
|
Environments.register_initializer
|
|
|
|
"test_exit_status_variables" initialize_test_exit_status_variables;
|
2017-07-21 07:43:36 -07:00
|
|
|
List.iter register
|
|
|
|
[
|
2017-10-09 02:36:40 -07:00
|
|
|
pass;
|
|
|
|
skip;
|
|
|
|
fail;
|
2017-11-03 10:52:11 -07:00
|
|
|
dumpenv;
|
2017-10-09 04:51:25 -07:00
|
|
|
unix;
|
|
|
|
windows;
|
2017-11-03 10:52:11 -07:00
|
|
|
setup_build_env;
|
|
|
|
run;
|
2017-07-21 07:43:36 -07:00
|
|
|
script;
|
|
|
|
check_program_output;
|
|
|
|
]
|