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

Fix a couple of bugs in the -exec mode in the handling of slices.

  #fail: 83 -> 81
parent 06ddb863
No related branches found
No related tags found
No related merge requests found
...@@ -94,41 +94,68 @@ let rec (update_val : v -> v -> access list -> v) = ...@@ -94,41 +94,68 @@ let rec (update_val : v -> v -> access list -> v) =
| _,[] -> v | _,[] -> v
| A a, (Sle(f,l,s,w))::access -> ( | A a, (Sle(f,l,s,w))::access -> (
let j = ref 0 in let j = ref 0 in
let sub_array = Array.make w U in
for i = f to l do for i = f to l do
if (i - f) mod s = 0 then if (i - f) mod s = 0 then (
let v_j = get_array_elt v !j in sub_array.(!j) <- a.(i);
let a_i = update_val a.(i) v_j access in incr j
a.(i) <- 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; done;
A a A a
) )
| A a, (Idx i)::access -> | A a, (Idx i)::access ->
let a_i = update_val a.(i) v access in let a_i = update_val a.(i) v access in
a.(i) <- a_i; a.(i) <- a_i;
A a A a
| S(fl), (Fld fn)::access -> | S(fl), (Fld fn)::access ->
S (List.map S (List.map
(fun (fn2,v2) -> if fn=fn2 then fn,update_val v2 v access else (fn2,v2)) (fun (fn2,v2) -> if fn=fn2 then fn,update_val v2 v access else (fn2,v2))
fl) fl)
| U,_ -> assert false (* finish me *) | U,_ -> assert false (* create_val v access *)
| _,_ -> assert false (* finish me *) | _,_ -> assert false (* finish me *)
(* exported *) (* 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) = 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 -> fun vt v access ->
match vt,access with match vt,access with
| _,[] -> v | _,[] -> v
| Array(vt,size), (Sle(f,l,s,w))::access -> ( | Array(vt,size), (Sle(f,l,s,w))::access -> (
let j = ref 0 in let j = ref 0 in
let a = Array.make size U 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 for i = f to l do
if (i - f) mod s = 0 then if (i - f) mod s = 0 then (
let v_j = get_array_elt v !j in a.(i) <- sub_array.(!j);
let a_i = create_val vt v_j access in incr j
a.(i) <- a_i; );
incr j;
done; done;
A a A a
) )
...@@ -141,3 +168,4 @@ let rec (create_val : t -> v -> access list -> v) = ...@@ -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) S(List.map (fun (fn2,vt2) -> if fn=fn2 then fn,create_val vt2 v access else fn2,U) fl)
| _,_ -> assert false | _,_ -> assert false
(* 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") let dbg = (Verbose.get_flag "exec")
...@@ -47,13 +47,16 @@ let rec (get_top_var_type : Soc.var_expr -> Data.t) = ...@@ -47,13 +47,16 @@ let rec (get_top_var_type : Soc.var_expr -> Data.t) =
open Data open Data
let rec (get_access : Soc.var_expr -> Data.access list) = let rec (get_access : Soc.var_expr -> Data.access list) =
fun ve -> fun ve ->
match ve with let rec aux ve =
| Const(id,_) -> assert false match ve with
| Var(id,_) -> [] | Const(id,_) -> assert false
| Index(ve,i,_) -> (Idx i)::(get_access ve) | Var(id,_) -> []
| Field(ve, n,_) -> (Fld n)::(get_access ve) | Index(ve,i,_) -> (Idx i)::(aux ve)
| Slice(ve,f,l,s,w,_) -> (Sle (f,l,s,w))::(get_access 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) = let (update_leaf : var_expr -> v -> v -> substs) =
fun ve v pre_v -> fun ve v pre_v ->
let access = get_access ve in let access = get_access ve in
......
...@@ -13,7 +13,7 @@ remote-runtest: ...@@ -13,7 +13,7 @@ remote-runtest:
cd $(testdir) cd $(testdir)
runtest: runtest:
runtest --all --tool lus2lic || true ~/bin/runtest --all --tool lus2lic || true
.PHONY:lus2lic.diff lus2lic.time .PHONY:lus2lic.diff lus2lic.time
......
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 Native configuration is i686-pc-linux-gnu
=== lus2lic tests === === lus2lic tests ===
...@@ -391,7 +391,7 @@ FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node shou ...@@ -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 {-o /tmp/morel4.lic should_work/morel4.lus}
PASS: ./lus2lic {-ec -o /tmp/morel4.ec should_work/morel4.lus} PASS: ./lus2lic {-ec -o /tmp/morel4.ec should_work/morel4.lus}
PASS: ./ec2c {-o /tmp/morel4.c /tmp/morel4.ec} 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 {-o /tmp/param_node4.lic should_work/param_node4.lus}
PASS: ./lus2lic {-ec -o /tmp/param_node4.ec 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} 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 ...@@ -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 {-o /tmp/left.lic should_work/left.lus}
PASS: ./lus2lic {-ec -o /tmp/left.ec should_work/left.lus} PASS: ./lus2lic {-ec -o /tmp/left.ec should_work/left.lus}
PASS: ./ec2c {-o /tmp/left.c /tmp/left.ec} 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 {-o /tmp/ts04.lic should_work/ts04.lus}
PASS: ./lus2lic {-ec -o /tmp/ts04.ec should_work/ts04.lus} PASS: ./lus2lic {-ec -o /tmp/ts04.ec should_work/ts04.lus}
PASS: ./ec2c {-o /tmp/ts04.c /tmp/ts04.ec} 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 ...@@ -1039,8 +1039,10 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman
=== lus2lic Summary === === lus2lic Summary ===
# of expected passes 883 # of expected passes 885
# of unexpected failures 83 # of unexpected failures 81
# of unexpected successes 12 # of unexpected successes 12
# of expected failures 37 # of expected failures 37
# of unresolved testcases 12 # of unresolved testcases 12
testcase ./lus2lic.tests/non-reg.exp completed in 213 seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds
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 testcase ./lus2lic.tests/progression.exp completed in 0 seconds
...@@ -7,12 +7,15 @@ type truc = struct { ...@@ -7,12 +7,15 @@ type truc = struct {
node left(x : bool) returns (t : truc^3); node left(x : bool) returns (t : truc^3);
let 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[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][0] = true;
t[0].a[1..99 step 2][1] = true; t[0].a[1..99 step 2][1] = true;
t[0].a[5..99 step 2] = false^48; 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[1..2] = (truc { a = true^100; b = 0 })^2;
-- t[0].a[0..98 step 2][0..48 step 2] = true^25;
tel tel
...@@ -16,6 +16,8 @@ proc should_work { test_name command_line args } { ...@@ -16,6 +16,8 @@ proc should_work { test_name command_line args } {
} }
# Running the program. # Running the program.
eval spawn $command_line {*}$args eval spawn $command_line {*}$args
set pid [exp_pid]
puts "PID: $pid ($command_line $args)"
expect { expect {
# Check for any warning messages in the output first # Check for any warning messages in the output first
Warning { Warning {
......
...@@ -50,6 +50,8 @@ export PATH=/usr/local/tools/lustre/bin/:$PATH ...@@ -50,6 +50,8 @@ export PATH=/usr/local/tools/lustre/bin/:$PATH
# fi # fi
if if
# -rp "sut:v4:$lv4:$lv4_node" \ # -rp "sut:v4:$lv4:$lv4_node" \
./lurettetop -p 6 -seed 42 \ ./lurettetop -p 6 -seed 42 \
-rp "sut:ec:$ec:$lv4_node" \ -rp "sut:ec:$ec:$lv4_node" \
-rp "env:lutin:$env" \ -rp "env:lutin:$env" \
......
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