diff --git a/src/data.ml b/src/data.ml index 308d9681c5480fb11371b7ae0a7e71b2b897090c..cefeb05a54aeeb12f7114cfdae56cacd5a494a0b 100644 --- a/src/data.ml +++ b/src/data.ml @@ -94,41 +94,68 @@ let rec (update_val : v -> v -> access list -> v) = | _,[] -> v | A a, (Sle(f,l,s,w))::access -> ( let j = ref 0 in + let sub_array = Array.make w U in for i = f to l do - if (i - f) mod s = 0 then - let v_j = get_array_elt v !j in - let a_i = update_val a.(i) v_j access in - a.(i) <- a_i; - incr j; + if (i - f) mod s = 0 then ( + sub_array.(!j) <- a.(i); + incr j + ); + done; + let A sub_array = update_val (A sub_array) v access in + j := 0; + for i = f to l do + if (i - f) mod s = 0 then ( + a.(i) <- sub_array.(!j); + incr j + ); done; A a ) - | A a, (Idx i)::access -> + | A a, (Idx i)::access -> let a_i = update_val a.(i) v access in a.(i) <- a_i; A a - | S(fl), (Fld fn)::access -> - S (List.map + | S(fl), (Fld fn)::access -> + S (List.map (fun (fn2,v2) -> if fn=fn2 then fn,update_val v2 v access else (fn2,v2)) fl) - | U,_ -> assert false (* finish me *) + | U,_ -> assert false (* create_val v access *) | _,_ -> assert false (* finish me *) (* exported *) +let rec (create_u_val : t -> v) = + fun vt -> + match vt with + | Array(vt,size) -> + let a = Array.make size U in + for i=0 to size-1 do + a.(i) <- create_u_val vt + done; + A a + | Struct(sn,fl) -> S(List.map (fun (fn,ft) -> fn, create_u_val ft) fl) + | _ -> U + +(* seems slower (??) *) let rec (create_val : t -> v -> access list -> v) = + fun vt v access -> + let u_val = create_u_val vt in + update_val u_val v access + +let rec (create_val_alt : t -> v -> access list -> v) = fun vt v access -> match vt,access with | _,[] -> v | Array(vt,size), (Sle(f,l,s,w))::access -> ( let j = ref 0 in let a = Array.make size U in + let vt = Array(vt,w) in + let A sub_array = create_val vt v access in for i = f to l do - if (i - f) mod s = 0 then - let v_j = get_array_elt v !j in - let a_i = create_val vt v_j access in - a.(i) <- a_i; - incr j; + if (i - f) mod s = 0 then ( + a.(i) <- sub_array.(!j); + incr j + ); done; A a ) @@ -141,3 +168,4 @@ let rec (create_val : t -> v -> access list -> v) = S(List.map (fun (fn2,vt2) -> if fn=fn2 then fn,create_val vt2 v access else fn2,U) fl) | _,_ -> assert false + diff --git a/src/socExecValue.ml b/src/socExecValue.ml index 71095d3353138e6d3e1f9fb2e41e546e46edc2ed..15f32045a529e8705e950a029fa1d123147553ef 100644 --- a/src/socExecValue.ml +++ b/src/socExecValue.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 21/05/2013 (at 08:13) by Erwan Jahier> *) +(* Time-stamp: <modified the 29/05/2013 (at 10:11) by Erwan Jahier> *) let dbg = (Verbose.get_flag "exec") @@ -47,13 +47,16 @@ let rec (get_top_var_type : Soc.var_expr -> Data.t) = open Data let rec (get_access : Soc.var_expr -> Data.access list) = fun ve -> - match ve with - | Const(id,_) -> assert false - | Var(id,_) -> [] - | Index(ve,i,_) -> (Idx i)::(get_access ve) - | Field(ve, n,_) -> (Fld n)::(get_access ve) - | Slice(ve,f,l,s,w,_) -> (Sle (f,l,s,w))::(get_access ve) - + let rec aux ve = + match ve with + | Const(id,_) -> assert false + | Var(id,_) -> [] + | Index(ve,i,_) -> (Idx i)::(aux ve) + | Field(ve, n,_) -> (Fld n)::(aux ve) + | Slice(ve,f,l,s,w,_) -> (Sle (f,l,s,w))::(aux ve) + in + List.rev (aux ve) + let (update_leaf : var_expr -> v -> v -> substs) = fun ve v pre_v -> let access = get_access ve in diff --git a/test/Makefile b/test/Makefile index d3a16d3ffa92eadcae29b0000bbe0324e9f0550a..45cc0329de4a3efb325a58a6c7f68386d06544c4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -13,7 +13,7 @@ remote-runtest: cd $(testdir) runtest: - runtest --all --tool lus2lic || true + ~/bin/runtest --all --tool lus2lic || true .PHONY:lus2lic.diff lus2lic.time diff --git a/test/lus2lic.sum b/test/lus2lic.sum index 7848d3eda37ba4aad8c4def51c1f88ed438bc3a1..c3de67a4b97202b0188762741c989c5646d4d8fc 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -Test Run By jahier on Tue May 28 15:04:10 2013 +Test Run By jahier on Fri May 31 10:29:55 2013 Native configuration is i686-pc-linux-gnu === lus2lic tests === @@ -391,7 +391,7 @@ FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node shou PASS: ./lus2lic {-o /tmp/morel4.lic should_work/morel4.lus} PASS: ./lus2lic {-ec -o /tmp/morel4.ec should_work/morel4.lus} PASS: ./ec2c {-o /tmp/morel4.c /tmp/morel4.ec} -FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/morel4.lus +PASS: ../utils/test_lus2lic_no_node should_work/morel4.lus PASS: ./lus2lic {-o /tmp/param_node4.lic should_work/param_node4.lus} PASS: ./lus2lic {-ec -o /tmp/param_node4.ec should_work/param_node4.lus} PASS: ./ec2c {-o /tmp/param_node4.c /tmp/param_node4.ec} @@ -539,7 +539,7 @@ FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node shou PASS: ./lus2lic {-o /tmp/left.lic should_work/left.lus} PASS: ./lus2lic {-ec -o /tmp/left.ec should_work/left.lus} PASS: ./ec2c {-o /tmp/left.c /tmp/left.ec} -FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/left.lus +PASS: ../utils/test_lus2lic_no_node should_work/left.lus PASS: ./lus2lic {-o /tmp/ts04.lic should_work/ts04.lus} PASS: ./lus2lic {-ec -o /tmp/ts04.ec should_work/ts04.lus} PASS: ./ec2c {-o /tmp/ts04.c /tmp/ts04.ec} @@ -1039,8 +1039,10 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman === lus2lic Summary === -# of expected passes 883 -# of unexpected failures 83 +# of expected passes 885 +# of unexpected failures 81 # of unexpected successes 12 # of expected failures 37 # of unresolved testcases 12 +testcase ./lus2lic.tests/non-reg.exp completed in 213 seconds +testcase ./lus2lic.tests/progression.exp completed in 0 seconds diff --git a/test/lus2lic.time b/test/lus2lic.time index 2b6328931b55efee8143aaa7c6b66895ddf85924..220fb6a35040929764221165a83331a85db4c648 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,2 +1,2 @@ -testcase ./lus2lic.tests/non-reg.exp completed in 228 seconds +testcase ./lus2lic.tests/non-reg.exp completed in 213 seconds testcase ./lus2lic.tests/progression.exp completed in 0 seconds diff --git a/test/should_work/left.lus b/test/should_work/left.lus index a498f2e7806fb78b0a435bfaa7e43d94357ec2bb..5bb79b989fd1b815daecd4ef8ef7ddd0cd8a6ab5 100644 --- a/test/should_work/left.lus +++ b/test/should_work/left.lus @@ -7,12 +7,15 @@ type truc = struct { node left(x : bool) returns (t : truc^3); let - t[0].a[0..98 step 2][48..0 step -2] = true^25; --- t[0].a[0..98 step 2][0..48 step 2] = true^25; + t[0].a[0..98 step 2][0..48 step 2] = true^25; +-- t[0].a[0..98 step 2][48..0 step -2] = true^25; t[0].a[0..98 step 2][1..49 step 2] = false^25; t[0].a[1..99 step 2][0] = true; t[0].a[1..99 step 2][1] = true; t[0].a[5..99 step 2] = false^48; - t[0].b = 42; + t[0].b = 42; t[1..2] = (truc { a = true^100; b = 0 })^2; + + +-- t[0].a[0..98 step 2][0..48 step 2] = true^25; tel diff --git a/test/site.exp b/test/site.exp index ad96852976064ae6738d9ff55b33ae8f5f8d581c..d9ad0f0a20ed3cb2b225956c23e5689ecbe88c14 100644 --- a/test/site.exp +++ b/test/site.exp @@ -16,6 +16,8 @@ proc should_work { test_name command_line args } { } # Running the program. eval spawn $command_line {*}$args + set pid [exp_pid] + puts "PID: $pid ($command_line $args)" expect { # Check for any warning messages in the output first Warning { diff --git a/utils/test_lus2lic_no_node b/utils/test_lus2lic_no_node index b0ecfbf8c37425fb55c0b4784f1d1145bdc6a43c..b946f7750b146defbad980d15035b643e694b221 100755 --- a/utils/test_lus2lic_no_node +++ b/utils/test_lus2lic_no_node @@ -50,6 +50,8 @@ export PATH=/usr/local/tools/lustre/bin/:$PATH # fi if # -rp "sut:v4:$lv4:$lv4_node" \ + + ./lurettetop -p 6 -seed 42 \ -rp "sut:ec:$ec:$lv4_node" \ -rp "env:lutin:$env" \