diff --git a/README.md b/README.md index 62d72d7dee..a8d57d9ed3 100644 --- a/README.md +++ b/README.md @@ -191,8 +191,10 @@ let author = "Example " let info fmt = Irmin_git_unix.info ~author fmt let main () = + (* Create the switch *) + Eio.Switch.run @@ fun sw -> (* Open the repo *) - let repo = Store.Repo.v config in + let repo = Store.Repo.v ~sw config in (* Load the main branch *) let t = Store.main repo in diff --git a/irmin-server.opam b/irmin-server.opam index fcf342ddde..1379cd3f96 100644 --- a/irmin-server.opam +++ b/irmin-server.opam @@ -21,6 +21,7 @@ depends: [ "websocket-lwt-unix" "cohttp-lwt-unix" "ppx_blob" + "alcotest-lwt" {with-test} ] build: [ diff --git a/src/irmin-containers/linked_log.ml b/src/irmin-containers/linked_log.ml index dcd0d16cc8..cda30decc5 100644 --- a/src/irmin-containers/linked_log.ml +++ b/src/irmin-containers/linked_log.ml @@ -43,7 +43,7 @@ struct let store = ref None - (* TODO: Fix this hellhole *) + (* TODO: Fix me *) let get_store () = match !store with | None -> diff --git a/src/irmin-pack/unix/async.ml b/src/irmin-pack/unix/async.ml index 8ac5c5d5b8..c1b2aa28f0 100644 --- a/src/irmin-pack/unix/async.ml +++ b/src/irmin-pack/unix/async.ml @@ -45,7 +45,7 @@ module Unix = struct Eio.Domain_manager.run (domain_mgr ()) (run f)) in let gc_sw = Eio.Promise.await gc_sw_promise in - gc_sw, promise + (gc_sw, promise) let await (_, p) : [> outcome ] = match Eio.Promise.await p with diff --git a/test/irmin-containers/blob_log.ml b/test/irmin-containers/blob_log.ml index c04d525f3c..c57d39fb35 100644 --- a/test/irmin-containers/blob_log.ml +++ b/test/irmin-containers/blob_log.ml @@ -20,19 +20,24 @@ open Common module B = Irmin_containers.Blob_log.Mem (Irmin.Contents.String) let path = [ "tmp"; "blob" ] -let config ~sw = B.Store.Repo.v ~sw (Irmin_mem.config ()) + +let config ~sw root = + let key = Irmin.Backend.Conf.root Irmin_mem.Conf.spec in + let conf = Irmin.Backend.Conf.singleton Irmin_mem.Conf.spec key root in + B.Store.Repo.v ~sw conf + let merge_into_exn = merge_into_exn (module B.Store) let test_empty_read () = Eio.Switch.run @@ fun sw -> - let config = config ~sw in + let config = config ~sw __FUNCTION__ in let main = B.Store.main config in B.read_all ~path main |> Alcotest.(check (list string)) "checked - reading empty log" [] let test_append () = Eio.Switch.run @@ fun sw -> - let t = config ~sw |> B.Store.main in + let t = config ~sw __FUNCTION__ |> B.Store.main in B.append ~path t "main.1"; B.append ~path t "main.2"; B.read_all ~path t @@ -41,7 +46,7 @@ let test_append () = let test_clone_merge () = Eio.Switch.run @@ fun sw -> - let t = config ~sw |> B.Store.main in + let t = config ~sw __FUNCTION__ |> B.Store.main in B.append ~path t "main.1"; B.append ~path t "main.2"; let b = B.Store.clone ~src:t ~dst:"cl" in @@ -55,7 +60,7 @@ let test_clone_merge () = let test_branch_merge () = Eio.Switch.run @@ fun sw -> - let r = config ~sw in + let r = config __FUNCTION__ ~sw in let b1 = B.Store.of_branch r "b1" in let b2 = B.Store.of_branch r "b2" in let b3 = B.Store.of_branch r "b3" in diff --git a/test/irmin-containers/counter.ml b/test/irmin-containers/counter.ml index 4cb22002f7..9d3cbcfb01 100644 --- a/test/irmin-containers/counter.ml +++ b/test/irmin-containers/counter.ml @@ -20,12 +20,17 @@ open Common module C = Irmin_containers.Counter.Mem let path = [ "tmp"; "counter" ] -let config ~sw () = C.Store.Repo.v ~sw (Irmin_mem.config ()) + +let config ~sw root = + let key = Irmin.Backend.Conf.root Irmin_mem.Conf.spec in + let conf = Irmin.Backend.Conf.singleton Irmin_mem.Conf.spec key root in + C.Store.Repo.v ~sw conf + let merge_into_exn = merge_into_exn (module C.Store) let test_inc () = Eio.Switch.run @@ fun sw -> - let t = config ~sw () |> C.Store.main in + let t = config ~sw __FUNCTION__ |> C.Store.main in C.inc ~path t; let () = C.read ~path t @@ -36,7 +41,7 @@ let test_inc () = let test_dec () = Eio.Switch.run @@ fun sw -> - let t = config ~sw () |> C.Store.main in + let t = config ~sw __FUNCTION__ |> C.Store.main in C.dec ~path t; let () = C.read ~path t @@ -47,7 +52,7 @@ let test_dec () = let test_clone_merge () = Eio.Switch.run @@ fun sw -> - let t = config ~sw () |> C.Store.main in + let t = config ~sw __FUNCTION__ |> C.Store.main in C.inc ~by:5L ~path t; let b = C.Store.clone ~src:t ~dst:"cl" in C.inc ~by:2L ~path b; @@ -64,7 +69,7 @@ let test_clone_merge () = let test_branch_merge () = Eio.Switch.run @@ fun sw -> - let r = config ~sw () in + let r = config ~sw __FUNCTION__ in let b1 = C.Store.of_branch r "b1" in let b2 = C.Store.of_branch r "b2" in let b3 = C.Store.of_branch r "b3" in diff --git a/test/irmin-containers/linked_log.ml b/test/irmin-containers/linked_log.ml index 2eaca01c5e..b3fd352f98 100644 --- a/test/irmin-containers/linked_log.ml +++ b/test/irmin-containers/linked_log.ml @@ -28,18 +28,22 @@ module L = Irmin_containers.Linked_log.Mem (CAS) (Irmin.Contents.String) () let merge_into_exn = merge_into_exn (module L.Store) let path = [ "tmp"; "link" ] -let config ~sw = L.Store.Repo.v ~sw (Irmin_mem.config ()) + +let config ~sw root = + let key = Irmin.Backend.Conf.root Irmin_mem.Conf.spec in + let conf = Irmin.Backend.Conf.singleton Irmin_mem.Conf.spec key root in + L.Store.Repo.v ~sw conf let test_empty_read () = Eio.Switch.run @@ fun sw -> - config ~sw + config ~sw __FUNCTION__ |> L.Store.main |> L.read_all ~path |> Alcotest.(check (list string)) "checked - reading empty log" [] let test_append_read_all () = Eio.Switch.run @@ fun sw -> - let t = config ~sw |> L.Store.main in + let t = config ~sw __FUNCTION__ |> L.Store.main in L.append ~path t "main.1"; L.append ~path t "main.2"; L.read_all ~path t @@ -48,7 +52,7 @@ let test_append_read_all () = let test_read_incr () = Eio.Switch.run @@ fun sw -> - let t = config ~sw |> L.Store.main in + let t = config ~sw __FUNCTION__ |> L.Store.main in L.append ~path t "main.1"; L.append ~path t "main.2"; let cur = L.get_cursor ~path t in @@ -61,7 +65,7 @@ let test_read_incr () = let test_read_excess () = Eio.Switch.run @@ fun sw -> - let t = config ~sw |> L.Store.main in + let t = config ~sw __FUNCTION__ |> L.Store.main in L.append ~path t "main.1"; L.append ~path t "main.2"; let cur = L.get_cursor ~path t in @@ -71,7 +75,7 @@ let test_read_excess () = let test_clone_merge () = Eio.Switch.run @@ fun sw -> - let t = config ~sw |> L.Store.main in + let t = config ~sw __FUNCTION__ |> L.Store.main in L.append ~path t "main.1"; L.append ~path t "main.2"; let b = L.Store.clone ~src:t ~dst:"cl" in @@ -85,7 +89,7 @@ let test_clone_merge () = let test_branch_merge () = Eio.Switch.run @@ fun sw -> - let r = config ~sw in + let r = config ~sw __FUNCTION__ in let b1 = L.Store.of_branch r "b1" in let b2 = L.Store.of_branch r "b2" in let b3 = L.Store.of_branch r "b3" in diff --git a/test/irmin-pack/test_corrupted.ml b/test/irmin-pack/test_corrupted.ml index 8ba049579b..bd5532f4c5 100644 --- a/test/irmin-pack/test_corrupted.ml +++ b/test/irmin-pack/test_corrupted.ml @@ -70,7 +70,8 @@ let test_corrupted_control_file () = assert (not (String.equal control_file_blob1 control_file_mix)); write_file control_file_path control_file_mix; let error = - try Ok (Store.Repo.v ~sw (config ~fresh:false root) : Store.Repo.t) with exn -> Error exn + try Ok (Store.Repo.v ~sw (config ~fresh:false root) : Store.Repo.t) + with exn -> Error exn in match error with | Error (Irmin_pack_unix.Errors.Pack_error (`Corrupted_control_file s)) -> diff --git a/test/irmin-pack/test_multicore.ml b/test/irmin-pack/test_multicore.ml index fa62e598f8..9a563da01d 100644 --- a/test/irmin-pack/test_multicore.ml +++ b/test/irmin-pack/test_multicore.ml @@ -474,15 +474,15 @@ let tests d_mgr = [ tc "find." test_find; (* tc "length." test_length; - tc "add / remove." test_add_remove; - tc "commit." test_commit; - tc "merkle." test_merkle; - tc "hash." test_hash; - tc "list-disk-no-cache." (test_list_disk ~cache:false); - tc "list-disk-with-cache." (test_list_disk ~cache:true); - tc "list-mem-no-cache." (test_list_mem ~cache:false); - tc "list-mem-with-cache." (test_list_mem ~cache:true); - tc "commit-of-hash." test_commit_of_hash; - tc "commit-parents." test_commit_parents; - tc "commit-v." test_commit_v; *) + tc "add / remove." test_add_remove; + tc "commit." test_commit; + tc "merkle." test_merkle; + tc "hash." test_hash; + tc "list-disk-no-cache." (test_list_disk ~cache:false); + tc "list-disk-with-cache." (test_list_disk ~cache:true); + tc "list-mem-no-cache." (test_list_mem ~cache:false); + tc "list-mem-with-cache." (test_list_mem ~cache:true); + tc "commit-of-hash." test_commit_of_hash; + tc "commit-parents." test_commit_parents; + tc "commit-v." test_commit_v; *) ]