Commit 661cc7ad authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Propagates all lurette options to the Lutin interpreter.

parent a6fa295e
......@@ -206,6 +206,8 @@ LURETTE_SOURCES_C = \
$(OBJDIR)/Ezdl_c.c \
LURETTE_SOURCES=\
$(OBJDIR)/arg.ml \
$(OBJDIR)/arg.mli \
$(OBJDIR)/util.ml \
$(OBJDIR)/util2.ml \
$(OBJDIR)/error.ml \
......@@ -313,8 +315,6 @@ LUTIN_SOURCES = \
$(OBJDIR)/expand.mli \
$(OBJDIR)/loopWeights.mli \
$(OBJDIR)/loopWeights.ml \
$(OBJDIR)/lutExe.mli \
$(OBJDIR)/lutExe.ml \
$(OBJDIR)/autoExplore.ml \
$(OBJDIR)/autoExplore.mli \
$(OBJDIR)/autoGen.ml \
......@@ -332,7 +332,12 @@ LUTIN_SOURCES = \
$(OBJDIR)/luciole.ml \
$(OBJDIR)/luc2alice.ml \
$(OBJDIR)/luc2c.mli \
$(OBJDIR)/luc2c.ml
$(OBJDIR)/luc2c.ml \
$(OBJDIR)/mainArg.mli \
$(OBJDIR)/mainArg.ml \
$(OBJDIR)/lutExe.mli \
$(OBJDIR)/lutExe.ml
LUTIN_FILES = \
$(OBJDIR)/lutVersion.ml \
......
......@@ -24,21 +24,21 @@ sut:
xxx:
$(LTOP) --precision 2 \
-rp "oracle:socket:127.0.0.1:2000" \
-rp "oracle:ec:toto.ec:ss:ss" \
-rp "env:lutin:env.lut:main" \
-rp "sut:v6:heater_control.lus:heater_control" \
--no-sim2chro --seed 3 \
-rp "sut:socket_init:127.0.0.1:2000" \
--no-sim2chro --seed 3 -l 1000 \
--do-not-show-step -v 3 --output test.rif --direct
xxx2:
$(LTOP) --precision 2 \
-rp "sut:v6:heater_control.lus:heater_control" \
-rp "oracle:v6:heater_control.lus:not_a_sauna" \
-rp "env:lutin:env.lut:main" \
-rp "oracle:v6:heater_control.lus:not_a_sauna" \
-rp "env:lutin:env.lut:main" \
--thick-draw 1 \
--draw-inside 0 --draw-edges 0 --draw-vertices 0 --draw-all-vertices \
--step-mode Inside --local-var --no-sim2chro --seed 3 \
--do-not-show-step -v 3 --output test.rif --direct
--do-not-show-step --output test.rif --direct
......
......@@ -7,12 +7,13 @@ set PS_VIEWER=gv
set DOT=dot
set LUS2EC=lus2ec
set EC2C=ec2c
set SIM2CHRO="//PAVE/jahier/lurette/cygwin\bin\sim2chrogtk"
set SIM2CHRO=sim2chrogtk
set HOST_TYPE=cygwin
set HOSTTYPE=cygwin
set GNUPLOTRIF="//PAVE/jahier/lurette/cygwin\bin\gnuplot-rif.bat"
set GNUPLOTRIF=gnuplot-rif.bat
set GNUPLOT=gnuplot
set SCADE2LUSTRE=SCADE2LUSTRE.EXE
set SCADE_CG=SCADE_CG.EXE
......
......@@ -556,7 +556,6 @@ let char_decl =
(String.concat "" (List.rev (List.fold_left decl_char [] out_vars)))
in
let var_to_adress var ="ctx->_" ^ (Var.name var) in
let all_vars = in_vars @ out_vars in
(if !cpt = 0 then "" else char_decl) ^
(
(* if option.load_mem then *)
......
......@@ -81,7 +81,7 @@ let rec speclist =
"";
"--alice", Arg.String
(fun str -> option.gen_mode <- Alice;option.calling_module_name <- str),
(fun str -> option.gen_mode <- Alices;option.calling_module_name <- str),
"Generate C++ code to be called from Alice";
......
......@@ -36,9 +36,9 @@ USE_CAMLP4 = yes
SOURCES = $(LUTIN_SOURCES) \
$(OBJDIR)/arg.ml \
$(OBJDIR)/arg.mli \
$(OBJDIR)/ltopArg.ml \
$(OBJDIR)/lutinRun.mli \
$(OBJDIR)/lutinRun.ml \
$(OBJDIR)/lustreRun.mli \
$(OBJDIR)/lustreRun.ml \
$(OBJDIR)/ocaml.mli \
......
......@@ -18,8 +18,10 @@ under test) and the environement fields like that:
[your shell prompt] lurettetop
<lurette> add_rp \"sut:v6:heater_control.lus:heater_control\"
<lurette> add_rp \"oracle:v6:heater_control.lus:not_a_sauna\"
<lurette> add_rp \"env:lutin:env.lut:main\"
<lurette> add_rp \"oracle:v6:heater_control.lus:not_a_sauna\"
or
<lurette> add_rp \"oracle:ec:not_a_sauna.ec:\"
And then the testing process can start:
......
......@@ -12,6 +12,37 @@ Type help and/or man at the prompt for more info.
launch 'lurettetop --help' to see the available options.
"
let rp_help ="
To specify a reactive program to be used in the test session, one should
use a string with the following format: \"machine_kind:compiler:file:node\"
where:
- machine_kind can be : 'sut', 'oracle', or 'env'
- compiler can be : 'v4', 'v6', 'lutin'
- file should be an existing file compilable by the compiler
- node should be a node of file
An alternative format is the following: \"machine_kind:socket:sock_addr:port\" where
- machine_kind is as above
- sock_addr is a valid internet adress
- port is a free port on sock_addr
The lurettetop process play the role of the client ; echanges on the socket
should respect the RIF (Reactive Input Format).
Hence, to sum-up, We currently support:
\"<sut|env|oracle>:lutin:prog:node\" For lutin programs
\"<sut|env|oracle>:v6:prog:node\" For lustre V6 programs
\"<sut|env|oracle>:v4:prog:node\" For lustre V6 programs
\"<sut|env|oracle>:ec:prog:\" For lustre expanded code programs
\"<sut|env|oracle>:socket:addr:port\" For reactive programs that read/write on a socket
\"<sut|env|oracle>:socket_init:addr:port\" Ditto
Examples:
\"sut:v6:controler.lus:main\"
\"env:lutin:train:tgv\"
\"oracle:socket:127.0.0.0:2042\"
"
(* compiler used to compiler sut and oracles *)
(* XXX obselete soon! *)
......@@ -40,7 +71,7 @@ let program_kind_of_string = function
| "sut" -> SUT
| "oracle" -> Oracle
| "env" -> Env
| s -> PK_error("Unsupported kind of reactive program:"^s)
| s -> PK_error("*** Error: Unsupported kind of reactive program: \""^s ^"\"")
let program_kind_to_string = function
| SUT -> "sut"
......@@ -309,27 +340,31 @@ let string_to_step_mode = function
flush args.ocr;
Inside
let (parse_rp_string : string -> unit) =
fun str ->
try
(* try *)
let l = (Str.split (Str.regexp ":") str) in
let rp =
match List.tl l with
| ["lutin"; prog; node] -> Lutin(prog, node)
| ["v6"; prog; node] -> LustreV6(prog, node)
| ["ec"; prog] -> LustreEc(prog)
| ["ec"; prog; _] -> LustreEc(prog)
| ["v4"; prog; node] -> LustreV4(prog, node)
| ["socket"; addr; port] -> Socket(addr, int_of_string port)
| ["socket_init"; addr; port] -> SocketInit(addr, int_of_string port)
| _ -> failwith ("Unsupported kind of reactive program:"^str)
| _ -> failwith ("*** Error: Unsupported kind of reactive program: \""
^ str ^ "\"\n" ^ rp_help)
in
match program_kind_of_string (List.hd l) with
| SUT -> if not (List.mem rp args.suts) then args.suts <- rp::args.suts
| Env -> if not (List.mem rp args.envs) then args.envs <- rp::args.envs
| Oracle -> if not (List.mem rp args.oracles) then args.oracles <- rp::args.oracles
| PK_error msg -> failwith msg
with
e -> failwith ("error in --reactive-machine: " ^ Printexc.to_string e)
(* with *)
(* e -> failwith ("error in --reactive-program: " ^ Printexc.to_string e *)
(* ) *)
......@@ -392,26 +427,6 @@ let (get_full_path: string -> string -> string) =
List.fold_left (fun acc s -> acc ^ s ^ " ") "" l1
(***********************************************************************)
let rp_help ="
Add a reactive program to the test session.
The string should have the following format: \"machine_kind:compiler:file:node\" where
- machine_kind can be : 'sut', 'oracle', or 'env'
- compiler can be : 'v4', 'v6', 'lutin'
- file should be an existing file compilable by the compiler
- node should be a node of file
An alternative format is the following: \"machine_kind:socket:sock_addr:port\" where
- machine_kind is as above
- sock_addr is a valid internet adress
- port is a free port on sock_addr
The lurettetop process play the role of the client ; echanges on the socket
should respect the RIF (Reactive Input Format).
Examples:
\"sut:v6:controler.lus:main\"
\"env:lutin:train:tgv\"
\"oracle:socket:127.0.0.0:2042\"
"
let rec speclist =
[
......
......@@ -49,13 +49,24 @@ let (check_compat : vars -> vars -> vars -> vars -> vars -> vars -> int) =
let (f : unit -> int) =
fun () ->
let make_lut prog node =
(* ~libs: XXX *)
LutinRun.make_lut ~verb:args.verbose
(* ~step_mode: args.step_mode *)
~seed: args.seed
~fair_mode:args.compute_volume
~show_locals:args.display_local_var
~precision: args.precision
prog node
in
(* Get sut info (var names, step func, etc.) *)
let add_init init (a,b,c,d) = (a,b,c,d,init,init) in
let sut_in, sut_out, sut_kill, sut_step_sl, sut_init_in, sut_init_out =
match args.suts with
[LustreV6(prog,node)] -> add_init [] (LustreRun.make_v6 prog node)
| [LustreEc(prog)] -> add_init [] (LustreRun.make_ec prog)
| [Lutin(prog,node)] -> add_init [] (LustreRun.make_lut ~verb:args.verbose prog node)
| [Lutin(prog,node)] -> add_init [] (make_lut prog node)
| [Socket(addr, port)] -> add_init [] (LustreRun.make_socket addr port)
| [SocketInit(addr, port)] -> LustreRun.make_socket_init addr port
| _ -> assert false
......@@ -68,14 +79,14 @@ let (f : unit -> int) =
| [LustreV6(prog,node)] -> LustreRun.make_v6 prog node
| [LustreV4(prog,node)] -> assert false (* LustreRun.make_v4 prog node *)
| [Socket(addr, port)] -> LustreRun.make_socket addr port
| [Lutin(prog,node)] -> LustreRun.make_lut prog node
| [Lutin(prog,node)] -> make_lut prog node
| [SocketInit(addr, port)] -> assert false
| [] -> [],[],(fun _ -> ()), (fun _ -> [])
| _ -> assert false
in
let env_in, env_out, env_kill, env_step_sl, env_init_in, env_init_out =
match args.envs with
| [Lutin(prog,node)] -> add_init [] (LustreRun.make_lut ~verb:args.verbose prog node)
| [Lutin(prog,node)] -> add_init [] (make_lut prog node)
| [LustreV6(prog,node)] -> add_init [] (LustreRun.make_v6 prog node)
| [LustreEc(prog)] -> add_init [] (LustreRun.make_ec prog)
| [Socket(addr, port)] -> add_init [] (LustreRun.make_socket addr port)
......@@ -190,9 +201,9 @@ let (f : unit -> int) =
| None, Some _ -> assert false
| Some _, None -> assert false
);
"#quit", res
"#quit\n", res
else
"#quit", res_compat
"#quit\n", res_compat
with e ->
(Printexc.to_string e), 2
in
......
......@@ -40,8 +40,6 @@ ZELANG=lut
SOURCES=$(LUTIN_SOURCES) \
$(OBJDIR)/mainArg.mli \
$(OBJDIR)/mainArg.ml \
$(OBJDIR)/main.ml \
......
......@@ -166,12 +166,28 @@ and id2var (it:t) (id:CoIdent.t) = (
N.B. some fields are redundant, they are stored
to ease te connection with the lucky solver.
*)
let make ?(libs: string list option = None) infile mnode = (
let make
?(libs: string list option = None)
?(verb: int = 0)
?(step_mode : Lucky.step_mode = Lucky.StepInside)
?(seed: int option = None)
?(fair_mode:bool = false)
?(show_locals: bool = false)
?(precision: int = 2)
infile mnode = (
try (
(** open the file, compile and expand the main node ... *)
let inchannel = open_in infile in
let mainprg = Parsers.read_lut inchannel in
let tlenv = CheckType.check_pack libs mainprg in
let _ =
!Solver.init_snt ();
MainArg.set_seed seed;
MainArg.set_compute_volume fair_mode;
MainArg.set_show_locals show_locals;
MainArg.set_step_mode step_mode;
MainArg.set_precision precision
in
let mnode = if mnode <> "" then mnode else (
let all_nodes = Hashtbl.fold
(fun n _ acc -> n::acc)
......
......@@ -42,7 +42,9 @@ N.B. dans un premier temps, c'est un step simple qu'on
type t
val make: ?libs:string list option -> string -> string -> t
val make: ?libs:string list option -> ?verb: int -> ?step_mode: Lucky.step_mode ->
?seed: int option -> ?fair_mode:bool -> ?show_locals: bool -> ?precision: int ->
string -> string -> t
(* Misc info *)
val in_var_list: t -> Exp.var list
......
(**********************************************************************************)
type vars = (string * string) list
let (var_to_string_pair: Exp.var -> string * string) =
fun v -> Var.name v, Type.to_string2 (Var.typ v)
......
(* *)
(* XXX to merge with LustreRun ?
The problem is that I don't need this for check-rif. cf the comment at top
of lustreRun.mli about functors.
*)
type vars = (string * string) list
val make_lut: ?verb:int -> ?libs:string list option -> ?step_mode: Lucky.step_mode ->
?seed: int option -> ?fair_mode:bool -> ?show_locals: bool -> ?precision: int ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment