This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1 @@
/t1/** text eol=lf

View file

@ -0,0 +1 @@
*.expected.*

View file

@ -0,0 +1,42 @@
open Lwt.Infix
let key s = Mirage_kv.Key.v s
let size t1 key =
T1.get t1 key >|= function Ok r -> Ok (String.length r) | Error e -> Error e
let main =
T1.connect () >>= fun src ->
(T1.get src (key "a.ext") >|= function
| Ok res ->
if res = "foo\n" then print_endline "read a.ext successfully"
else Fmt.failwith "unexpected read value, expecting foo, read: %s" res
| Error e -> Fmt.failwith "error while reading 'a.ext': %a" T1.pp_error e)
>>= fun () ->
(size src (key "c") >>= function
| Error _ -> Fmt.failwith "error while calling size on 'c'"
| Ok l ->
if l = 4100 then
T1.get src (key "c") >|= function
| Error e -> Fmt.failwith "error while reading 'c': %a" T1.pp_error e
| Ok _ -> print_endline "read 'c' successfully"
else failwith "invalid size while reading 'c'")
>>= fun () ->
(size src (key "d") >>= function
| Error e -> Fmt.failwith "error while calling size on 'd': %a" T1.pp_error e
| Ok l ->
if l = 12300 then
T1.get src (key "d") >|= function
| Error e -> Fmt.failwith "error while reading 'd': %a" T1.pp_error e
| Ok _ -> print_endline "read 'd' successfully"
else Fmt.failwith "invalid size while reading 'd'")
>>= fun () ->
T1.get src (key "e/f") >|= function
| Error e -> Fmt.failwith "error while reading 'd': %a" T1.pp_error e
| Ok data ->
if data = "hallohallo\n" then print_endline "read e/f successfully"
else
Fmt.failwith "unexpected read value, expecting hallohallo, read: %s"
data
let () = Lwt_main.run main

View file

@ -0,0 +1,37 @@
(rule
(targets t1.ml t1.mli t1_plain.ml t1_plain_ext.ml)
(deps
(source_tree t1))
(action
(setenv
SOURCE_DATE_EPOCH
0
(progn
(run %{bin:ocaml-crunch} --mode=lwt -o t1.ml t1)
(run %{bin:ocaml-crunch} --mode=plain -o t1_plain.ml t1)
(run %{bin:ocaml-crunch} --mode=plain -e ext -o t1_plain_ext.ml t1)))))
(rule
(alias runtest)
(action
(diff t1.expected.ml t1.ml)))
(rule
(alias runtest)
(action
(diff t1.expected.mli t1.mli)))
(rule
(alias runtest)
(action
(diff t1_plain.expected.ml t1_plain.ml)))
(rule
(alias runtest)
(action
(diff t1_plain_ext.expected.ml t1_plain_ext.ml)))
(test
(name consumer)
(libraries lwt.unix mirage-kv lwt mirage-kv-mem)
(modules t1 consumer))

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,6 @@
(* Generated by: ocaml-crunch
Creation date: Thu, 1 Jan 1970 00:00:00 GMT *)
include Mirage_kv.RO
val connect : unit -> t Lwt.t

View file

@ -0,0 +1 @@
foo

View file

@ -0,0 +1 @@
bar

View file

@ -0,0 +1 @@
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

Binary file not shown.

View file

@ -0,0 +1 @@
hallohallo

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,27 @@
(* Generated by: ocaml-crunch
Creation date: Thu, 1 Jan 1970 00:00:00 GMT *)
module Internal = struct
let d_d3b07384d113edec49eaa6238ad5ff00 = "foo\n"
let file_chunks = function
| "a.ext" | "/a.ext" -> Some [ d_d3b07384d113edec49eaa6238ad5ff00; ]
| _ -> None
let file_list = [ "a.ext"; ]
end
let file_list = Internal.file_list
let read name =
match Internal.file_chunks name with
| None -> None
| Some c -> Some (String.concat "" c)
let hash = function
| "a.ext" | "/a.ext" -> Some "d3b07384d113edec49eaa6238ad5ff00"
| _ -> None
let size = function
| "a.ext" | "/a.ext" -> Some 4
| _ -> None