This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
1
unikernel/duniverse/ocaml-crunch/test/.gitattributes
vendored
Normal file
1
unikernel/duniverse/ocaml-crunch/test/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/t1/** text eol=lf
|
||||
|
|
@ -0,0 +1 @@
|
|||
*.expected.*
|
||||
42
unikernel/duniverse/ocaml-crunch/test/consumer.ml
Normal file
42
unikernel/duniverse/ocaml-crunch/test/consumer.ml
Normal 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
|
||||
37
unikernel/duniverse/ocaml-crunch/test/dune
Normal file
37
unikernel/duniverse/ocaml-crunch/test/dune
Normal 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))
|
||||
51
unikernel/duniverse/ocaml-crunch/test/t1.expected.ml
Normal file
51
unikernel/duniverse/ocaml-crunch/test/t1.expected.ml
Normal file
File diff suppressed because one or more lines are too long
6
unikernel/duniverse/ocaml-crunch/test/t1.expected.mli
Normal file
6
unikernel/duniverse/ocaml-crunch/test/t1.expected.mli
Normal 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
|
||||
1
unikernel/duniverse/ocaml-crunch/test/t1/a.ext
Normal file
1
unikernel/duniverse/ocaml-crunch/test/t1/a.ext
Normal file
|
|
@ -0,0 +1 @@
|
|||
foo
|
||||
1
unikernel/duniverse/ocaml-crunch/test/t1/b
Normal file
1
unikernel/duniverse/ocaml-crunch/test/t1/b
Normal file
|
|
@ -0,0 +1 @@
|
|||
bar
|
||||
1
unikernel/duniverse/ocaml-crunch/test/t1/c
Normal file
1
unikernel/duniverse/ocaml-crunch/test/t1/c
Normal file
|
|
@ -0,0 +1 @@
|
|||
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
||||
BIN
unikernel/duniverse/ocaml-crunch/test/t1/d
Normal file
BIN
unikernel/duniverse/ocaml-crunch/test/t1/d
Normal file
Binary file not shown.
1
unikernel/duniverse/ocaml-crunch/test/t1/e/f
Normal file
1
unikernel/duniverse/ocaml-crunch/test/t1/e/f
Normal file
|
|
@ -0,0 +1 @@
|
|||
hallohallo
|
||||
55
unikernel/duniverse/ocaml-crunch/test/t1_plain.expected.ml
Normal file
55
unikernel/duniverse/ocaml-crunch/test/t1_plain.expected.ml
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue