Skip to content

Commit

Permalink
Remove My_zip module (#1264)
Browse files Browse the repository at this point in the history
* Use similar test for zip feature in native and SMT format

We should use the same test as we only want to check that Alt-Ergo can
unzip correctly the input file if its name has the form:
name.format.zip.

* Remove My_zip

The module `My_Zip` contains only function which is called once in
`Solving_loop`. This commit cleans the code and move it in
`Solving_loop` directly. Technically, `Solving_loop` is a part of the
binary, but as everyone knows, most of the code of this module will be
push into the library after we design a good API.

* Force deflate compression in zip tests

Add a padding comment in both tests to ensure that zip won't choose
the store method while compressing them.
  • Loading branch information
Halbaroth authored Oct 31, 2024
1 parent 35c0f14 commit 9f5dbd7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 129 deletions.
11 changes: 10 additions & 1 deletion src/bin/common/solving_loop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,15 @@ let process_source ?selector_inst ~print_status src =
end
| `Stdin -> ()
in
let extract_zip_file f =
let cin = Zip.open_in f in
Fun.protect ~finally:(fun () -> Zip.close_in cin) @@ fun () ->
match Zip.entries cin with
| [e] when not @@ e.Zip.is_directory ->
Zip.read_entry cin e
| _ ->
fatal_error "the zip archive '%s' should contain exactly one file" f
in
(* Prepare the input source for Dolmen from an input source for Alt-Ergo. *)
let mk_files src =
let lang =
Expand All @@ -316,7 +325,7 @@ let process_source ?selector_inst ~print_status src =
let src =
match src with
| `File path when Filename.check_suffix path ".zip" ->
let content = AltErgoLib.My_zip.extract_zip_file path in
let content = extract_zip_file path in
`Raw (Filename.(chop_extension path |> basename), content)
| `File _ | `Raw _ | `Stdin -> src
in
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
; util
Emap Gc_debug Hconsing Hstring Heap Loc Numbers Uqueue
Options Timers Util Vec Version Steps Printer
My_zip My_list Theories Nest Compat
My_list Theories Nest Compat
)

(js_of_ocaml
Expand Down
78 changes: 0 additions & 78 deletions src/lib/util/my_zip.ml

This file was deleted.

48 changes: 0 additions & 48 deletions src/lib/util/my_zip.mli

This file was deleted.

2 changes: 1 addition & 1 deletion tests/misc/unzip.ae.expected
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

unknown
unsat
Binary file modified tests/misc/unzip.ae.zip
Binary file not shown.
Binary file modified tests/misc/unzip.smt2.zip
Binary file not shown.

0 comments on commit 9f5dbd7

Please sign in to comment.