Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save init data when compiling + sorted outputs #304

Merged
merged 4 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gillian-C/lib/global_env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ module Serialization = struct
end

let of_yojson json =
let json =
match json with
| `Null -> `List []
| _ -> json
in
Result.map Serialization.of_definition_list
([%of_yojson: Serialization.entry list] json)

Expand Down
2 changes: 1 addition & 1 deletion GillianCore/command_line/command_line.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct

let consoles : (module Console.S) list =
[
(module Compiler_console.Make (PC));
(module Compiler_console.Make (ID) (PC));
(module C_interpreter_console.Make (ID) (PC) (CState) (C_interpreter)
(Gil_parsing));
(module S_interpreter_console.Make (ID) (PC) (SState) (S_interpreter)
Expand Down
11 changes: 8 additions & 3 deletions GillianCore/command_line/compiler_console.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
open Cmdliner
open Command_line_utils

module Make (PC : ParserAndCompiler.S) : Console.S = struct
module Make
(ID : Init_data.S)
(PC : ParserAndCompiler.S with type init_data = ID.t) : Console.S = struct
open Common_args.Make (PC)

let mode =
Expand All @@ -24,8 +27,10 @@ module Make (PC : ParserAndCompiler.S) : Console.S = struct
ParserAndCompiler.get_progs_or_fail ~pp_err:PC.pp_err
(PC.parse_and_compile_files files)
in
List.iter
(fun (path, prog) -> Io_utils.save_file_pp path Prog.pp_labeled prog)
List.iteri
(fun i (path, prog) ->
let init_data = if i = 0 then ID.to_yojson progs.init_data else `Null in
burn_gil ~init_data ~pp_prog:Prog.pp_labeled prog (Some path))
progs.gil_progs

let compile files mode runtime_path ci tl_opts =
Expand Down
14 changes: 10 additions & 4 deletions GillianCore/engine/BiAbduction/Abductor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ module Make
in
let result = run_tests_aux tests [] [] [] 1 in
Fmt.pr "\nTest results:\nProc, GIL Commands, Tests, Succs, Bugs, Time\n";
!stats |> List.rev
!stats
|> List.sort (fun (name1, _) (name2, _) -> String.compare name1 name2)
|> List.iter (fun (name, stats) ->
Fmt.pr "%s, %a\n" name pp_proc_stats stats);
Fmt.pr "@?";
Expand All @@ -335,20 +336,25 @@ module Make
(succ_specs : Spec.t list)
(error_specs : Spec.t list)
(bug_specs : Spec.t list) =
let sort_specs =
List.sort
(fun Spec.{ spec_name = name1; _ } Spec.{ spec_name = name2; _ } ->
String.compare name1 name2)
in
let bug_specs_txt =
Format.asprintf "@[<v 2>BUG SPECS:@\n%a@]@\n"
Fmt.(list ~sep:(any "@\n") (MP.pp_spec ~preds:prog.preds))
bug_specs
(sort_specs bug_specs)
in
let error_specs_txt =
Format.asprintf "@[<v 2>ERROR SPECS:@\n%a@]@\n"
Fmt.(list ~sep:(any "@\n") (MP.pp_spec ~preds:prog.preds))
error_specs
(sort_specs error_specs)
in
let normal_specs_txt =
Format.asprintf "@[<v 2>SUCCESSFUL SPECS:@\n%a@]@\n"
Fmt.(list ~sep:(any "@\n") (MP.pp_spec ~preds:prog.preds))
succ_specs
(sort_specs succ_specs)
in

if !Config.specs_to_stdout then (
Expand Down
Loading