Skip to content
Snippets Groups Projects
Commit 94445159 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Make sure lus2lic exits politely.

Indeed, otherwise, in some cases, rdbg or lurette migth not realise
that lus2lic exited in error.
parent cded720f
No related branches found
No related tags found
No related merge requests found
......@@ -46,5 +46,5 @@ Library "lustre-v6"
Install:true
XMETAEnable: true
XMETADescription: an API to call the Lustre v6 interpreter from ocaml
InternalModules: SocExecValue,SocUtils,Lv6util,Lv6version,Lv6errors,Lxm,Lv6MainArgs,Verbose,Soc,SocPredef,Lv6Id,SocExec,SocExecEvalPredef,Compile,AstTab,AstTabSymbol,AstInstanciateModel,Lv6parserUtils,AstV6,FilenameExtras,LicTab,LicDump,AstPredef,Lic,AstCore,FreshName,IdSolver,EvalConst,LicEvalConst,LicEvalType,UnifyType,Ast2lic,AstV6Dump,EvalClock,UnifyClock,LicEvalClock,EvalType,LicPrg,LicMetaOp,L2lCheckOutputs,Misc,L2lRmPoly,L2lExpandMetaOp,L2lSplit,L2lExpandNodes,L2lExpandArrays,L2lCheckLoops,L2lCheckMemSafe,L2lOptimIte,Lv6lexer,Lv6parser,AstRecognizePredef,Lic2soc,Action,ActionsDeps,SocVar,Lus2licRun,SortActions,SortActionsExpe
InternalModules: SocExecValue,SocUtils,Lv6util,Lv6version,Lv6errors,Lxm,Lv6MainArgs,Verbose,Soc,SocPredef,Lv6Id,SocExec,SocExecEvalPredef,Compile,AstTab,AstTabSymbol,AstInstanciateModel,Lv6parserUtils,AstV6,FilenameExtras,LicTab,LicDump,AstPredef,Lic,AstCore,FreshName,IdSolver,EvalConst,LicEvalConst,LicEvalType,UnifyType,Ast2lic,AstV6Dump,EvalClock,UnifyClock,LicEvalClock,EvalType,LicPrg,LicMetaOp,L2lCheckOutputs,Misc,L2lRmPoly,L2lExpandMetaOp,L2lSplit,L2lExpandNodes,L2lExpandArrays,L2lCheckLoops,L2lCheckMemSafe,L2lOptimIte,Lv6lexer,Lv6parser,AstRecognizePredef,Lic2soc,Action,ActionsDeps,SocVar,Lus2licRun,SortActions,SortActionsExpe,L2lCheckKcgKeyWord
# Comment se passer de cette liste à la Prevert ?
(* Time-stamp: <modified the 17/08/2015 (at 16:58) by Erwan Jahier> *)
(** Check that the inoput program does not use KCG keywords an ident *)
val doit : LicPrg.t -> unit
# OASIS_START
# DO NOT EDIT (digest: 702371850d29477bd775b51a95b16417)
# DO NOT EDIT (digest: dd8953705e3a6e5786f72d3409c5318b)
Lus2licRun
SocExecValue
SocUtils
......@@ -60,4 +60,5 @@ SocVar
Lus2licRun
SortActions
SortActionsExpe
L2lCheckKcgKeyWord
# OASIS_STOP
# OASIS_START
# DO NOT EDIT (digest: 702371850d29477bd775b51a95b16417)
# DO NOT EDIT (digest: dd8953705e3a6e5786f72d3409c5318b)
Lus2licRun
SocExecValue
SocUtils
......@@ -60,4 +60,5 @@ SocVar
Lus2licRun
SortActions
SortActionsExpe
L2lCheckKcgKeyWord
# OASIS_STOP
(* Time-stamp: <modified the 10/07/2015 (at 14:26) by Erwan Jahier> *)
(* Time-stamp: <modified the 17/08/2015 (at 16:13) by Erwan Jahier> *)
(*
Le manager d'argument adapt de celui de lutin, plus joli
N.B. solution un peu batarde : les options sont stockes, comme avant, dans Global,
......@@ -111,7 +111,7 @@ let (make_opt : unit -> t) =
exec = false;
gen_c = false;
gen_wcet = false;
rif = false;
rif = false;
gen_ocaml = false;
precision = None;
launch_cc = false;
......
(* Time-stamp: <modified the 08/07/2015 (at 17:55) by Erwan Jahier> *)
(* Time-stamp: <modified the 17/08/2015 (at 16:14) by Erwan Jahier> *)
open Verbose
open AstV6
......@@ -10,7 +10,11 @@ open Format
open Lv6MainArgs
let my_exit opt i =
if opt.rif || opt.print_interface then (output_string opt.oc "\nq\n"; flush opt.oc);
if opt.rif || opt.print_interface then
output_string opt.oc "\nq\n"
else
output_string opt.oc "\nbye\n";
flush opt.oc;
close_out opt.oc;
if Sys.file_exists opt.outfile then Sys.remove opt.outfile;
exit i
......@@ -27,7 +31,8 @@ let find_a_node opt =
let name =
try Filename.chop_extension (Filename.basename first_file)
with _ ->
print_string ("*** Error: '"^first_file^"' is a bad file name.\n"); exit 1
print_string ("*** Error: '"^first_file^"' is a bad file name.\n");
my_exit opt 1
in
name
......@@ -47,9 +52,9 @@ let (gen_rif_interface : LicPrg.t -> Lv6Id.idref option -> Lv6MainArgs.t -> unit
let msk, zesoc = Lic2soc.f lic_prg nk in
msk, zesoc, main_node
) else (
print_string ("Error: no node is specified.\n");
print_string ("Error: no node is specified.\nbye\n");
flush stdout;
exit 1
my_exit opt 2
)
)
| Some main_node ->
......@@ -87,9 +92,9 @@ let (gen_autotest_files : LicPrg.t -> Lv6Id.idref option -> Lv6MainArgs.t -> uni
let msk, zesoc = Lic2soc.f lic_prg nk in
msk, zesoc, main_node
) else (
print_string ("Error: no node is specified, cannot exec.\n");
print_string ("Error: no node is specified, cannot exec.\nbye\n");
flush stdout;
exit 1
my_exit opt 1
)
)
| Some main_node ->
......@@ -242,8 +247,8 @@ let main () = (
Verbose.exe ~level:3 (fun () ->
Gc.set { (Gc.get ()) with Gc.verbose = 0x01 }
);
if opt.run_unit_test then (UnifyType.unit_test (); exit 0);
if (opt.infiles = []) then (Lv6MainArgs.usage stderr opt; exit 1);
if opt.run_unit_test then (UnifyType.unit_test (); my_exit opt 0);
if (opt.infiles = []) then (Lv6MainArgs.usage stderr opt; my_exit opt 1);
let new_dft_pack = Filename.basename (Filename.chop_extension (List.hd opt.infiles)) in
Lv6Id.set_dft_pack_name new_dft_pack;
......@@ -257,7 +262,7 @@ let main () = (
if opt.print_interface then (
gen_rif_interface lic_prg main_node opt;
info "bye!";
exit 0
my_exit opt 0
);
if opt.Lv6MainArgs.gen_autotest then
gen_autotest_files lic_prg main_node opt
......@@ -281,9 +286,9 @@ let main () = (
info "Start interpreting soc...\n";
SocExec.f opt zesoc msk)
) else (
print_string ("Error: no node is specified, cannot exec.\n");
print_string ("Error: no node is specified, cannot exec.\nbye\n");
flush stdout;
exit 1
my_exit opt 1
)
)
| Some main_node ->
......
This diff is collapsed.
==> lus2lic0.sum <==
Test Run By jahier on Fri Jul 10 14:27:04
Test Run By jahier on Mon Aug 17 17:03:06
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic0 tests ===
......@@ -64,7 +64,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
==> lus2lic1.sum <==
Test Run By jahier on Fri Jul 10 14:27:08
Test Run By jahier on Mon Aug 17 17:03:07
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic1 tests ===
......@@ -396,7 +396,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {}
==> lus2lic2.sum <==
Test Run By jahier on Fri Jul 10 14:27:00
Test Run By jahier on Mon Aug 17 17:03:22
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic2 tests ===
......@@ -735,7 +735,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {}
==> lus2lic3.sum <==
Test Run By jahier on Fri Jul 10 14:27:06
Test Run By jahier on Mon Aug 17 17:04:10
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic3 tests ===
......@@ -1237,7 +1237,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec}
PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
==> lus2lic4.sum <==
Test Run By jahier on Fri Jul 10 14:27:02
Test Run By jahier on Mon Aug 17 17:04:24
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic4 tests ===
......@@ -1751,13 +1751,13 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
===============================
# Total number of failures: 23
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 22 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 50 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 17 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 52 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 15 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 48 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 14 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 50 seconds
* Ref time:
0.04user 0.02system 2:03.11elapsed 0%CPU (0avgtext+0avgdata 5020maxresident)k
0inputs+0outputs (0major+5526minor)pagefaults 0swaps
0.05user 0.02system 2:07.25elapsed 0%CPU (0avgtext+0avgdata 5068maxresident)k
0inputs+0outputs (0major+5541minor)pagefaults 0swaps
* Quick time (-j 4):
0.04user 0.01system 0:53.57elapsed 0%CPU (0avgtext+0avgdata 5028maxresident)k
0inputs+0outputs (0major+5576minor)pagefaults 0swaps
0.04user 0.01system 0:58.09elapsed 0%CPU (0avgtext+0avgdata 5092maxresident)k
64inputs+0outputs (0major+5543minor)pagefaults 0swaps
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment