summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2017-10-09 11:36:40 +0200
committerSébastien Hinderer <Sebastien.Hinderer@inria.fr>2017-10-09 17:09:53 +0200
commit6bf807936af654ecb00ec4acdba61e297e27ec59 (patch)
treefd60cd17109e5e7ff2e2c511c2821f761ae84a24
parent8eef73ea8d0a4994cb1c7210b83ba58e00d80144 (diff)
downloadocaml-6bf807936af654ecb00ec4acdba61e297e27ec59.tar.gz
ocamltest: add builtin actions to always pass, skip or fail.
These actions are useful e.g. to debug the tool itself.
-rw-r--r--ocamltest/builtin_actions.ml23
-rw-r--r--ocamltest/builtin_actions.mli4
2 files changed, 27 insertions, 0 deletions
diff --git a/ocamltest/builtin_actions.ml b/ocamltest/builtin_actions.ml
index a392e58f39..752e06f340 100644
--- a/ocamltest/builtin_actions.ml
+++ b/ocamltest/builtin_actions.ml
@@ -21,6 +21,26 @@ open Actions
let env_id env = env
+let pass = {
+ action_name = "pass";
+ action_environment = env_id;
+ action_body = fun log env ->
+ Printf.fprintf log "The pass action always succeeds.\n%!";
+ Pass env
+}
+
+let skip = {
+ action_name = "skip";
+ action_environment = env_id;
+ action_body = fun _log _env -> Skip "The skip action always skips."
+}
+
+let fail = {
+ action_name = "fail";
+ action_environment = env_id;
+ action_body = fun _log _env -> Fail "The fail action always fails."
+}
+
let run_command
?(stdin_variable=Builtin_variables.stdin)
?(stdout_variable=Builtin_variables.stdout)
@@ -846,6 +866,9 @@ let if_not_safe_string = {
let _ =
List.iter register
[
+ pass;
+ skip;
+ fail;
compile_bytecode_with_bytecode_compiler;
compile_bytecode_with_native_compiler;
compile_native_with_bytecode_compiler;
diff --git a/ocamltest/builtin_actions.mli b/ocamltest/builtin_actions.mli
index a61a5f069b..ff12d2cfb7 100644
--- a/ocamltest/builtin_actions.mli
+++ b/ocamltest/builtin_actions.mli
@@ -15,6 +15,10 @@
(* Definition of a few built-in actions *)
+val pass : Actions.t
+val skip : Actions.t
+val fail : Actions.t
+
val compile_bytecode_with_bytecode_compiler : Actions.t
val compile_bytecode_with_native_compiler : Actions.t
val compile_native_with_bytecode_compiler : Actions.t