Skip to content
Snippets Groups Projects
Commit 51b7c945 authored by Virgile Prevosto's avatar Virgile Prevosto Committed by David Bühler
Browse files

[tests] more stable oracle for ast-diff test

parent 37e947b8
No related branches found
No related tags found
No related merge requests found
open Cil_types
include Plugin.Register(
struct
let name = "AST diff test"
......@@ -15,13 +17,36 @@ let show_fun kf c =
Kernel_function.pretty kf
Ast_diff.Kernel_function.pretty_data c
let cmp_fun kf1 kf2 =
Datatype.String.compare
(Kernel_function.get_vi kf1).vname (Kernel_function.get_vi kf2).vname
let cmp_var v1 v2 =
let res = Datatype.String.compare v1.vname v2.vname in
if res <> 0 then res
else if v1.vglob && v2.vglob then 0
else if v1.vglob then -1
else if v2.vglob then 1
else if v1.vstorage = Static && v2.vstorage = Static then 0
else if v1.vstorage = Static then -1
else if v2.vstorage = Static then 1
else begin
let prj = Ast_diff.Orig_project.get() in
let kf1 = Project.on prj Kernel_function.find_defining_kf v1 in
let kf2 = Project.on prj Kernel_function.find_defining_kf v2 in
if Option.is_none kf1 || Option.is_none kf2 then
fatal "Variable %a(%a) is not global but has no associated function"
Cil_datatype.Varinfo.pretty v1 Cil_datatype.Location.pretty v1.vdecl;
cmp_fun (Option.get kf1) (Option.get kf2)
end
let show_correspondances () =
if Kernel.AstDiff.get () then begin
result "Showing correspondances between %s and %s"
(Project.get_name (Ast_diff.Orig_project.get()))
(Project.get_name (Project.current()));
Ast_diff.Varinfo.iter show_var;
Ast_diff.Kernel_function.iter show_fun;
Ast_diff.Varinfo.iter_sorted ~cmp:cmp_var show_var;
Ast_diff.Kernel_function.iter_sorted ~cmp:cmp_fun show_fun;
end
let () = Boot.Main.extend show_correspondances
[kernel] Parsing ast_diff_1.i (no preprocessing)
[kernel] Parsing ast_diff_2.c (with preprocessing)
[AST diff test] Showing correspondances between orig_default and default
[AST diff test] Variable i: => i
[AST diff test] Variable local_var_use: => local_var_use
[AST diff test] Variable v: => w
[AST diff test] Variable a: => q
[AST diff test] Variable x: => z
[AST diff test] Variable y: => t
[AST diff test] Variable s: => s
[AST diff test] Variable use_s: => use_s
[AST diff test] Variable x: => x
[AST diff test] Variable with_goto_changed: => with_goto_changed
[AST diff test] Variable S: => S
[AST diff test] Variable X: => X
[AST diff test] Variable Y: N/A
[AST diff test] Variable __retres: => __retres
[AST diff test] Variable a: => q
[AST diff test] Variable c: => c
[AST diff test] Variable f: => f
[AST diff test] Variable with_goto_unchanged: => with_goto_unchanged
[AST diff test] Variable x: => x
[AST diff test] Variable c: => c
[AST diff test] Variable decl: => decl
[AST diff test] Variable f: => f
[AST diff test] Variable g: => g
[AST diff test] Variable se: => se
[AST diff test] Variable S: => S
[AST diff test] Variable with_loop_unroll_same: => with_loop_unroll_same
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable h: => h
[AST diff test] Variable with_loop_unroll_diff: => with_loop_unroll_diff
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable has_static_local: => has_static_local
[AST diff test] Variable has_static_local_x: => has_static_local_y
[AST diff test] Variable i: => i
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable local_var_use: => local_var_use
[AST diff test] Variable ptr_func: => ptr_func
[AST diff test] Variable s: => s
[AST diff test] Variable se: => se
[AST diff test] Variable use_logic_builtin: => use_logic_builtin
[AST diff test] Variable __retres: => __retres
[AST diff test] Variable use_s: => use_s
[AST diff test] Variable used_in_decl: => used_in_decl
[AST diff test] Variable v: => w
[AST diff test] Variable with_goto_changed: => with_goto_changed
[AST diff test] Variable with_goto_unchanged: => with_goto_unchanged
[AST diff test] Variable with_loop_unroll_diff: => with_loop_unroll_diff
[AST diff test] Variable with_loop_unroll_same: => with_loop_unroll_same
[AST diff test] Variable x: => x
[AST diff test] Variable x: => z
[AST diff test] Variable x: => x
[AST diff test] Variable x: => x
[AST diff test] Variable y: => t
[AST diff test] Variable y: => y
[AST diff test] Variable has_static_local: => has_static_local
[AST diff test] Variable decl: => decl
[AST diff test] Variable used_in_decl: => used_in_decl
[AST diff test] Variable ptr_func: => ptr_func
[AST diff test] Function decl: => decl
[AST diff test] Function f: => f
[AST diff test] Function g: N/A
[AST diff test] Function h: -> h (body changed)
[AST diff test] Function has_static_local: => has_static_local
[AST diff test] Function i: => i
[AST diff test] Function local_var_use: => local_var_use
[AST diff test] Function se: => se
[AST diff test] Function use_logic_builtin: => use_logic_builtin
[AST diff test] Function use_s: => use_s
[AST diff test] Function with_goto_changed: -> with_goto_changed (body changed)
[AST diff test] Function f: => f
[AST diff test] Function with_goto_unchanged: => with_goto_unchanged
[AST diff test] Function g: N/A
[AST diff test] Function se: => se
[AST diff test] Function with_loop_unroll_same: => with_loop_unroll_same
[AST diff test] Function h: -> h (body changed)
[AST diff test] Function with_loop_unroll_diff: => with_loop_unroll_diff
[AST diff test] Function use_logic_builtin: => use_logic_builtin
[AST diff test] Function has_static_local: => has_static_local
[AST diff test] Function decl: => decl
[AST diff test] Function with_loop_unroll_same: => with_loop_unroll_same
......@@ -2,48 +2,48 @@
[kernel] Parsing ast_diff_2.c (with preprocessing)
[kernel] Parsing ast_diff_1.i (no preprocessing)
[AST diff test] Showing correspondances between orig_default and default
[AST diff test] Variable v: => w
[AST diff test] Variable a: => q
[AST diff test] Variable x: => z
[AST diff test] Variable y: => t
[AST diff test] Variable s: N/A
[AST diff test] Variable use_s: N/A
[AST diff test] Variable with_goto_changed: => with_goto_changed
[AST diff test] Variable X: => X
[AST diff test] Variable Y: N/A
[AST diff test] Variable a: => q
[AST diff test] Variable c: => c
[AST diff test] Variable f: => f
[AST diff test] Variable with_goto_unchanged: => with_goto_unchanged
[AST diff test] Variable x: => x
[AST diff test] Variable c: => c
[AST diff test] Variable decl: => decl
[AST diff test] Variable f: => f
[AST diff test] Variable g: => g
[AST diff test] Variable se: => se
[AST diff test] Variable with_loop_unroll_same: => with_loop_unroll_same
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable h: => h
[AST diff test] Variable with_loop_unroll_diff: => with_loop_unroll_diff
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable has_static_local: => has_static_local
[AST diff test] Variable has_static_local_x: => has_static_local_y
[AST diff test] Variable i: => i
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable i_0: => i_0
[AST diff test] Variable local_var_use: => local_var_use
[AST diff test] Variable ptr_func: => ptr_func
[AST diff test] Variable s: N/A
[AST diff test] Variable se: => se
[AST diff test] Variable use_logic_builtin: => use_logic_builtin
[AST diff test] Variable use_s: N/A
[AST diff test] Variable used_in_decl: => used_in_decl
[AST diff test] Variable v: => w
[AST diff test] Variable with_goto_changed: => with_goto_changed
[AST diff test] Variable with_goto_unchanged: => with_goto_unchanged
[AST diff test] Variable with_loop_unroll_diff: => with_loop_unroll_diff
[AST diff test] Variable with_loop_unroll_same: => with_loop_unroll_same
[AST diff test] Variable x: => x
[AST diff test] Variable x: => z
[AST diff test] Variable x: => x
[AST diff test] Variable y: => t
[AST diff test] Variable y: => y
[AST diff test] Variable has_static_local: => has_static_local
[AST diff test] Variable decl: => decl
[AST diff test] Variable used_in_decl: => used_in_decl
[AST diff test] Variable ptr_func: => ptr_func
[AST diff test] Variable i: => i
[AST diff test] Variable local_var_use: => local_var_use
[AST diff test] Function use_s: N/A
[AST diff test] Function with_goto_changed: -> with_goto_changed (body changed)
[AST diff test] Function decl: => decl
[AST diff test] Function f: => f
[AST diff test] Function with_goto_unchanged: => with_goto_unchanged
[AST diff test] Function g: N/A
[AST diff test] Function se: -> se (body changed)
[AST diff test] Function with_loop_unroll_same: => with_loop_unroll_same
[AST diff test] Function h: -> h (body changed)
[AST diff test] Function with_loop_unroll_diff: => with_loop_unroll_diff
[AST diff test] Function use_logic_builtin: => use_logic_builtin
[AST diff test] Function has_static_local: => has_static_local
[AST diff test] Function decl: => decl
[AST diff test] Function i: => i
[AST diff test] Function local_var_use: => local_var_use
[AST diff test] Function se: -> se (body changed)
[AST diff test] Function use_logic_builtin: => use_logic_builtin
[AST diff test] Function use_s: N/A
[AST diff test] Function with_goto_changed: -> with_goto_changed (body changed)
[AST diff test] Function with_goto_unchanged: => with_goto_unchanged
[AST diff test] Function with_loop_unroll_diff: => with_loop_unroll_diff
[AST diff test] Function with_loop_unroll_same: => with_loop_unroll_same
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