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,4 @@
(test
(name test)
(package mirage)
(libraries mirage.functoria alcotest cmdliner rresult astring))

View file

@ -0,0 +1,31 @@
open Cmdliner
let opt =
let doc = Arg.info ~doc:"An optional key." [ "opt" ] in
Arg.(value & opt string "default" doc)
let opt_all =
let doc = Arg.info ~doc:"All the optional keys." [ "opt-all" ] in
Arg.(value & opt_all string [] doc)
let flag =
let doc = Arg.info ~doc:"A flag." [ "flag" ] in
Arg.(value & flag doc)
let required =
let doc = Arg.info ~doc:"A required key." [ "required" ] in
Arg.(required & opt (some string) None doc)
let hello =
let doc = Arg.info ~doc:"How to say hello." [ "hello" ] in
Arg.(value @@ opt string "Hello World!" doc)
let arg =
let doc =
Arg.info ~docs:"APPLICATION OPTIONS" ~doc:"A runtime argument." [ "arg" ]
in
Arg.(value & opt string "-" doc)
module Make (_ : sig end) = struct
let start () hello arg = Fmt.pr "Success: hello=%s arg=%s\n%!" hello arg
end

View file

@ -0,0 +1,30 @@
open Functoria
open E2e
let opt = runtime_arg ~pos:__POS__ "App.opt"
let opt_all = runtime_arg ~pos:__POS__ "App.opt_all"
let flag = runtime_arg ~pos:__POS__ "App.flag"
let required = runtime_arg ~pos:__POS__ "App.required"
let runtime_args =
[ runtime_arg ~pos:__POS__ "App.hello"; runtime_arg ~pos:__POS__ "App.arg" ]
let keys =
let connect _ _ = function
| [ opt; opt_all; flag; required ] ->
code ~pos:__POS__
{|
let _ : string = %s
and _ : string list = %s
and _ : bool = %s
and _ : string = %s
in
return ()|}
opt opt_all flag required
| _ -> failwith "keys: connect needs exactly 4 arguments"
in
let runtime_args = [ opt; opt_all; flag; required ] in
impl ~connect ~runtime_args "Unit" job
let main = main ~runtime_args ~pos:__POS__ "App.Make" (job @-> job)
let () = register "noop" [ main $ keys ]

View file

@ -0,0 +1,73 @@
Build an application.
$ ./test.exe configure --file app/config.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ make build
dune build --profile release --root . app/dist
Your unikernel binary is now ready in app/dist/noop
Execute the binary using solo5-hvt, solo5-spt, xl, ...
$ ls -a app/
.
..
app.ml
config.ml
dist
dune
dune.build
dune.config
main.exe
test
$ ls -a app/test
.
..
context
dune-workspace.config
main.ml
noop.opam
vote
warn_error
$ ./app/main.exe --required=foo
Success: hello=Hello World! arg=-
$ ./test.exe clean --file app/config.ml
$ ls -a app/
.
..
app.ml
config.ml
Test `--output`:
$ ./test.exe configure --file app/config.ml -o toto
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ make build
dune build --profile release --root . app/dist
Your unikernel binary is now ready in app/dist/toto
Execute the binary using solo5-hvt, solo5-spt, xl, ...
$ ls -a app/
.
..
app.ml
config.ml
dist
dune
dune.build
dune.config
test
toto.exe
$ ls -a app/test
.
..
context
dune-workspace.config
noop.opam
toto.ml
vote
warn_error
$ ./app/toto.exe --required=foo
Success: hello=Hello World! arg=-
$ ./test.exe clean --file app/config.ml
$ ls -a app/
.
..
app.ml
config.ml

View file

@ -0,0 +1,10 @@
Test that the cache is escaping entries correctly:
$ ./test.exe configure --file app/config.ml --vote="foo;;bar;;;\n\nllll;;;sdaads;;\n\t\0"
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ make build
dune build --profile release --root . app/dist
Your unikernel binary is now ready in app/dist/noop
Execute the binary using solo5-hvt, solo5-spt, xl, ...
$ cat app/test/vote
foo;;bar;;;\n\nllll;;;sdaads;;\n\t\0

View file

@ -0,0 +1,96 @@
Make sure that clean remove everything:
$ ./test.exe configure --file app/config.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ ls -a app
.
..
app.ml
config.ml
dist
dune
dune.build
dune.config
test
$ ls -a app/test
.
..
context
dune-workspace.config
main.ml
noop.opam
vote
warn_error
$ ./test.exe clean -v --file app/config.ml
test.exe: [INFO] run: clean:
{ "context" = ;
"config_file" = app/config.ml;
"output" = None;
"dry_run" = false }
test.exe: [INFO] Generating: app/test/dune-workspace.config (base)
test.exe: [INFO] Generating: dune-project (base)
test.exe: [INFO] Generating: app/dune.config (base)
config.exe: [INFO] reading cache app/test/context
config.exe: [INFO] Name noop
Keys vote=cat (default),
warn_error=false (default)
test.exe: [INFO] Skipped ./app
test.exe: [INFO] Skipped ./context
test.exe: [INFO] Skipped ./errors
test.exe: [INFO] Skipped ./help.exe
test.exe: [INFO] Skipped ./lib
test.exe: [INFO] Skipped ./test.exe
$ ls -a app
.
..
app.ml
config.ml
Check that clean works with `--output`:
$ ./test.exe configure --file app/config.ml --output=toto
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ ls -a app
.
..
app.ml
config.ml
dist
dune
dune.build
dune.config
test
$ ls -a app/test
.
..
context
dune-workspace.config
noop.opam
toto.ml
vote
warn_error
$ ./test.exe clean -v --file app/config.ml
test.exe: [INFO] run: clean:
{ "context" = ;
"config_file" = app/config.ml;
"output" = None;
"dry_run" = false }
test.exe: [INFO] Generating: app/test/dune-workspace.config (base)
test.exe: [INFO] Generating: dune-project (base)
test.exe: [INFO] Generating: app/dune.config (base)
config.exe: [INFO] reading cache app/test/context
config.exe: [INFO] Name noop
Keys vote=cat (default),
warn_error=false (default)
Output toto
test.exe: [INFO] Skipped ./app
test.exe: [INFO] Skipped ./context
test.exe: [INFO] Skipped ./errors
test.exe: [INFO] Skipped ./help.exe
test.exe: [INFO] Skipped ./lib
test.exe: [INFO] Skipped ./test.exe
$ ls -a app
.
..
app.ml
config.ml

View file

@ -0,0 +1,89 @@
Check that configure generates the file in the right dir when `--file`
is passed:
$ ./test.exe configure -v --file app/config.ml
test.exe: [INFO] run: configure:
{ "args" =
{ "context" = ;
"config_file" = app/config.ml;
"output" = None;
"dry_run" = false };
"depext" = true }
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
test.exe: [INFO] Generating: app/test/dune-workspace.config (base)
test.exe: [INFO] Generating: dune-project (base)
test.exe: [INFO] Generating: app/dune.config (base)
test.exe: [INFO] Preserving arguments in app/test/context:
[|"./test.exe"; "configure"; "-v"; "--file";
"app/config.ml"|]
test.exe: [INFO] Set-up config skeleton.
config.exe: [INFO] reading cache app/test/context
config.exe: [INFO] Name noop
Keys vote=cat (default),
warn_error=false (default)
config.exe: [INFO] Generating: noop.opam (opam)
config.exe: [INFO] in dir { "context" = ;
"config_file" = app/config.ml;
"output" = None;
"dry_run" = false }
config.exe: [INFO] Generating: main.ml (main file)
config.exe: [INFO] Generating: dune.build (dune.build)
config.exe: [INFO] Generating: dune-workspace (dune-workspace)
config.exe: [INFO] Generating: dune-project (dune-project)
config.exe: [INFO] Generating: dune (dune.dist)
$ ls -a app/
.
..
app.ml
config.ml
dist
dune
dune.build
dune.config
test
$ ls -a app/test
.
..
context
dune-workspace.config
main.ml
noop.opam
vote
warn_error
$ ./test.exe clean --file app/config.ml
Check that configure create the correct context file:
$ ./test.exe configure --file=app/config.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ cat app/test/context
configure
--file=app/config.ml
$ rm -rf custom_build_
$ ./test.exe configure --file=app/config.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ cat app/test/context
configure
--file=app/config.ml
$ ./test.exe clean --file=app/config.ml
Check that `test help configure` and `test configure --help` have the
same output.
$ ./test.exe help configure --file=app/config.ml --help=plain > h1
$ ./test.exe configure --help=plain --file=app/config.ml > h2
$ ./help.exe diff h1 h2
Check that `test help configure` works when no config.ml file is present.
$ ./test.exe configure --help=plain > h0
$ ./help.exe show h0 SYNOPSIS | xargs
test configure [OPTION]
Check that errors are reported correcty:
$ ./test.exe configure a b c --file=app/config.ml 2>&1 | tr -d \'
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
Usage: test configure [--help] [OPTION]
test: too many arguments, dont know what to do with a, b, c

View file

@ -0,0 +1,57 @@
Query package - no target - x.context
$ ./test.exe query packages --context-file=context/x.context -f context/config.ml
"fmt" { ?monorepo }
"mirage-runtime" { ?monorepo }
"x" { ?monorepo }
Query package - no target - y.context
$ ./test.exe query packages --context-file=context/y.context -f context/config.ml
"fmt" { ?monorepo }
"mirage-runtime" { ?monorepo }
"y" { ?monorepo }
Query package - x target - y.context
$ ./test.exe query packages -t x --context-file=context/y.context -f context/config.ml
"fmt" { ?monorepo }
"mirage-runtime" { ?monorepo }
"x" { ?monorepo }
Query package - y target - x.context
$ ./test.exe query packages -t y --context-file=context/x.context -f context/config.ml
"fmt" { ?monorepo }
"mirage-runtime" { ?monorepo }
"y" { ?monorepo }
Describe - no target - x.context
$ ./test.exe describe --context-file=context/x.context -f context/config.ml
Name noop
Keys target=x,
vote=cat (default),
warn_error=false (default)
Describe - no target - y.context
$ ./test.exe describe --context-file=context/y.context -f context/config.ml
Name noop
Keys target=y,
vote=cat (default),
warn_error=false (default)
Describe - x target - y.context
$ ./test.exe describe -t x --context-file=context/y.context -f context/config.ml
Name noop
Keys target=x,
vote=cat (default),
warn_error=false (default)
Describe - y target - x.context
$ ./test.exe describe -t y --context-file=context/x.context -f context/config.ml
Name noop
Keys target=y,
vote=cat (default),
warn_error=false (default)
Bad context cache
$ ./test.exe configure -t nonexistent --context-file=context/z.context -f context/config.ml 2>&1 | tr -d \'
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
Usage: test configure [--help] [-t ENUM] [OPTION]
test: option -t: invalid value nonexistent, expected either y or x

View file

@ -0,0 +1,17 @@
open E2e
open Functoria
open Cmdliner
let x = Impl.v ~packages:[ package "x" ] "X" job
let y = Impl.v ~packages:[ package "y" ] "Y" job
let target_conv : [ `X | `Y ] Cmdliner.Arg.conv =
Cmdliner.Arg.enum [ ("y", `Y); ("x", `X) ]
let target =
let doc = Arg.info ~doc:"Target." [ "t" ] in
let key = Key.Arg.opt target_conv `X doc in
Key.create "target" key
let main = match_impl (Key.value target) ~default:y [ (`X, x) ]
let () = register ~src:`None "noop" [ main ]

View file

@ -0,0 +1,2 @@
-t
x

View file

@ -0,0 +1,2 @@
-t
y

View file

@ -0,0 +1,2 @@
-t
nonexistent

View file

@ -0,0 +1,24 @@
Test that `describe` works as expected:
$ ./test.exe describe --file app/config.ml
Name noop
Keys vote=cat (default),
warn_error=false (default)
$ ./test.exe describe -v --file app/config.ml
test.exe: [INFO] run: describe:
{ "args" =
{ "context" = ;
"config_file" = app/config.ml;
"output" = None;
"dry_run" = false };
"dotcmd" = "xdot";
"dot" = false;
"eval" = None }
test.exe: [INFO] Generating: app/test/dune-workspace.config (base)
test.exe: [INFO] Generating: dune-project (base)
test.exe: [INFO] Generating: app/dune.config (base)
Name noop
Keys vote=cat (default),
warn_error=false (default)
Libraries fmt, mirage-runtime.functoria
Packages fmt { ?monorepo }, mirage-runtime { ?monorepo }

View file

@ -0,0 +1,23 @@
(executable
(name test)
(modules test)
(libraries e2e alcotest cmdliner rresult astring))
(executable
(name help)
(modules help)
(libraries astring fmt))
(cram
(deps
test.exe
help.exe
(source_tree app)
(source_tree lib)
(source_tree errors)
(source_tree context)
(package mirage)
(package mirage-runtime))
(enabled_if
(<> %{architecture} "i386"))
(package mirage))

View file

@ -0,0 +1,53 @@
Check the locations of error messages when something is wrong in the body
of a device's connect function:
$ ./test.exe configure -f errors/in_device.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ dune build
File "errors/in_device.ml", line 6, characters 2-26:
Error: Unbound value Unikernel_make__4.start'
Hint: Did you mean start?
[1]
$ ./test.exe clean -f errors/in_device.ml
Check what happens when the number of the arguments passed to the functor is
not the right ones. First, too many parameters:
$ ./test.exe configure -f errors/in_functor_too_many.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ dune build 2>&1 | head -n1 | cut -d',' -f'-2'
File "errors/test/main.ml", line 10
$ ./test.exe clean -f errors/in_functor_too_many.ml
Then, not enough:
$ ./test.exe configure -f errors/in_functor_not_enough.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ dune build
File "errors/test/main.ml", line 34, characters 3-26:
Error: The module Unikernel_make__4 is a functor, it cannot have any components
[1]
$ ./test.exe clean -f errors/in_functor_not_enough.ml
Also check that we have proper errors when the config file is missing:
Configure failure
$ ./test.exe configure --vote=dog
configuration file config.ml missing
[1]
Query failure
$ ./test.exe query --vote=dog
configuration file config.ml missing
[1]
Describe failure
$ ./test.exe describe --vote=dog
configuration file config.ml missing
[1]
Clean does not fail
$ ./test.exe clean --vote=dog
Help does not fail
$ ./test.exe help --man-format=plain > /dev/null

View file

@ -0,0 +1,11 @@
open Functoria
open E2e
let device =
let connect _ modname = function
| [ _; _ ] -> code ~pos:__POS__ "%s.start' () ()" modname
| _ -> assert false
in
impl ~connect "Unikernel.Make" (job @-> job @-> job)
let () = register "my-app" [ device $ noop $ noop ]

View file

@ -0,0 +1,3 @@
module Make (_ : sig end) (_ : sig end) = struct
let start _ _ = ()
end

View file

@ -0,0 +1,5 @@
open Functoria
open E2e
let device = main "Unikernel.Make" (job @-> job)
let () = register "my-app" [ device $ noop ]

View file

@ -0,0 +1,3 @@
module Make (_ : sig end) (_ : sig end) = struct
let start _ _ = ()
end

View file

@ -0,0 +1,5 @@
open Functoria
open E2e
let device = main "Unikernel.Make" (job @-> job @-> job @-> job)
let () = register "my-app" [ device $ noop $ noop $ noop ]

View file

@ -0,0 +1,3 @@
module Make (_ : sig end) (_ : sig end) = struct
let start _ _ = ()
end

View file

@ -0,0 +1,3 @@
module Make (_ : sig end) (_ : sig end) = struct
let start _ _ = ()
end

View file

@ -0,0 +1,77 @@
(*
* Copyright (c) 2015 Jeremy Yallop
* Copyright (c) 2021 Thomas Gazagnaire <thomas@gazagnaire.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
open Astring
(* cut a man page into sections *)
let by_sections s =
let lines = String.cuts ~sep:"\n" s in
let return l =
match List.rev l with [] -> assert false | h :: t -> (h, t)
in
let rec aux current sections = function
| [] -> List.rev (return current :: sections)
| h :: t ->
if
String.length h > 1
&& String.for_all (fun x -> Char.Ascii.(is_upper x || is_white x)) h
then aux [ h ] (return current :: sections) t
else aux (h :: current) sections t
in
aux [ "INIT" ] [] lines
let sections = [ "CONFIGURE OPTIONS"; "APPLICATION OPTIONS"; "COMMON OPTIONS" ]
let read file =
let ic = open_in_bin file in
let str = really_input_string ic (in_channel_length ic) in
close_in ic;
by_sections str
let err_usage () =
Fmt.pr "[usage]: ./help.exe [diff|show] PARAMS\n";
exit 1
let () =
if Array.length Sys.argv <> 4 then err_usage ()
else
match Sys.argv.(1) with
| "diff" ->
let s1 = read Sys.argv.(2) in
let s2 = read Sys.argv.(3) in
List.iter
(fun name ->
match (List.assoc_opt name s1, List.assoc_opt name s2) with
| Some s1, Some s2 ->
if List.length s1 <> List.length s2 then
Fmt.failwith "Number of lines in %S differs" name
else
List.iter2
(fun s1 s2 ->
if s1 <> s2 then
Fmt.failwith "Lines in section %S differ:\n %S\n %S\n"
name s1 s2)
s1 s2
| _ -> Fmt.failwith "Section %S differs" name)
sections
| "show" -> (
let s1 = read Sys.argv.(2) in
let name = Sys.argv.(3) in
match List.assoc_opt name s1 with
| None -> ()
| Some s -> List.iter print_endline s)
| _ -> err_usage ()

View file

@ -0,0 +1,186 @@
Test that the help command works without config file:
$ ./test.exe help -v --help=plain
test.exe: [INFO] run: help:
{ "context" = ;
"config_file" = config.ml;
"output" = None;
"dry_run" = false }
NAME
test-help - Display help about test commands.
SYNOPSIS
test help [--man-format=FMT] [OPTION] [TOPIC]
DESCRIPTION
Prints help.
Use `test help topics' to get the full list of help topics.
DESCRIBE OPTIONS
--eval
Fully evaluate the graph before showing it. The default when the
unikernel has already been configured.
--no-eval
Do not evaluate the graph before showing it. See --eval. The
default when the unikernel has not been configured.
CONFIGURE OPTIONS
--context-file=FILE (absent=test.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repos=NAME1:URL1,NAME2:URL2,...
(absent=opam-overlays:https://github.com/dune-universe/opam-overlays.git,mirage-overlays:https://github.com/dune-universe/mirage-opam-overlays.git
or MIRAGE_EXTRA_REPOS env)
Additional opam-repositories to use when using `opam monorepo
lock' to gather local sources. Default:
https://github.com/dune-universe/opam-overlays.git &
https://github.com/dune-universe/mirage-opam-overlays.git.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
--no-extra-repo
Disable the use of any overlay repository.
-o FILE, --output=FILE
Name of the output file.
APPLICATION OPTIONS
--vote=VOTE (absent=cat)
Vote.
--warn-error=BOOL (absent=false)
Enable -warn-error when compiling OCaml sources.
ARGUMENTS
TOPIC
The topic to get help on.
OPTIONS
--man-format=FMT (absent=pager)
Show output in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
test help exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of test help:
MIRAGE_EXTRA_REPOS
See option --extra-repos.
SEE ALSO
test(1)
As well as the default command:
$ ./test.exe -v
NAME
test - The test application builder
SYNOPSIS
test [COMMAND]
DESCRIPTION
The test application builder. It glues together a set of libraries and
configuration (e.g. network and storage) into a standalone unikernel
or UNIX binary.
Use test help <command> for more information on a specific command.
COMMANDS
clean [OPTION]
Clean the files produced by test for a given application.
configure [OPTION]
Configure a test application.
describe [OPTION]
Describe a test application.
help [--man-format=FMT] [OPTION] [TOPIC]
Display help about test commands.
query [OPTION] [INFO]
Query information about the test application.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
test exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).

View file

@ -0,0 +1,22 @@
Test keys.
$ ./test.exe configure --file app/config.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ make build
dune build --profile release --root . app/dist
Your unikernel binary is now ready in app/dist/noop
Execute the binary using solo5-hvt, solo5-spt, xl, ...
$ cat app/test/vote
cat
$ ./test.exe clean --file app/config.ml
Change the key at configure time:
$ ./test.exe configure --file app/config.ml --vote=dog
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ make build
dune build --profile release --root . app/dist
Your unikernel binary is now ready in app/dist/noop
Execute the binary using solo5-hvt, solo5-spt, xl, ...
$ cat app/test/vote
dog

View file

@ -0,0 +1,3 @@
(library
(name e2e)
(libraries mirage.functoria))

View file

@ -0,0 +1,78 @@
open Functoria
open Cmdliner
module Key = Key
let docs = "APPLICATION OPTIONS"
let warn_error =
let doc = "Enable -warn-error when compiling OCaml sources." in
let doc = Arg.info ~docv:"BOOL" ~doc ~docs [ "warn-error" ] in
let key = Key.Arg.opt Arg.bool false doc in
Key.create "warn_error" key
let vote =
let doc = "Vote." in
let doc = Arg.info ~docv:"VOTE" ~doc ~docs [ "vote" ] in
let key = Key.Arg.opt Arg.string "cat" doc in
Key.create "vote" key
let file_of_key k = Fpath.v Key.(name @@ v k)
let write_key i k f =
let context = Info.context i in
let file = file_of_key k in
let contents = f (Key.get context k) in
Action.write_file file contents
module C = struct
open Action.Syntax
let prelude _ =
"let (>>=) x f = f x\ntype 'a io = 'a\nlet return x = x\nlet run x = x"
let name = "test"
let version = "1.0~test"
let packages = [ package ~sublibs:[ "functoria" ] "mirage"; package "e2e" ]
let keys = Key.[ v vote; v warn_error ]
let connect _ _ _ = code ~pos:__POS__ "()"
let main i = Fpath.(basename @@ rem_ext @@ Info.main i)
let config i = Fpath.(basename @@ rem_ext @@ Info.config_file i)
let dune i =
let dune =
Dune.stanzaf
{|
(executable
(name %s)
(modules (:standard \ %s))
(promote (until-clean))
(libraries cmdliner fmt mirage-runtime.functoria))
|}
(main i) (config i)
in
[ dune ]
let configure i =
let* () = write_key i vote (fun x -> x) in
write_key i warn_error string_of_bool
let create jobs =
let packages = [ package "fmt" ] in
let extra_deps = List.map dep jobs in
let install i = Install.v ~bin:[ Fpath.(v (main i) + "exe", v "e2e") ] () in
impl ~keys ~packages ~connect ~dune ~configure ~extra_deps ~install "E2e"
job
let name_of_target i = Info.name i
let target_filename = name_of_target
let dune_project = []
let dune_workspace = None
let context_name _ = "default"
end
include Lib.Make (C)
include Tool.Make (C)
let register ?(init = []) ?src name typ =
let init = runtime_args sys_argv :: init in
register ~init ?src name typ

View file

@ -0,0 +1,10 @@
open Functoria.DSL
val register :
?init:job impl list ->
?src:[ `Auto | `None | `Some of string ] ->
string ->
job impl list ->
unit
val run : unit -> unit

View file

@ -0,0 +1,8 @@
Help query --man-format=plain
$ ./test.exe help query --man-format=plain > d1
Help query --help=plain
$ ./test.exe query --help=plain > d2
No difference
$ diff d1 d2

View file

@ -0,0 +1,56 @@
Run an application
$ ./test.exe configure --file app/config.ml
test.exe: [WARNING] Skipping version check, since our_version ("1.0~test") fails to parse: only digits and . allowed in version
$ dune exec -- ./app/main.exe --arg=yo --required=bar
Success: hello=Hello World! arg=yo
$ dune exec -- ./app/main.exe --help=plain
NAME
noop
SYNOPSIS
noop [OPTION]
APPLICATION OPTIONS
--arg=VAL (absent=-)
A runtime argument.
OPTIONS
--flag
A flag.
--hello=VAL (absent=Hello World!)
How to say hello.
--opt=VAL (absent=default)
An optional key.
--opt-all=VAL
All the optional keys.
--required=VAL (required)
A required key.
COMMON OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
EXIT STATUS
noop exits with:
0 on success.
1 on Solo5 internal error.
63 on showing this help.
64 on any argument parsing error.
125 on unexpected internal errors (bugs) while processing the boot
parameters.
255 on OCaml uncaught exception.
[63]

View file

@ -0,0 +1,18 @@
(*
* Copyright (c) 2015 Jeremy Yallop
* Copyright (c) 2021 Thomas Gazagnaire <thomas@gazagnaire.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)
let () = E2e.run ()

View file

@ -0,0 +1 @@
(* empty *)

View file

@ -0,0 +1,10 @@
let () =
Alcotest.run "functoria"
[
("cli", Test_cli.suite);
("package", Test_package.suite);
("graph", Test_graph.suite);
("action", Test_action.suite);
("key", Test_key.suite);
("version", Test_version.suite);
]

View file

@ -0,0 +1 @@
(* empty *)

View file

@ -0,0 +1,384 @@
open Functoria
open Action.Syntax
let pp_unit ppf () = Fmt.string ppf "()"
let domain pp = Alcotest.testable (Action.pp_domain pp) (Action.eq_domain ( = ))
let file = "<file>"
let dir = "<DIR>"
let error e = Error (`Msg e)
let ( ! ) files = Action.env ~files:(`Files files) ()
let path = Fpath.v "path"
let other_path = Fpath.v "other_path"
let dom result env logs = { Action.result; env; logs }
let test_bind () =
let got =
Action.dry_run
~env:![ (path, file); (other_path, file) ]
(let* () = Action.rm path in
Action.rm other_path)
in
Alcotest.check (domain pp_unit) "sequence"
(dom (Ok ()) ![] [ "Rm path (removed)"; "Rm other_path (removed)" ])
got;
let got =
Action.dry_run
~env:![ (other_path, dir) ]
(let* () = Action.rm path in
Action.rm other_path)
in
Alcotest.check (domain pp_unit) "sequence after error"
(dom
(error "other_path is a directory")
![ (other_path, dir) ]
[ "Rm path (no-op)"; "Rm other_path (error)" ])
got;
let got =
let value = 5 in
Action.dry_run ~env:![]
(let* got_value = Action.ok value in
Alcotest.check Alcotest.int "value matches" value got_value;
Action.ok ())
in
Alcotest.check (domain pp_unit) "bind passes the correct value to caller code"
(dom (Ok ()) ![] []) got
let mk_test ~env ~expected name a ty =
let got = Action.dry_run ~env a in
Alcotest.check (domain ty) name expected got
let test_seq () =
let test msg seq = mk_test msg (Action.seq seq) pp_unit in
let test_file b x = Alcotest.(check bool) "file exists" b x in
test "simple sequence" ~env:![]
~expected:
(dom (Ok ()) ![]
[
"Write to path (0 bytes)";
"Is_file? path -> true";
"Rm path (removed)";
"Is_file? path -> false";
])
Action.
[
write_file path "";
(let+ is_file = is_file path in
test_file true is_file);
rm path;
(let+ is_file = is_file path in
test_file false is_file);
]
let test_rm () =
let test msg ~path = mk_test msg (Action.rm path) pp_unit in
test "delete (file)" ~path
~env:![ (path, file); (other_path, file) ]
~expected:(dom (Ok ()) ![ (other_path, file) ] [ "Rm path (removed)" ]);
let env = ![ (path, dir); (other_path, file) ] in
test "delete (dir)" ~path ~env
~expected:(dom (error "path is a directory") env [ "Rm path (error)" ]);
let env = ![ (other_path, file) ] in
test "delete (file does not exist)" ~path ~env
~expected:(dom (Ok ()) env [ "Rm path (no-op)" ])
let test_mkdir () =
let test msg ~path = mk_test msg (Action.mkdir path) Fmt.bool in
test "mkdir (new dir)" ~path
~env:![ (other_path, file) ]
~expected:
(dom (Ok true)
![ (other_path, file); (path, dir) ]
[ "Mkdir path (created)" ]);
let env = ![ (other_path, file); (path, dir) ] in
test "mdkir (existing dir)" ~path ~env
~expected:(dom (Ok false) env [ "Mkdir path (already exists)" ]);
let env = ![ (path, file) ] in
test "mdkir (existing file)" ~path ~env
~expected:
(dom
(error "a file named 'path' already exists")
env [ "Mkdir path (error)" ])
let test_rmdir () =
let test msg ~path = mk_test msg (Action.rmdir path) pp_unit in
let env = ![ (other_path, dir) ] in
test "rmdir (non-existing dir)" ~path ~env
~expected:(dom (Ok ()) env [ "Rmdir path (no-op)" ]);
test "rmdir (existing dir)" ~path
~env:![ (path, file); (other_path, dir) ]
~expected:(dom (Ok ()) ![ (other_path, dir) ] [ "Rmdir path (removed)" ]);
let env =
![
(other_path, file); (Fpath.(path / "1"), dir); (Fpath.(path / "2"), file);
]
in
test "rmdir (dir with contents)" ~path ~env
~expected:(dom (Ok ()) ![ (other_path, file) ] [ "Rmdir path (removed)" ])
let test_with_dir () =
let test msg ~path op = mk_test msg (Action.with_dir path op) pp_unit in
test "with_dir (create file)" ~path ~env:![]
~expected:
(dom (Ok ())
![ (Fpath.(path // other_path), file) ]
[ "With_dir path [Write to other_path (6 bytes)]" ])
(fun () -> Action.write_file other_path file)
let test_pwd () =
let test msg = mk_test msg (Action.pwd ()) Fpath.pp in
test "pwd (root)" ~env:![]
~expected:(dom (Ok (Fpath.v "/")) ![] [ "Pwd -> /" ]);
let env = Action.env ~pwd:(Fpath.v "/foo/bar") () in
test "pwd (env)" ~env
~expected:(dom (Ok (Fpath.v "/foo/bar")) env [ "Pwd -> /foo/bar" ])
let test_is_file () =
let test msg ~path = mk_test msg (Action.is_file path) Fmt.bool in
let env = ![ (path, file) ] in
test "file exists (true)" ~path ~env
~expected:(dom (Ok true) env [ "Is_file? path -> true" ]);
let env = ![ (other_path, file) ] in
test "file exists (false)" ~path ~env
~expected:(dom (Ok false) env [ "Is_file? path -> false" ])
let test_is_dir () =
let test msg ~path = mk_test msg (Action.is_dir path) Fmt.bool in
let env = ![ (path, dir) ] in
test "dir exists (exact dir)" ~path ~env
~expected:(dom (Ok true) env [ "Is_dir? path -> true" ]);
let env = ![ (path, file) ] in
test "dir exists (file)" ~path ~env
~expected:(dom (Ok false) env [ "Is_dir? path -> false" ]);
let env = ![ (other_path, file) ] in
test "dir exists (false)" ~path ~env
~expected:(dom (Ok false) env [ "Is_dir? path -> false" ]);
let env = ![ (Fpath.(path / "1"), file) ] in
test "dir exists (with a file in it)" ~path ~env
~expected:(dom (Ok true) env [ "Is_dir? path -> true" ])
let test_size_of () =
let test msg ~path =
mk_test msg (Action.size_of path) Fmt.(Dump.option int)
in
let env = ![ (path, "") ] in
test "size_of (empty)" ~path ~env
~expected:(dom (Ok (Some 0)) env [ "Size_of path -> 0" ]);
let env = ![] in
test "size_of (error)" ~path ~env
~expected:(dom (Ok None) env [ "Size_of path -> error" ]);
let env = ![ (path, String.make 10_000 'a') ] in
test "size_of (large)" ~path ~env
~expected:(dom (Ok (Some 10_000)) env [ "Size_of path -> 10000" ])
let test_set_var () =
let test msg ~key ~value = mk_test msg (Action.set_var key value) pp_unit in
let env = Action.env ~env:[ ("var", "v") ] () in
test "set_var (unset)" ~key:"var" ~value:None ~env
~expected:(dom (Ok ()) ![] [ "Set_var var <unset>" ]);
let new_v = "new_v" in
let env = Action.env ~env:[ ("var", new_v) ] () in
test "set_var (new)" ~key:"var" ~value:(Some new_v) ~env:![]
~expected:(dom (Ok ()) env [ "Set_var var new_v" ]);
let new_v = "new_v" in
let env v = Action.env ~env:[ ("var", v) ] () in
test "set_var (overwrite)" ~key:"var" ~value:(Some new_v) ~env:(env "v")
~expected:(dom (Ok ()) (env new_v) [ "Set_var var new_v" ])
let test_get_var () =
let test msg ~key =
mk_test msg (Action.get_var key) Fmt.(Dump.option string)
in
let v = "v" in
let env = Action.env ~env:[ ("var", v) ] () in
test "get_var (existing)" ~key:"var" ~env
~expected:(dom (Ok (Some v)) env [ "Get_var var -> v" ]);
let env = ![] in
test "get_var (not set)" ~key:"var" ~env
~expected:(dom (Ok None) env [ "Get_var var -> <not set>" ])
let none _ = None
let yay _ = Some ("yay", "")
let yay_err _ = Some ("yay", "err")
let test_run_cmd () =
let test msg ?err ?out ~exec ~cmd ~expected ~expected_log () =
let env = Action.env ~exec () in
let got = Action.dry_run ~env (Action.run_cmd ?err ?out cmd) in
Alcotest.check (domain pp_unit) msg (dom expected env expected_log) got
in
test "run_cmd fails if the command doesn't exist" ~exec:none
~cmd:(Bos.Cmd.v "some-command")
~expected:(error "'some-command' not found")
~expected_log:[ "Run_cmd 'some-command' (error)" ]
();
let cmd = Bos.Cmd.v "some-command" in
test "run_cmd succeeds if the command exists" ~exec:yay ~cmd ~expected:(Ok ())
~expected_log:[ "Run_cmd 'some-command' (ok)" ]
();
let err_b = Buffer.create 10 in
let err = `Fmt (Fmt.with_buffer err_b) in
let out_b = Buffer.create 10 in
let out = `Fmt (Fmt.with_buffer out_b) in
test "run_cmd succeeds if the command exists" ~exec:yay_err ~cmd ~out ~err
~expected:(Ok ())
~expected_log:[ "Run_cmd 'some-command' (ok)" ]
();
Alcotest.(check string) "cmd out" "yay" (Buffer.contents out_b);
Alcotest.(check string) "cmd err" "err" (Buffer.contents err_b)
let test_run_cmd_out () =
let test msg ?err ~exec ~cmd ~expected ~expected_log () =
let env = Action.env ~exec () in
let got = Action.dry_run ~env (Action.run_cmd_out ?err cmd) in
Alcotest.check (domain Fmt.string) msg (dom expected env expected_log) got
in
test "run_cmd_out fails if the command doesn't exist" ~exec:none
~cmd:(Bos.Cmd.v "some-command")
~expected:(error "'some-command' not found")
~expected_log:[ "Run_cmd 'some-command' (error)" ]
();
let cmd = Bos.Cmd.v "some-command" in
test "run_cmd_out succeeds if the command exists" ~exec:yay ~cmd
~expected:(Ok "yay")
~expected_log:[ "Run_cmd 'some-command' (ok)" ]
();
let err_b = Buffer.create 10 in
let err = `Fmt (Fmt.with_buffer err_b) in
test "run_cmd_out succeeds if the command exists" ~exec:yay_err ~cmd ~err
~expected:(Ok "yay")
~expected_log:[ "Run_cmd 'some-command' (ok)" ]
();
Alcotest.(check string) "cmd_out err" "err" (Buffer.contents err_b)
let test_write_file () =
let test msg ~path ~contents =
mk_test msg (Action.write_file path contents) pp_unit
in
let contents = "contents" in
test "write to nonexisting file" ~path ~env:![] ~contents
~expected:(dom (Ok ()) ![ (path, contents) ] [ "Write to path (8 bytes)" ]);
let contents = "new contents" in
test "write to existing file" ~path
~env:![ (path, contents) ]
~contents
~expected:(dom (Ok ()) ![ (path, contents) ] [ "Write to path (12 bytes)" ])
let test_tmp_file () =
let test msg ~pat = mk_test msg (Action.tmp_file pat) Fpath.pp in
let pat : Bos.OS.File.tmp_name_pat = "path-%s" in
let path0 = Fpath.(v "/tmp" / Fmt.str pat "0") in
let env = ![] in
test "create a temp file (no conflicts)" ~env ~pat
~expected:(dom (Ok path0) env [ "Tmp_file -> /tmp/path-0" ]);
let pat : Bos.OS.File.tmp_name_pat = "path-%s" in
let pathn n = Fpath.(v "/tmp" / Fmt.str pat (string_of_int n)) in
let env = ![ (pathn 0, file); (pathn 1, file); (pathn 3, file) ] in
test "create a temp file (with conflicts)" ~env ~pat
~expected:(dom (Ok (pathn 2)) env [ "Tmp_file -> /tmp/path-2" ])
let test_ls () =
let all _ = true in
let test msg ~path =
mk_test msg (Action.ls path all) (Fmt.Dump.list Fpath.pp)
in
let env = ![] in
test "list a non-existig path (error)" ~env ~path
~expected:
(dom (error "path: no such file or directory") env [ "Ls path (error)" ]);
let root = Fpath.v "root" in
let pathn n = Fpath.(root / string_of_int n) in
let env = ![ (pathn 0, file); (pathn 1, file); (pathn 2, file) ] in
test "list a directory" ~env ~path:root
~expected:
(dom (Ok Fpath.[ v "0"; v "1"; v "2" ]) env [ "Ls root (3 entries)" ]);
let env = ![ (path, dir) ] in
test "list an empty directory" ~env ~path
~expected:(dom (Ok []) env [ "Ls path (0 entry)" ]);
let env = ![ (path, file) ] in
test "list a file" ~env ~path
~expected:(dom (Ok [ path ]) env [ "Ls path (1 entry)" ])
let test_with_output () =
let test msg ~contents ~expected =
let env = ![] in
let mode = 0o755 in
let purpose = "PURPOSE" in
let called = ref false in
let got =
Action.dry_run ~env
@@ Action.with_output ~mode ~path ~purpose (fun fmt ->
called := true;
Fmt.pf fmt "%s" contents)
in
Alcotest.check (domain pp_unit) msg
(dom expected
![ (path, contents) ]
[ "Write to path (mode: 0755, purpose: PURPOSE)" ])
got;
Alcotest.check Alcotest.bool "k was called" true called.contents
in
let contents = "contents" in
test "write" ~contents ~expected:(Ok ())
let suite =
List.map
(fun (n, f) -> (n, `Quick, f))
[
("bind", test_bind);
("seq", test_seq);
("rm", test_rm);
("mkdir", test_mkdir);
("rmdir", test_rmdir);
("with_dir", test_with_dir);
("pwd", test_pwd);
("is_file", test_is_file);
("is_dir", test_is_dir);
("size_of", test_size_of);
("set_var", test_set_var);
("get_var", test_get_var);
("run_cmd", test_run_cmd);
("run_cmd_out", test_run_cmd_out);
("write_file", test_write_file);
("tmp_file", test_tmp_file);
("ls", test_ls);
("with_output", test_with_output);
]

View file

@ -0,0 +1 @@
val suite : unit Alcotest.test_case list

View file

@ -0,0 +1,182 @@
open Functoria
let result_t pp_a =
let pp ppf = function
| `Error `Exn -> Fmt.string ppf "error exn"
| `Error `Parse -> Fmt.string ppf "error parse"
| `Error `Term -> Fmt.string ppf "error term"
| `Help -> Fmt.string ppf "help"
| `Version -> Fmt.string ppf "version"
| `Ok action ->
let pp = Cli.pp_action pp_a in
Fmt.pf ppf "ok %a" pp action
in
Alcotest.testable pp ( = )
let result_b = result_t Fmt.(Dump.pair bool bool)
let eval = Cli.eval ~with_setup:false ~name:"name" ~version:"0.2"
let test_configure () =
let extra_term =
Cmdliner.(
Term.(
const (fun xyz cde -> (xyz, cde))
$ Arg.(value (flag (info [ "x"; "xyz" ])))
$ Arg.(value (flag (info [ "c"; "cde" ])))))
in
let result =
eval ~configure:extra_term ~query:extra_term ~describe:extra_term
~clean:extra_term ~help:extra_term ~mname:"test"
[| "name"; "configure"; "--xyz"; "--verbose" |]
in
Alcotest.(check result_b)
"configure"
(`Ok
(Cli.Configure
{
depext = true;
extra_repo =
[
( "opam-overlays",
"https://github.com/dune-universe/opam-overlays.git" );
( "mirage-overlays",
"https://github.com/dune-universe/mirage-opam-overlays.git" );
];
args =
{
context = (true, false);
output = None;
config_file = Fpath.v "config.ml";
context_file = None;
dry_run = false;
};
}))
result
let test_describe () =
let extra_term =
Cmdliner.(
Term.(
const (fun xyz cde -> (xyz, cde))
$ Arg.(value (flag (info [ "x"; "xyz" ])))
$ Arg.(value (flag (info [ "c"; "cde" ])))))
in
let result =
eval ~configure:extra_term ~query:extra_term ~describe:extra_term
~clean:extra_term ~help:extra_term ~mname:"test"
[|
"name";
"describe";
"--context-file=config.json";
"--cde";
"--color=always";
"--dot-command=dot";
"--eval";
|]
in
Alcotest.(check result_b)
"describe"
(`Ok
(Cli.Describe
{
args =
{
context = (false, true);
output = None;
config_file = Fpath.v "config.ml";
context_file = Some (Fpath.v "config.json");
dry_run = false;
};
dotcmd = "dot";
dot = false;
eval = Some true;
}))
result
let test_clean () =
let extra_term =
Cmdliner.(
Term.(
const (fun xyz cde -> (xyz, cde))
$ Arg.(value (flag (info [ "x"; "xyz" ])))
$ Arg.(value (flag (info [ "c"; "cde" ])))))
in
let result =
eval ~configure:extra_term ~query:extra_term ~describe:extra_term
~clean:extra_term ~help:extra_term [| "name"; "clean" |] ~mname:"test"
in
Alcotest.(check result_b)
"clean"
(`Ok
(Cli.Clean
{
context = (false, false);
output = None;
config_file = Fpath.v "config.ml";
context_file = None;
dry_run = false;
}))
result
let test_help () =
let extra_term =
Cmdliner.(
Term.(
const (fun xyz cde -> (xyz, cde))
$ Arg.(value (flag (info [ "x"; "xyz" ])))
$ Arg.(value (flag (info [ "c"; "cde" ])))))
in
let null = Fmt.with_buffer (Buffer.create 10) in
let result =
eval ~help_ppf:null ~configure:extra_term ~query:extra_term
~describe:extra_term ~clean:extra_term ~help:extra_term ~mname:"test"
[| "name"; "help"; "--help"; "plain" |]
in
Alcotest.(check result_b) "help" `Help result
let test_default () =
let extra_term =
Cmdliner.(
Term.(
const (fun xyz cde -> (xyz, cde))
$ Arg.(value (flag (info [ "x"; "xyz" ])))
$ Arg.(value (flag (info [ "c"; "cde" ])))))
in
let null = Fmt.with_buffer (Buffer.create 10) in
let result =
eval ~help_ppf:null ~configure:extra_term ~query:extra_term
~describe:extra_term ~clean:extra_term ~help:extra_term ~mname:"test"
[| "name" |]
in
Alcotest.(check result_b) "default" `Help result
let test_read_full_eval () =
let check = Alcotest.(check @@ option bool) in
check "test" None (Cli.peek_full_eval [| "test" |]);
check "test --eval" (Some true) (Cli.peek_full_eval [| "test"; "--eval" |]);
check "test blah --eval blah" (Some true)
(Cli.peek_full_eval [| "test"; "blah"; "--eval"; "blah" |]);
check "test --no-eval" (Some false)
(Cli.peek_full_eval [| "test"; "--no-eval" |]);
check "test blah --no-eval blah" (Some false)
(Cli.peek_full_eval [| "test"; "blah"; "--no-eval"; "blah" |]);
check "--no-eval test --eval" (Some true)
(Cli.peek_full_eval [| "--no-eval"; "test"; "--eval" |]);
check "--eval test --no-eval" (Some false)
(Cli.peek_full_eval [| "--eval"; "test"; "--no-eval" |])
let suite =
[
("read_full_eval", `Quick, test_read_full_eval);
("configure", `Quick, test_configure);
("describe", `Quick, test_describe);
("clean", `Quick, test_clean);
("help", `Quick, test_help);
("default", `Quick, test_default);
]

View file

@ -0,0 +1 @@
val suite : unit Alcotest.test_case list

View file

@ -0,0 +1,93 @@
open Functoria
let x = Impl.v "Foo.Bar" Functoria.job
let y = Impl.v "X.Y" Functoria.(job @-> job) ~extra_deps:[ Impl.abstract x ]
let z = Impl.v "Bar" job ~extra_deps:[ Impl.abstract y ]
let z, y, x =
let g = Impl.abstract z in
let g = Impl.eval ~context:Context.empty g in
match Device.Graph.fold List.cons g [] with
| [ x; y; z ] -> (x, y, z)
| _ -> assert false
let var_name x = Device.Graph.var_name x
let impl_name x = Device.Graph.impl_name x
let ident s i = Fmt.str "%s__%d" s i
let test_var_name () =
Alcotest.(check string) "x" (ident "foo_bar" 1) (var_name x);
Alcotest.(check string) "y" (ident "x_y" 2) (var_name y);
Alcotest.(check string) "z" (ident "bar" 3) (var_name z)
let test_impl_name () =
Alcotest.(check string) "x" "Foo.Bar" (impl_name x);
Alcotest.(check string) "y" (ident "X_y" 2) (impl_name y);
Alcotest.(check string) "z" "Bar" (impl_name z)
let d1 = Device.v ~packages:[ package "a" ] "Foo.Bar" job
let d2 = Device.v ~packages:[ package "b" ] "Foo.Bar" job
let i1 = of_device d1
let i2 = of_device d2
let if1 = if_impl (Key.pure true) i1 i2
let if2 = if_impl (Key.pure true) i2 i1
let normalise_lines str =
let open Astring in
let lines = String.cuts ~empty:true ~sep:"\n" str in
let lines =
List.map
(fun line -> if String.for_all Char.Ascii.is_blank line then "" else line)
lines
in
String.concat ~sep:"\n" lines
let graph_str g = normalise_lines (Fmt.to_to_string Impl.pp_dot g)
let digraph i =
let j = i + 1 and k = i + 2 in
Fmt.str
{|digraph G {
ordering=out;
%d [label="foo_bar__%d\nFoo.Bar\n", shape="box"];
%d [label="foo_bar__%d\nFoo.Bar\n", shape="box"];
%d [label="If\n"];
%d -> %d [style="dotted", headport="n"];
%d -> %d [style="dotted", headport="n"];
%d -> %d [style="bold", style="dotted", headport="n"];
}|}
i i j j k k i k j k i
let test_graph () =
let t1 = Impl.abstract if1 in
Alcotest.(check string) "t1.dot" (digraph 1) (graph_str t1);
let t2 = Impl.abstract if2 in
Alcotest.(check string) "t2.dot" (digraph 1) (graph_str t2);
let module M = struct
type t = (string * string list) list
let empty = []
let union = List.append
end in
let packages t =
let ctx = Context.empty in
Impl.collect
(module M)
(function
| If _ | App -> []
| Dev d ->
let pkgs = Key.(eval ctx (Device.packages d)) in
List.map (fun pkg -> (Package.name pkg, Package.libraries pkg)) pkgs)
(Impl.simplify ~full:true ~context:ctx t)
in
let label = Alcotest.(list (pair string (list string))) in
Alcotest.(check label) "t1" [ ("a", [ "a" ]) ] (packages t1);
Alcotest.(check label) "t2" [ ("b", [ "b" ]) ] (packages t2)
let suite =
[
("var_name", `Quick, test_var_name);
("impl_name", `Quick, test_impl_name);
("test_graph", `Quick, test_graph);
]

View file

@ -0,0 +1 @@
val suite : unit Alcotest.test_case list

View file

@ -0,0 +1,123 @@
open Functoria
open Cmdliner
let key_a = Key.create "a" Key.Arg.(flag @@ Arg.info [ "a" ])
let key_b = Key.create "b" Key.Arg.(opt Arg.int 0 @@ Arg.info [ "b" ])
let key_c = Key.create "c" Key.Arg.(required Arg.string @@ Arg.info [ "c" ])
let key_d = Key.create "d" Key.Arg.(opt_all Arg.int @@ Arg.info [ "d" ])
let empty = Context.empty
let ( & ) (k, v) c = Key.add_to_context k v c
let ( && ) x y = x & y & empty
let test_eval () =
let context = (key_a, true) & (key_b, 0) && (key_c, Some "foo") in
let if_ = Key.if_ Key.(value key_a) "hello" "world" in
let r = Key.eval context if_ in
Alcotest.(check string) "if" "hello" r;
let match_1 =
Key.match_ Key.(value key_b) (function 0 -> "hello" | _ -> "world")
in
let r = Key.eval context match_1 in
Alcotest.(check string) "match 1" "hello" r;
let match_2 =
Key.match_
Key.(value key_c)
(function Some "foo" -> "hello" | _ -> "world")
in
let r = Key.eval context match_2 in
Alcotest.(check string) "match 1" "hello" r
let keys = Key.Set.of_list Key.[ v key_a; v key_b; v key_c; v key_d ]
let keys_no_required = Key.Set.of_list Key.[ v key_a; v key_b; v key_d ]
let eval f keys argv =
let argv = Array.of_list ("" :: argv) in
match
Cmdliner.Cmd.eval_value ~argv
(Cmdliner.Cmd.v (Cmdliner.Cmd.info "keys") (f keys))
with
| Error _ -> Alcotest.fail "Error"
| Ok (`Ok x) -> x
| Ok `Version -> Alcotest.fail "version"
| Ok `Help -> Alcotest.fail "help"
exception Error
let test_get () =
let context = eval Key.context keys [ "-a"; "-c"; "foo" ] in
Alcotest.(check bool) "get a" true (Key.get context key_a);
Alcotest.(check int) "get b" 0 (Key.get context key_b);
Alcotest.(check (option string)) "get c" (Some "foo") (Key.get context key_c);
let context = eval Key.context keys_no_required [ "-a" ] in
Alcotest.(check (option string))
"get c with_required:false" None (Key.get context key_c);
Alcotest.check_raises "get c with_required:true" Error (fun () ->
try ignore (eval Key.context keys [ "-a" ]) with _ -> raise Error)
let test_find () =
let context = eval Key.context keys_no_required [] in
Alcotest.(check (option bool)) "find a" None (Key.find context key_a);
Alcotest.(check (option int)) "find b" None (Key.find context key_b);
Alcotest.(check (option (option string)))
"find c" None (Key.find context key_c)
let test_merge () =
let cache = (key_a, true) && (key_c, Some "foo") in
let cli = (key_a, false) && (key_b, 2) in
let context = Context.merge ~default:cache cli in
Alcotest.(check bool) "merge a" false (Key.get context key_a);
Alcotest.(check int) "merge b" 2 (Key.get context key_b);
Alcotest.(check (option string))
"merge c" (Some "foo") (Key.get context key_c)
let key = Alcotest.testable Key.pp Key.equal
let test_equal () =
let module A = Arg in
let k1 = Key.(v @@ create "foo" Arg.(opt A.int 1 (A.info [ "foo" ]))) in
let k2 = Key.(v @@ create "foo" Arg.(opt A.int 2 (A.info [ "foo" ]))) in
let k3 = Key.(v @@ create "foo" Arg.(opt A.int 1 (A.info [ "foo" ]))) in
Alcotest.(check @@ neg key) "different defaults" k1 k2;
Alcotest.(check @@ key) "same defaults" k1 k3
let test_cmdliner () =
let module A = Arg in
let k1 = Key.(v @@ create "foo" Arg.(opt A.int 1 (A.info [ "foo" ]))) in
let k2 = Key.(v @@ create "foo" Arg.(opt A.int 2 (A.info [ "foo" ]))) in
let keys = Key.Set.of_list [ k1; k2 ] in
let context = Key.context keys in
let _ = eval (fun x -> x) context [] in
()
let test_opt_all () =
let context =
eval Key.context keys_no_required [ "-d"; "1"; "-d"; "2"; "-d"; "3" ]
in
Alcotest.(check (list int)) "get d" [ 1; 2; 3 ] (Key.get context key_d);
let context = eval Key.context keys_no_required [] in
Alcotest.(check (list int)) "get d" [] (Key.get context key_d);
match
Cmdliner.Cmd.eval_value ~argv:[| ""; "-d" |]
Cmdliner.(Cmd.v (Cmd.info "keys") (Key.context keys_no_required))
with
| Ok (`Ok _ | `Help | `Version) ->
Alcotest.failf "Invalid given command-line, eval must fail."
| Error _ -> Alcotest.(check pass) "invalid opt-all argument" () ()
let suite =
List.map
(fun (n, f) -> (n, `Quick, f))
[
("equal", test_equal);
("eval", test_eval);
("get", test_get);
("find", test_find);
("merge", test_merge);
("cmdliner", test_cmdliner);
("opt-all", test_opt_all);
]

View file

@ -0,0 +1 @@
val suite : unit Alcotest.test_case list

View file

@ -0,0 +1,54 @@
open Functoria
let w = Package.v ~min:"1.0" ~max:"2.0" "foo" ~scope:`Switch
let x = Package.v ~min:"1.0" ~max:"2.0" "foo"
let y = Package.v ~min:"0.9" ~max:"1.9" ~sublibs:[ "bar" ] "foo"
let z = Package.v "bar" ~sublibs:[ "foo" ] ~min:"42"
let xy =
match Package.merge x y with
| Some x -> x
| None -> Alcotest.fail "xy should not be None"
let test_package_merge () =
let () =
match Package.merge x z with
| Some _ -> Alcotest.fail "xz should be None"
| None -> ()
in
Alcotest.(check (list string))
"min" (Package.min_versions xy) [ "0.9"; "1.0" ];
Alcotest.(check (list string))
"max" (Package.max_versions xy) [ "1.9"; "2.0" ]
let test_package_pp () =
let str = Fmt.to_to_string Package.pp in
let str' = Fmt.to_to_string (Package.pp ~surround:"x") in
Alcotest.(check string)
"pp(x)" (str x) {|foo { ?monorepo & >= "1.0" & < "2.0" }|};
Alcotest.(check string)
"pp(xy)" (str xy)
{|foo { ?monorepo & >= "0.9" & >= "1.0" & < "1.9" & < "2.0" }|};
Alcotest.(check string) "pp(z)" (str z) {|bar { ?monorepo & >= "42" }|};
Alcotest.(check string)
"pp'(x)" (str' x) {|xfoox { ?monorepo & >= "1.0" & < "2.0" }|};
Alcotest.(check string) "pp(w)" (str w) {|foo { >= "1.0" & < "2.0" }|};
Alcotest.(check string) "key(x)" (Package.key x) "monorepo-foo";
Alcotest.(check string) "key(w)" (Package.key w) "switch-foo"
let test_invalid_package_names () =
let check_name_is_invalid name =
Alcotest.check_raises name
(Invalid_argument (Fmt.str "package name %S is invalid" name))
(fun () -> Package.v name |> ignore)
in
check_name_is_invalid "bar.subfoo";
check_name_is_invalid "000";
check_name_is_invalid "é"
let suite =
[
("merge", `Quick, test_package_merge);
("pp", `Quick, test_package_pp);
("invalid names", `Quick, test_invalid_package_names);
]

View file

@ -0,0 +1 @@
val suite : unit Alcotest.test_case list

View file

@ -0,0 +1,107 @@
let failed_to_parse_comments =
[
"(* not a name *)";
"not a comment";
"(* missing closing thingy";
"(* name2 >= bad version *)";
"(* name3 >= 1.2.3 && < 2.3.4 *)";
"(* name2 \n >= 1.2.3 & < 2.3.4 *)";
]
let test_failed_to_parse_comments () =
List.iter
(fun data ->
match Functoria.Tool.check_version ~name:"name" ~version:"1.2.3" data with
| Ok _ -> ()
| Error msg ->
Alcotest.fail
("expected comment parse failure (and an ok), but got error "
^ msg
^ " for "
^ data))
failed_to_parse_comments
let bad_comments =
[
"(* name >= 1.2.3";
"(* name >>= 1.2.3 *)";
"(* name > 1.2.3 *)";
"(* name >= 1.2.3 && < 2.3.4 *)";
"(* name >= 1.2.3 & >= 2.3.4 *)";
"(* name < 1.2.3 & < 2.3.4 *)";
]
let test_bad_comments () =
List.iter
(fun data ->
match Functoria.Tool.check_version ~name:"name" ~version:"1.2.3" data with
| Ok _ -> Alcotest.fail ("expected bad comment to be bad for " ^ data)
| Error _ -> ())
bad_comments
let good_comments =
[
"(* name >= 1.2.3 *)";
"(* name < 2.0.0 *)";
"(* name >= 1.0.0 & < 2.0.0 *)";
"(* name >= 1.0.0 *)";
"(* name >= 1.2 *)";
"(* name >= 1.0 & < 2.0 *)";
"(* name >= 1 & < 2 *)";
"(* name < 2.0 *)";
"(* name < 2 *)";
]
let test_good_comments () =
List.iter
(fun data ->
match Functoria.Tool.check_version ~name:"name" ~version:"1.2.3" data with
| Ok _ -> ()
| Error _ ->
Alcotest.fail
("expected good comment to be met for " ^ data ^ " at version 1.2.3"))
good_comments;
List.iter
(fun data ->
match Functoria.Tool.check_version ~name:"name" ~version:"1.3" data with
| Ok _ -> ()
| Error _ ->
Alcotest.fail
("expected good comment to be met for " ^ data ^ " at version 1.3"))
good_comments;
List.iter
(fun data ->
match
Functoria.Tool.check_version ~name:"name" ~version:"1.2.3-23-g453412"
data
with
| Ok _ -> ()
| Error _ ->
Alcotest.fail
("expected good comment to be met for " ^ data ^ " at version 1.3"))
good_comments
let unmet_comments =
[
"(* name >= 1.2.3 *)";
"(* name < 0.1.2 *)";
"(* name >= 1.0.0 & < 2.0.0 *)";
"(* name >= 1.0.0 *)";
]
let test_unmet_comments () =
List.iter
(fun data ->
match Functoria.Tool.check_version ~name:"name" ~version:"0.1.2" data with
| Ok _ ->
Alcotest.fail ("expected unmet comment to not be met for " ^ data)
| Error _ -> ())
unmet_comments
let suite =
[
("failed_to_parse comments", `Quick, test_failed_to_parse_comments);
("bad comment", `Quick, test_bad_comments);
("good comment", `Quick, test_good_comments);
("unmet comment", `Quick, test_unmet_comments);
]

View file

@ -0,0 +1 @@
val suite : unit Alcotest.test_case list

View file

@ -0,0 +1,4 @@
(test
(name test)
(package mirage)
(libraries alcotest mirage))

View file

@ -0,0 +1,10 @@
unix
====
hvt
===
Write to manifest.json (mode: default, purpose: Solo5 application manifest file)
Write to manifest.ml (0 bytes)

View file

@ -0,0 +1,31 @@
open Mirage
let context_singleton key value =
let info = Cmdliner.Cmd.info "" in
let term = Key.context (Key.Set.singleton @@ Key.v key) in
let argv = [| "mirage"; "--target"; value |] in
match Cmdliner.Cmd.eval_value ~argv (Cmdliner.Cmd.v info term) with
| Ok (`Ok x) -> x
| _ -> assert false
let print_banner s =
print_endline s;
print_endline @@ String.make (String.length s) '=';
print_newline ()
let info context =
Info.v ~packages:[] ~local_libs:[] ~keys:[] ~runtime_args:[]
~build_cmd:(fun sub ->
Fmt.str "make%a build"
Fmt.(option ~none:(any "") (any " " ++ Fpath.pp))
sub)
~context ~src:`None ~project_name:"test" "NAME"
let test target =
print_banner target;
let context = context_singleton Key.target target in
let env = Action.env ~files:(`Files []) () in
Action.dry_run_trace ~env @@ Project.configure @@ info context;
print_newline ()
let () = List.iter test [ "unix"; "hvt" ]

View file

@ -0,0 +1,5 @@
open Mirage
let device = generic_stackv4v6 default_network
let main = main ~pos:__POS__ "App" (stackv4v6 @-> job)
let () = register ~src:`None "describe" [ main $ device ]

View file

@ -0,0 +1,8 @@
(executable
(name config)
(modules config)
(libraries mirage))
(cram
(package mirage)
(deps config.exe))

View file

@ -0,0 +1,197 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Describe before configure (using defaults)
$ ./config.exe describe -t spt
Name describe
Keys dhcp=false (default),
net= (default),
target=spt
Describe before configure (no eval)
$ ./config.exe describe --no-eval --dot -o-
Name describe
Keys dhcp=false (default),
net= (default),
target=unix (default)
Output -digraph G {
ordering=out;
1 [label="tcpv4v6_socket__1\nTcpv4v6_socket\n", shape="box"];
2 [label="udpv4v6_socket__2\nUdpv4v6_socket\n", shape="box"];
3 [label="tcpip_stack_socket_v4v6__3\nTcpip_stack_socket.V4V6\n", shape="box"];
4 [label="netif__4\nNetif\n", shape="box"];
5 [label="netif__5\nNetif\n", shape="box"];
6 [label="If\ntarget"];
7 [label="netif__7\nNetif\n", shape="box"];
8 [label="netif__8\nNetif\n", shape="box"];
9 [label="If\ntarget"];
10 [label="netif__10\nNetif\n", shape="box"];
11 [label="netif__11\nNetif\n", shape="box"];
12 [label="If\ntarget"];
13 [label="netif__13\nNetif\n", shape="box"];
14 [label="netif__14\nNetif\n", shape="box"];
15 [label="If\ntarget"];
16 [label="netif__16\nNetif\n", shape="box"];
17 [label="netif__17\nNetif\n", shape="box"];
18 [label="If\ntarget"];
19 [label="netif__19\nNetif\n", shape="box"];
20 [label="netif__20\nNetif\n", shape="box"];
21 [label="If\ntarget"];
22 [label="netif__22\nNetif\n", shape="box"];
23 [label="netif__23\nNetif\n", shape="box"];
24 [label="If\ntarget"];
25 [label="netif__25\nNetif\n", shape="box"];
26 [label="netif__26\nNetif\n", shape="box"];
27 [label="If\ntarget"];
28 [label="If\ntarget"];
29 [label="ethernet_make__29\nEthernet.Make\n", shape="box"];
30 [label="ipv6_make__30\nIpv6.Make\n", shape="box"];
31 [label="arp_make__31\nArp.Make\n", shape="box"];
32 [label="qubes_db__32\nQubes.DB\n", shape="box"];
33 [label="qubesdb_ipv4_make__33\nQubesdb_ipv4.Make\n", shape="box"];
34 [label="dhcp_ipv4_make__34\nDhcp_ipv4.Make\n", shape="box"];
35 [label="static_ipv4_make__35\nStatic_ipv4.Make\n", shape="box"];
36 [label="If\ndhcp, net,\ntarget"];
37 [label="tcpip_stack_direct_ipv4v6__37\nTcpip_stack_direct.IPV4V6\n", shape="box"];
38 [label="tcp_flow_make__38\nTcp.Flow.Make\n", shape="box"];
39 [label="udp_make__39\nUdp.Make\n", shape="box"];
40 [label="icmpv4_make__40\nIcmpv4.Make\n", shape="box"];
41 [label="tcpip_stack_direct_makev4v6__41\nTcpip_stack_direct.MakeV4V6\n", shape="box"];
42 [label="If\ndhcp, net,\ntarget"];
43 [label="app__43\nApp\n", shape="box"];
44 [label="mirage_runtime__44\nMirage_runtime\n", shape="box"];
45 [label="mirage_crypto_rng_mirage__45\nMirage_crypto_rng_mirage\n", shape="box"];
46 [label="mirage_mtime__46\nMirage_mtime\n", shape="box"];
47 [label="mirage_mtime__47\nMirage_mtime\n", shape="box"];
48 [label="mirage_mtime__48\nMirage_mtime\n", shape="box"];
49 [label="If\ntarget"];
50 [label="If\ntarget"];
51 [label="mirage_ptime__51\nMirage_ptime\n", shape="box"];
52 [label="mirage_ptime__52\nMirage_ptime\n", shape="box"];
53 [label="mirage_ptime__53\nMirage_ptime\n", shape="box"];
54 [label="If\ntarget"];
55 [label="If\ntarget"];
56 [label="mirage_sleep__56\nMirage_sleep\n", shape="box"];
57 [label="mirage_sleep__57\nMirage_sleep\n", shape="box"];
58 [label="mirage_sleep__58\nMirage_sleep\n", shape="box"];
59 [label="If\ntarget"];
60 [label="If\ntarget"];
61 [label="mirage_logs__61\nMirage_logs\n", shape="box"];
62 [label="mirage_runtime__62\nMirage_runtime\n", shape="box"];
63 [label="cmdliner_stdlib__63\nCmdliner_stdlib\n", shape="box"];
64 [label="mirage_bootvar__64\nMirage_bootvar\n", shape="box"];
65 [label="mirage_bootvar__65\nMirage_bootvar\n", shape="box"];
66 [label="mirage_bootvar__66\nMirage_bootvar\n", shape="box"];
67 [label="If\ntarget"];
68 [label="struct_end__68\nstruct end\n", shape="box"];
69 [label="mirage_runtime__69\nMirage_runtime\ntarget", shape="box"];
3 -> 2 [style="dashed"];
3 -> 1 [style="dashed"];
6 -> 4 [style="dotted", headport="n"];
6 -> 5 [style="dotted", headport="n"];
6 -> 4 [style="bold", style="dotted", headport="n"];
9 -> 7 [style="dotted", headport="n"];
9 -> 8 [style="dotted", headport="n"];
9 -> 7 [style="bold", style="dotted", headport="n"];
12 -> 10 [style="dotted", headport="n"];
12 -> 11 [style="dotted", headport="n"];
12 -> 10 [style="bold", style="dotted", headport="n"];
15 -> 13 [style="dotted", headport="n"];
15 -> 14 [style="dotted", headport="n"];
15 -> 13 [style="bold", style="dotted", headport="n"];
18 -> 16 [style="dotted", headport="n"];
18 -> 17 [style="dotted", headport="n"];
18 -> 16 [style="bold", style="dotted", headport="n"];
21 -> 19 [style="dotted", headport="n"];
21 -> 20 [style="dotted", headport="n"];
21 -> 19 [style="bold", style="dotted", headport="n"];
24 -> 22 [style="dotted", headport="n"];
24 -> 23 [style="dotted", headport="n"];
24 -> 22 [style="bold", style="dotted", headport="n"];
27 -> 25 [style="dotted", headport="n"];
27 -> 26 [style="dotted", headport="n"];
27 -> 25 [style="bold", style="dotted", headport="n"];
28 -> 6 [style="dotted", headport="n"];
28 -> 9 [style="dotted", headport="n"];
28 -> 12 [style="dotted", headport="n"];
28 -> 15 [style="dotted", headport="n"];
28 -> 18 [style="dotted", headport="n"];
28 -> 21 [style="dotted", headport="n"];
28 -> 24 [style="dotted", headport="n"];
28 -> 27 [style="bold", style="dotted", headport="n"];
29 -> 28 [];
30 -> 28 [];
30 -> 29 [];
31 -> 29 [];
33 -> 32 [];
33 -> 29 [];
33 -> 31 [];
34 -> 28 [];
34 -> 29 [];
34 -> 31 [];
35 -> 29 [];
35 -> 31 [];
36 -> 33 [style="dotted", headport="n"];
36 -> 34 [style="dotted", headport="n"];
36 -> 35 [style="bold", style="dotted", headport="n"];
37 -> 36 [];
37 -> 30 [];
38 -> 37 [];
39 -> 37 [];
40 -> 36 [];
41 -> 28 [];
41 -> 29 [];
41 -> 31 [];
41 -> 37 [];
41 -> 40 [];
41 -> 39 [];
41 -> 38 [];
42 -> 3 [style="dotted", headport="n"];
42 -> 41 [style="bold", style="dotted", headport="n"];
43 -> 42 [];
49 -> 47 [style="dotted", headport="n"];
49 -> 48 [style="dotted", headport="n"];
49 -> 47 [style="bold", style="dotted", headport="n"];
50 -> 46 [style="dotted", headport="n"];
50 -> 49 [style="dotted", headport="n"];
50 -> 46 [style="bold", style="dotted", headport="n"];
54 -> 52 [style="dotted", headport="n"];
54 -> 53 [style="dotted", headport="n"];
54 -> 52 [style="bold", style="dotted", headport="n"];
55 -> 51 [style="dotted", headport="n"];
55 -> 54 [style="dotted", headport="n"];
55 -> 51 [style="bold", style="dotted", headport="n"];
59 -> 57 [style="dotted", headport="n"];
59 -> 58 [style="dotted", headport="n"];
59 -> 57 [style="bold", style="dotted", headport="n"];
60 -> 56 [style="dotted", headport="n"];
60 -> 59 [style="dotted", headport="n"];
60 -> 56 [style="bold", style="dotted", headport="n"];
67 -> 64 [style="dotted", headport="n"];
67 -> 64 [style="dotted", headport="n"];
67 -> 65 [style="dotted", headport="n"];
67 -> 65 [style="dotted", headport="n"];
67 -> 65 [style="dotted", headport="n"];
67 -> 65 [style="dotted", headport="n"];
67 -> 65 [style="dotted", headport="n"];
67 -> 66 [style="bold", style="dotted", headport="n"];
68 -> 67 [style="dashed"];
69 -> 68 [style="dashed"];
69 -> 63 [style="dashed"];
69 -> 62 [style="dashed"];
69 -> 61 [style="dashed"];
69 -> 60 [style="dashed"];
69 -> 55 [style="dashed"];
69 -> 50 [style="dashed"];
69 -> 45 [style="dashed"];
69 -> 44 [style="dashed"];
69 -> 43 [style="dashed"];
}
Describe after configure
$ echo "-txen" > context
$ ./config.exe describe --context-file=context
Name describe
Keys dhcp=false (default),
net= (default),
target=xen

View file

@ -0,0 +1,4 @@
(test
(name test)
(package mirage)
(libraries mirage alcotest))

View file

@ -0,0 +1,154 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Help clean --man-format=plain
$ ./config.exe help clean --man-format=plain | tee d1
NAME
mirage-clean - Clean the files produced by mirage for a given
application.
SYNOPSIS
mirage clean [OPTION]
DESCRIPTION
Clean the files produced by mirage for a given application.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage clean exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage clean:
MODE
See option --target.
SEE ALSO
mirage(1)
Help clean --help=plain
$ ./config.exe clean --help=plain | tee d2
NAME
mirage-clean - Clean the files produced by mirage for a given
application.
SYNOPSIS
mirage clean [OPTION]
DESCRIPTION
Clean the files produced by mirage for a given application.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage clean exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage clean:
MODE
See option --target.
SEE ALSO
mirage(1)
No difference
$ diff d1 d2

View file

@ -0,0 +1,4 @@
open Mirage
let main = main ~pos:__POS__ "App" (job @-> job)
let () = register "noop" [ main $ noop ]

View file

@ -0,0 +1,146 @@
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]...
DESCRIPTION
The configure command initializes a fresh mirage application.
UNIKERNEL PARAMETERS
-l LEVEL, --logs=LEVEL (absent MIRAGE_LOGS env)
Be more or less verbose. LEVEL must be of the form
*:info,foo:debug means that that the log threshold is set to info
for every log sources but the foo which is set to debug.
OCAML RUNTIME PARAMETERS
--allocation-policy=ALLOCATION (absent=next-fit)
The policy used for allocating in the OCaml heap. Possible values
are: next-fit, first-fit, best-fit. Best-fit is only supported
since OCaml 4.10.
--backtrace=BOOL (absent=true)
Trigger the printing of a stack backtrace when an uncaught
exception aborts the unikernel.
--custom-major-ratio=CUSTOM MAJOR RATIO
Target ratio of floating garbage to major heap size for
out-of-heap memory held by custom values. Default: 44.
--custom-minor-max-size=CUSTOM MINOR MAX SIZE
Maximum amount of out-of-heap memory for each custom value
allocated in the minor heap. Default: 8192 bytes.
--custom-minor-ratio=CUSTOM MINOR RATIO
Bound on floating garbage for out-of-heap memory held by custom
values in the minor heap. Default: 100.
--gc-verbosity=VERBOSITY
GC messages on standard error output. Sum of flags. Check GC
module documentation for details.
--gc-window-size=WINDOW SIZE
The size of the window used by the major GC for smoothing out
variations in its workload. Between 1 adn 50, default: 1.
--major-heap-increment=MAJOR INCREMENT
The size increment for the major heap (in words). If less than or
equal 1000, it is a percentage of the current heap size. If more
than 1000, it is a fixed number of words. Default: 15.
--max-space-overhead=MAX SPACE OVERHEAD
Heap compaction is triggered when the estimated amount of wasted
memory exceeds this (percentage of live data). If above 1000000,
compaction is never triggered. Default: 500.
--minor-heap-size=MINOR SIZE
The size of the minor heap (in words). Default: 256k.
--randomize-hashtables=BOOL (absent=true)
Turn on randomization of all hash tables by default.
--space-overhead=SPACE OVERHEAD
The percentage of live data of wasted memory, due to GC does not
immediately collect unreachable blocks. The major GC speed is
computed from this parameter, it will work more if smaller.
Default: 80.
MIRAGE PARAMETERS
-g Enables target-specific support for debugging. Supported targets:
hvt (compiles solo5-hvt with GDB server support).
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
xen, qubes, unix, macosx, virtio, hvt, spt, muen, genode.
--warn-error
Enable -warn-error when compiling OCaml sources.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repo[=URL] (default=)
(absent=https://github.com/mirage/opam-overlays.git or
MIRAGE_EXTRA_REPO env)
Additional opam-repository to use when using `opam monorepo lock'
to gather local sources. Default:
https://github.com/mirage/opam-overlays.git.Use the option without
any content to disable it.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
-o FILE, --output=FILE
Name of the output file.
APPLICATION OPTIONS
--hello=VAL (absent=Hello World!)
How to say hello.
OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of `auto', `always' or
`never'.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of `quiet', `error',
`warning', `info' or `debug'. Takes over -v.
ENVIRONMENT
These environment variables affect the execution of configure:
MIRAGE_EXTRA_REPO
See option --extra-repo.
MIRAGE_LOGS
See option --logs.
MODE
See option --target.

View file

@ -0,0 +1,146 @@
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]...
DESCRIPTION
The configure command initializes a fresh mirage application.
UNIKERNEL PARAMETERS
-l LEVEL, --logs=LEVEL (absent MIRAGE_LOGS env)
Be more or less verbose. LEVEL must be of the form
*:info,foo:debug means that that the log threshold is set to info
for every log sources but the foo which is set to debug.
OCAML RUNTIME PARAMETERS
--allocation-policy=ALLOCATION (absent=next-fit)
The policy used for allocating in the OCaml heap. Possible values
are: next-fit, first-fit, best-fit. Best-fit is only supported
since OCaml 4.10.
--backtrace=BOOL (absent=true)
Trigger the printing of a stack backtrace when an uncaught
exception aborts the unikernel.
--custom-major-ratio=CUSTOM MAJOR RATIO
Target ratio of floating garbage to major heap size for
out-of-heap memory held by custom values. Default: 44.
--custom-minor-max-size=CUSTOM MINOR MAX SIZE
Maximum amount of out-of-heap memory for each custom value
allocated in the minor heap. Default: 8192 bytes.
--custom-minor-ratio=CUSTOM MINOR RATIO
Bound on floating garbage for out-of-heap memory held by custom
values in the minor heap. Default: 100.
--gc-verbosity=VERBOSITY
GC messages on standard error output. Sum of flags. Check GC
module documentation for details.
--gc-window-size=WINDOW SIZE
The size of the window used by the major GC for smoothing out
variations in its workload. Between 1 adn 50, default: 1.
--major-heap-increment=MAJOR INCREMENT
The size increment for the major heap (in words). If less than or
equal 1000, it is a percentage of the current heap size. If more
than 1000, it is a fixed number of words. Default: 15.
--max-space-overhead=MAX SPACE OVERHEAD
Heap compaction is triggered when the estimated amount of wasted
memory exceeds this (percentage of live data). If above 1000000,
compaction is never triggered. Default: 500.
--minor-heap-size=MINOR SIZE
The size of the minor heap (in words). Default: 256k.
--randomize-hashtables=BOOL (absent=true)
Turn on randomization of all hash tables by default.
--space-overhead=SPACE OVERHEAD
The percentage of live data of wasted memory, due to GC does not
immediately collect unreachable blocks. The major GC speed is
computed from this parameter, it will work more if smaller.
Default: 80.
MIRAGE PARAMETERS
-g Enables target-specific support for debugging. Supported targets:
hvt (compiles solo5-hvt with GDB server support).
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
xen, qubes, unix, macosx, virtio, hvt, spt, muen, genode.
--warn-error
Enable -warn-error when compiling OCaml sources.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repo[=URL] (default=)
(absent=https://github.com/mirage/opam-overlays.git or
MIRAGE_EXTRA_REPO env)
Additional opam-repository to use when using `opam monorepo lock'
to gather local sources. Default:
https://github.com/mirage/opam-overlays.git.Use the option without
any content to disable it.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
-o FILE, --output=FILE
Name of the output file.
APPLICATION OPTIONS
--hello=VAL (absent=Hello World!)
How to say hello.
OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of `auto', `always' or
`never'.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of `quiet', `error',
`warning', `info' or `debug'. Takes over -v.
ENVIRONMENT
These environment variables affect the execution of configure:
MIRAGE_EXTRA_REPO
See option --extra-repo.
MIRAGE_LOGS
See option --logs.
MODE
See option --target.

View file

@ -0,0 +1,192 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Help configure -o --man-format=plain
$ ./config.exe help configure -o foo --man-format=plain | tee d1
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]
DESCRIPTION
The configure command initializes a fresh mirage application.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repos=NAME1:URL1,NAME2:URL2,...
(absent=opam-overlays:https://github.com/dune-universe/opam-overlays.git,mirage-overlays:https://github.com/dune-universe/mirage-opam-overlays.git
or MIRAGE_EXTRA_REPOS env)
Additional opam-repositories to use when using `opam monorepo
lock' to gather local sources. Default:
https://github.com/dune-universe/opam-overlays.git &
https://github.com/dune-universe/mirage-opam-overlays.git.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
--no-extra-repo
Disable the use of any overlay repository.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage configure exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage configure:
MIRAGE_EXTRA_REPOS
See option --extra-repos.
MODE
See option --target.
SEE ALSO
mirage(1)
Help configure -o --help=plain
$ ./config.exe configure -o foo --help=plain | tee d2
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]
DESCRIPTION
The configure command initializes a fresh mirage application.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repos=NAME1:URL1,NAME2:URL2,...
(absent=opam-overlays:https://github.com/dune-universe/opam-overlays.git,mirage-overlays:https://github.com/dune-universe/mirage-opam-overlays.git
or MIRAGE_EXTRA_REPOS env)
Additional opam-repositories to use when using `opam monorepo
lock' to gather local sources. Default:
https://github.com/dune-universe/opam-overlays.git &
https://github.com/dune-universe/mirage-opam-overlays.git.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
--no-extra-repo
Disable the use of any overlay repository.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage configure exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage configure:
MIRAGE_EXTRA_REPOS
See option --extra-repos.
MODE
See option --target.
SEE ALSO
mirage(1)
No difference
$ diff d1 d2

View file

@ -0,0 +1,192 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Help configure --man-format=plain
$ ./config.exe help configure --man-format=plain | tee d1
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]
DESCRIPTION
The configure command initializes a fresh mirage application.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repos=NAME1:URL1,NAME2:URL2,...
(absent=opam-overlays:https://github.com/dune-universe/opam-overlays.git,mirage-overlays:https://github.com/dune-universe/mirage-opam-overlays.git
or MIRAGE_EXTRA_REPOS env)
Additional opam-repositories to use when using `opam monorepo
lock' to gather local sources. Default:
https://github.com/dune-universe/opam-overlays.git &
https://github.com/dune-universe/mirage-opam-overlays.git.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
--no-extra-repo
Disable the use of any overlay repository.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage configure exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage configure:
MIRAGE_EXTRA_REPOS
See option --extra-repos.
MODE
See option --target.
SEE ALSO
mirage(1)
Configure help --help=plain
$ ./config.exe configure --help=plain | tee d2
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]
DESCRIPTION
The configure command initializes a fresh mirage application.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repos=NAME1:URL1,NAME2:URL2,...
(absent=opam-overlays:https://github.com/dune-universe/opam-overlays.git,mirage-overlays:https://github.com/dune-universe/mirage-opam-overlays.git
or MIRAGE_EXTRA_REPOS env)
Additional opam-repositories to use when using `opam monorepo
lock' to gather local sources. Default:
https://github.com/dune-universe/opam-overlays.git &
https://github.com/dune-universe/mirage-opam-overlays.git.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
--no-extra-repo
Disable the use of any overlay repository.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage configure exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage configure:
MIRAGE_EXTRA_REPOS
See option --extra-repos.
MODE
See option --target.
SEE ALSO
mirage(1)
No difference
$ diff d1 d2

View file

@ -0,0 +1,216 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Help describe --man-format=plain
$ ./config.exe help describe --man-format=plain | tee d1
NAME
mirage-describe - Describe a mirage application.
SYNOPSIS
mirage describe [OPTION]
DESCRIPTION
The describe command describes the configuration of a mirage
application.
The dot output contains the following elements:
If vertices
Represented as circles. Branches are dotted, and the default
branch is in bold.
Configurables
Represented as rectangles. The order of the output arrows is the
order of the functor arguments.
Data dependencies
Represented as dashed arrows.
App vertices
Represented as diamonds. The bold arrow is the functor part.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
DESCRIBE OPTIONS
--dot
Output a dot description. If no output file is given, it will
display the dot file using the command given to --dot-command. Use
in combination with --output=- (short version: -o-) to display the
dot file on stdout.
--dot-command=COMMAND (absent=xdot)
Command used to show a dot file. This command should accept a dot
file on its standard input.
--eval
Fully evaluate the graph before showing it. The default when the
unikernel has already been configured.
--no-eval
Do not evaluate the graph before showing it. See --eval. The
default when the unikernel has not been configured.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage describe exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage describe:
MODE
See option --target.
SEE ALSO
mirage(1)
Help describe --help=plain
$ ./config.exe describe --help=plain | tee d2
NAME
mirage-describe - Describe a mirage application.
SYNOPSIS
mirage describe [OPTION]
DESCRIPTION
The describe command describes the configuration of a mirage
application.
The dot output contains the following elements:
If vertices
Represented as circles. Branches are dotted, and the default
branch is in bold.
Configurables
Represented as rectangles. The order of the output arrows is the
order of the functor arguments.
Data dependencies
Represented as dashed arrows.
App vertices
Represented as diamonds. The bold arrow is the functor part.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
DESCRIBE OPTIONS
--dot
Output a dot description. If no output file is given, it will
display the dot file using the command given to --dot-command. Use
in combination with --output=- (short version: -o-) to display the
dot file on stdout.
--dot-command=COMMAND (absent=xdot)
Command used to show a dot file. This command should accept a dot
file on its standard input.
--eval
Fully evaluate the graph before showing it. The default when the
unikernel has already been configured.
--no-eval
Do not evaluate the graph before showing it. See --eval. The
default when the unikernel has not been configured.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage describe exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage describe:
MODE
See option --target.
SEE ALSO
mirage(1)
No difference
$ diff d1 d2

View file

@ -0,0 +1,7 @@
(executable
(name config)
(libraries mirage))
(cram
(package mirage)
(deps config.exe))

View file

@ -0,0 +1,204 @@
(rule
(target help-configure)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe help configure --man-format=plain)))))
(rule
(target configure-help)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe configure --help=plain)))))
(rule
(alias runtest)
(package mirage)
(action
(diff help-configure.expected help-configure)))
(rule
(alias runtest)
(package mirage)
(action
(diff configure-help.expected configure-help)))
(rule
(alias runtest)
(package mirage)
(action
(diff configure-help help-configure)))
(rule
(target help-configure-o)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe help configure -o foo --man-format=plain)))))
(rule
(target configure-o-help)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe configure -o foo --help=plain)))))
(rule
(alias runtest)
(package mirage)
(action
(diff help-configure-o.expected help-configure-o)))
(rule
(alias runtest)
(package mirage)
(action
(diff configure-o-help.expected configure-o-help)))
(rule
(alias runtest)
(package mirage)
(action
(diff configure-o-help help-configure-o)))
(rule
(target help-build)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe help build --man-format=plain)))))
(rule
(target build-help)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe build --help=plain)))))
(rule
(alias runtest)
(package mirage)
(action
(diff help-build.expected help-build)))
(rule
(alias runtest)
(package mirage)
(action
(diff build-help.expected build-help)))
(rule
(alias runtest)
(package mirage)
(action
(diff build-help help-build)))
(rule
(target help-clean)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe help clean --man-format=plain)))))
(rule
(target clean-help)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe clean --help=plain)))))
(rule
(alias runtest)
(package mirage)
(action
(diff help-clean.expected help-clean)))
(rule
(alias runtest)
(package mirage)
(action
(diff clean-help.expected clean-help)))
(rule
(alias runtest)
(package mirage)
(action
(diff clean-help help-clean)))
(rule
(target help-query)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe help query --man-format=plain)))))
(rule
(target query-help)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe query --help=plain)))))
(rule
(alias runtest)
(package mirage)
(action
(diff help-query.expected help-query)))
(rule
(alias runtest)
(package mirage)
(action
(diff query-help.expected query-help)))
(rule
(alias runtest)
(package mirage)
(action
(diff query-help help-query)))
(rule
(target help-describe)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe help describe --man-format=plain)))))
(rule
(target describe-help)
(action
(with-stdout-to
%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe describe --help=plain)))))
(rule
(alias runtest)
(package mirage)
(action
(diff help-describe.expected help-describe)))
(rule
(alias runtest)
(package mirage)
(action
(diff describe-help.expected describe-help)))
(rule
(alias runtest)
(package mirage)
(action
(diff describe-help help-describe)))

View file

@ -0,0 +1,53 @@
type t = { file : string; cmd : string }
let v x = { file = x; cmd = x }
let gen t =
Format.printf
{|
(rule
(target help-%s)
(action
(with-stdout-to
%%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe help %s --man-format=plain)))))
(rule
(target %s-help)
(action
(with-stdout-to
%%{target}
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe %s --help=plain)))))
(rule
(alias runtest)
(package mirage)
(action
(diff help-%s.expected help-%s)))
(rule
(alias runtest)
(package mirage)
(action
(diff %s-help.expected %s-help)))
(rule
(alias runtest)
(package mirage)
(action
(diff %s-help help-%s)))
|}
t.file t.cmd t.file t.cmd t.file t.file t.file t.file t.file t.file
let () =
List.iter gen
[
v "configure";
{ file = "configure-o"; cmd = "configure -o foo" };
v "build";
v "clean";
v "query";
v "describe";
]

View file

@ -0,0 +1,146 @@
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]...
DESCRIPTION
The configure command initializes a fresh mirage application.
UNIKERNEL PARAMETERS
-l LEVEL, --logs=LEVEL (absent MIRAGE_LOGS env)
Be more or less verbose. LEVEL must be of the form
*:info,foo:debug means that that the log threshold is set to info
for every log sources but the foo which is set to debug.
OCAML RUNTIME PARAMETERS
--allocation-policy=ALLOCATION (absent=next-fit)
The policy used for allocating in the OCaml heap. Possible values
are: next-fit, first-fit, best-fit. Best-fit is only supported
since OCaml 4.10.
--backtrace=BOOL (absent=true)
Trigger the printing of a stack backtrace when an uncaught
exception aborts the unikernel.
--custom-major-ratio=CUSTOM MAJOR RATIO
Target ratio of floating garbage to major heap size for
out-of-heap memory held by custom values. Default: 44.
--custom-minor-max-size=CUSTOM MINOR MAX SIZE
Maximum amount of out-of-heap memory for each custom value
allocated in the minor heap. Default: 8192 bytes.
--custom-minor-ratio=CUSTOM MINOR RATIO
Bound on floating garbage for out-of-heap memory held by custom
values in the minor heap. Default: 100.
--gc-verbosity=VERBOSITY
GC messages on standard error output. Sum of flags. Check GC
module documentation for details.
--gc-window-size=WINDOW SIZE
The size of the window used by the major GC for smoothing out
variations in its workload. Between 1 adn 50, default: 1.
--major-heap-increment=MAJOR INCREMENT
The size increment for the major heap (in words). If less than or
equal 1000, it is a percentage of the current heap size. If more
than 1000, it is a fixed number of words. Default: 15.
--max-space-overhead=MAX SPACE OVERHEAD
Heap compaction is triggered when the estimated amount of wasted
memory exceeds this (percentage of live data). If above 1000000,
compaction is never triggered. Default: 500.
--minor-heap-size=MINOR SIZE
The size of the minor heap (in words). Default: 256k.
--randomize-hashtables=BOOL (absent=true)
Turn on randomization of all hash tables by default.
--space-overhead=SPACE OVERHEAD
The percentage of live data of wasted memory, due to GC does not
immediately collect unreachable blocks. The major GC speed is
computed from this parameter, it will work more if smaller.
Default: 80.
MIRAGE PARAMETERS
-g Enables target-specific support for debugging. Supported targets:
hvt (compiles solo5-hvt with GDB server support).
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
xen, qubes, unix, macosx, virtio, hvt, spt, muen, genode.
--warn-error
Enable -warn-error when compiling OCaml sources.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repo[=URL] (default=)
(absent=https://github.com/mirage/opam-overlays.git or
MIRAGE_EXTRA_REPO env)
Additional opam-repository to use when using `opam monorepo lock'
to gather local sources. Default:
https://github.com/mirage/opam-overlays.git.Use the option without
any content to disable it.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
-o FILE, --output=FILE
Name of the output file.
APPLICATION OPTIONS
--hello=VAL (absent=Hello World!)
How to say hello.
OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of `auto', `always' or
`never'.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of `quiet', `error',
`warning', `info' or `debug'. Takes over -v.
ENVIRONMENT
These environment variables affect the execution of configure:
MIRAGE_EXTRA_REPO
See option --extra-repo.
MIRAGE_LOGS
See option --logs.
MODE
See option --target.

View file

@ -0,0 +1,146 @@
NAME
mirage-configure - Configure a mirage application.
SYNOPSIS
mirage configure [OPTION]...
DESCRIPTION
The configure command initializes a fresh mirage application.
UNIKERNEL PARAMETERS
-l LEVEL, --logs=LEVEL (absent MIRAGE_LOGS env)
Be more or less verbose. LEVEL must be of the form
*:info,foo:debug means that that the log threshold is set to info
for every log sources but the foo which is set to debug.
OCAML RUNTIME PARAMETERS
--allocation-policy=ALLOCATION (absent=next-fit)
The policy used for allocating in the OCaml heap. Possible values
are: next-fit, first-fit, best-fit. Best-fit is only supported
since OCaml 4.10.
--backtrace=BOOL (absent=true)
Trigger the printing of a stack backtrace when an uncaught
exception aborts the unikernel.
--custom-major-ratio=CUSTOM MAJOR RATIO
Target ratio of floating garbage to major heap size for
out-of-heap memory held by custom values. Default: 44.
--custom-minor-max-size=CUSTOM MINOR MAX SIZE
Maximum amount of out-of-heap memory for each custom value
allocated in the minor heap. Default: 8192 bytes.
--custom-minor-ratio=CUSTOM MINOR RATIO
Bound on floating garbage for out-of-heap memory held by custom
values in the minor heap. Default: 100.
--gc-verbosity=VERBOSITY
GC messages on standard error output. Sum of flags. Check GC
module documentation for details.
--gc-window-size=WINDOW SIZE
The size of the window used by the major GC for smoothing out
variations in its workload. Between 1 adn 50, default: 1.
--major-heap-increment=MAJOR INCREMENT
The size increment for the major heap (in words). If less than or
equal 1000, it is a percentage of the current heap size. If more
than 1000, it is a fixed number of words. Default: 15.
--max-space-overhead=MAX SPACE OVERHEAD
Heap compaction is triggered when the estimated amount of wasted
memory exceeds this (percentage of live data). If above 1000000,
compaction is never triggered. Default: 500.
--minor-heap-size=MINOR SIZE
The size of the minor heap (in words). Default: 256k.
--randomize-hashtables=BOOL (absent=true)
Turn on randomization of all hash tables by default.
--space-overhead=SPACE OVERHEAD
The percentage of live data of wasted memory, due to GC does not
immediately collect unreachable blocks. The major GC speed is
computed from this parameter, it will work more if smaller.
Default: 80.
MIRAGE PARAMETERS
-g Enables target-specific support for debugging. Supported targets:
hvt (compiles solo5-hvt with GDB server support).
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
xen, qubes, unix, macosx, virtio, hvt, spt, muen, genode.
--warn-error
Enable -warn-error when compiling OCaml sources.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--depext
Enable call to `opam depext' in the project Makefile.
--dry-run
Display I/O actions instead of executing them.
--extra-repo[=URL] (default=)
(absent=https://github.com/mirage/opam-overlays.git or
MIRAGE_EXTRA_REPO env)
Additional opam-repository to use when using `opam monorepo lock'
to gather local sources. Default:
https://github.com/mirage/opam-overlays.git.Use the option without
any content to disable it.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
--no-depext
Disable call to `opam depext' in the project Makefile.
-o FILE, --output=FILE
Name of the output file.
APPLICATION OPTIONS
--hello=VAL (absent=Hello World!)
How to say hello.
OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of `auto', `always' or
`never'.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of `quiet', `error',
`warning', `info' or `debug'. Takes over -v.
ENVIRONMENT
These environment variables affect the execution of configure:
MIRAGE_EXTRA_REPO
See option --extra-repo.
MIRAGE_LOGS
See option --logs.
MODE
See option --target.

View file

@ -0,0 +1,155 @@
NAME
mirage-query - Query information about the mirage application.
SYNOPSIS
mirage query [OPTION]... [INFO]
DESCRIPTION
The query command queries information about the mirage application.
UNIKERNEL PARAMETERS
-l LEVEL, --logs=LEVEL (absent MIRAGE_LOGS env)
Be more or less verbose. LEVEL must be of the form
*:info,foo:debug means that that the log threshold is set to info
for every log sources but the foo which is set to debug.
QUERY OPTIONS
--build-dir=DIR
The build directory.
--depext
Enable call to `opam depext' in the project Makefile.
--extra-repo[=URL] (default=)
(absent=https://github.com/mirage/opam-overlays.git or
MIRAGE_EXTRA_REPO env)
Additional opam-repository to use when using `opam monorepo lock'
to gather local sources. Default:
https://github.com/mirage/opam-overlays.git.Use the option without
any content to disable it.
--no-depext
Disable call to `opam depext' in the project Makefile.
OCAML RUNTIME PARAMETERS
--allocation-policy=ALLOCATION (absent=next-fit)
The policy used for allocating in the OCaml heap. Possible values
are: next-fit, first-fit, best-fit. Best-fit is only supported
since OCaml 4.10.
--backtrace=BOOL (absent=true)
Trigger the printing of a stack backtrace when an uncaught
exception aborts the unikernel.
--custom-major-ratio=CUSTOM MAJOR RATIO
Target ratio of floating garbage to major heap size for
out-of-heap memory held by custom values. Default: 44.
--custom-minor-max-size=CUSTOM MINOR MAX SIZE
Maximum amount of out-of-heap memory for each custom value
allocated in the minor heap. Default: 8192 bytes.
--custom-minor-ratio=CUSTOM MINOR RATIO
Bound on floating garbage for out-of-heap memory held by custom
values in the minor heap. Default: 100.
--gc-verbosity=VERBOSITY
GC messages on standard error output. Sum of flags. Check GC
module documentation for details.
--gc-window-size=WINDOW SIZE
The size of the window used by the major GC for smoothing out
variations in its workload. Between 1 adn 50, default: 1.
--major-heap-increment=MAJOR INCREMENT
The size increment for the major heap (in words). If less than or
equal 1000, it is a percentage of the current heap size. If more
than 1000, it is a fixed number of words. Default: 15.
--max-space-overhead=MAX SPACE OVERHEAD
Heap compaction is triggered when the estimated amount of wasted
memory exceeds this (percentage of live data). If above 1000000,
compaction is never triggered. Default: 500.
--minor-heap-size=MINOR SIZE
The size of the minor heap (in words). Default: 256k.
--randomize-hashtables=BOOL (absent=true)
Turn on randomization of all hash tables by default.
--space-overhead=SPACE OVERHEAD
The percentage of live data of wasted memory, due to GC does not
immediately collect unreachable blocks. The major GC speed is
computed from this parameter, it will work more if smaller.
Default: 80.
MIRAGE PARAMETERS
-g Enables target-specific support for debugging. Supported targets:
hvt (compiles solo5-hvt with GDB server support).
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
xen, qubes, unix, macosx, virtio, hvt, spt, muen, genode.
--warn-error
Enable -warn-error when compiling OCaml sources.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
INFO (absent=packages)
The information to query. INFO must be one of `name', `packages',
`monorepo.opam', `switch.opam', `files', `Makefile', `dune-base',
`dune', `dune-project', `dune-workspace' or `dune-dist'
APPLICATION OPTIONS
--hello=VAL (absent=Hello World!)
How to say hello.
OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of `auto', `always' or
`never'.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of `quiet', `error',
`warning', `info' or `debug'. Takes over -v.
ENVIRONMENT
These environment variables affect the execution of query:
MIRAGE_EXTRA_REPO
See option --extra-repo.
MIRAGE_LOGS
See option --logs.
MODE
See option --target.

View file

@ -0,0 +1,155 @@
NAME
mirage-query - Query information about the mirage application.
SYNOPSIS
mirage query [OPTION]... [INFO]
DESCRIPTION
The query command queries information about the mirage application.
UNIKERNEL PARAMETERS
-l LEVEL, --logs=LEVEL (absent MIRAGE_LOGS env)
Be more or less verbose. LEVEL must be of the form
*:info,foo:debug means that that the log threshold is set to info
for every log sources but the foo which is set to debug.
QUERY OPTIONS
--build-dir=DIR
The build directory.
--depext
Enable call to `opam depext' in the project Makefile.
--extra-repo[=URL] (default=)
(absent=https://github.com/mirage/opam-overlays.git or
MIRAGE_EXTRA_REPO env)
Additional opam-repository to use when using `opam monorepo lock'
to gather local sources. Default:
https://github.com/mirage/opam-overlays.git.Use the option without
any content to disable it.
--no-depext
Disable call to `opam depext' in the project Makefile.
OCAML RUNTIME PARAMETERS
--allocation-policy=ALLOCATION (absent=next-fit)
The policy used for allocating in the OCaml heap. Possible values
are: next-fit, first-fit, best-fit. Best-fit is only supported
since OCaml 4.10.
--backtrace=BOOL (absent=true)
Trigger the printing of a stack backtrace when an uncaught
exception aborts the unikernel.
--custom-major-ratio=CUSTOM MAJOR RATIO
Target ratio of floating garbage to major heap size for
out-of-heap memory held by custom values. Default: 44.
--custom-minor-max-size=CUSTOM MINOR MAX SIZE
Maximum amount of out-of-heap memory for each custom value
allocated in the minor heap. Default: 8192 bytes.
--custom-minor-ratio=CUSTOM MINOR RATIO
Bound on floating garbage for out-of-heap memory held by custom
values in the minor heap. Default: 100.
--gc-verbosity=VERBOSITY
GC messages on standard error output. Sum of flags. Check GC
module documentation for details.
--gc-window-size=WINDOW SIZE
The size of the window used by the major GC for smoothing out
variations in its workload. Between 1 adn 50, default: 1.
--major-heap-increment=MAJOR INCREMENT
The size increment for the major heap (in words). If less than or
equal 1000, it is a percentage of the current heap size. If more
than 1000, it is a fixed number of words. Default: 15.
--max-space-overhead=MAX SPACE OVERHEAD
Heap compaction is triggered when the estimated amount of wasted
memory exceeds this (percentage of live data). If above 1000000,
compaction is never triggered. Default: 500.
--minor-heap-size=MINOR SIZE
The size of the minor heap (in words). Default: 256k.
--randomize-hashtables=BOOL (absent=true)
Turn on randomization of all hash tables by default.
--space-overhead=SPACE OVERHEAD
The percentage of live data of wasted memory, due to GC does not
immediately collect unreachable blocks. The major GC speed is
computed from this parameter, it will work more if smaller.
Default: 80.
MIRAGE PARAMETERS
-g Enables target-specific support for debugging. Supported targets:
hvt (compiles solo5-hvt with GDB server support).
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
xen, qubes, unix, macosx, virtio, hvt, spt, muen, genode.
--warn-error
Enable -warn-error when compiling OCaml sources.
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
INFO (absent=packages)
The information to query. INFO must be one of `name', `packages',
`monorepo.opam', `switch.opam', `files', `Makefile', `dune-base',
`dune', `dune-project', `dune-workspace' or `dune-dist'
APPLICATION OPTIONS
--hello=VAL (absent=Hello World!)
How to say hello.
OPTIONS
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto',
`pager', `groff' or `plain'. With `auto', the format is `pager` or
`plain' whenever the TERM env var is `dumb' or undefined.
--version
Show version information.
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of `auto', `always' or
`never'.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of `quiet', `error',
`warning', `info' or `debug'. Takes over -v.
ENVIRONMENT
These environment variables affect the execution of query:
MIRAGE_EXTRA_REPO
See option --extra-repo.
MIRAGE_LOGS
See option --logs.
MODE
See option --target.

View file

@ -0,0 +1,204 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Help query --man-format=plain
$ ./config.exe help query --man-format=plain | tee d1
NAME
mirage-query - Query information about the mirage application.
SYNOPSIS
mirage query [OPTION] [INFO]
DESCRIPTION
The query command queries information about the mirage application.
QUERY OPTIONS
--depext
Enable call to `opam depext' in the project Makefile.
--extra-repos=NAME1:URL1,NAME2:URL2,...
(absent=opam-overlays:https://github.com/dune-universe/opam-overlays.git,mirage-overlays:https://github.com/dune-universe/mirage-opam-overlays.git
or MIRAGE_EXTRA_REPOS env)
Additional opam-repositories to use when using `opam monorepo
lock' to gather local sources. Default:
https://github.com/dune-universe/opam-overlays.git &
https://github.com/dune-universe/mirage-opam-overlays.git.
--no-depext
Disable call to `opam depext' in the project Makefile.
--no-extra-repo
Disable the use of any overlay repository.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
INFO (absent=packages)
The information to query. INFO must be one of 'name', 'packages',
'opam', 'files', 'Makefile', 'dune.config', 'dune.build',
'dune-project', 'dune-workspace' or 'dune.dist'
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage query exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage query:
MIRAGE_EXTRA_REPOS
See option --extra-repos.
MODE
See option --target.
SEE ALSO
mirage(1)
Help query --help=plain
$ ./config.exe query --help=plain | tee d2
NAME
mirage-query - Query information about the mirage application.
SYNOPSIS
mirage query [OPTION] [INFO]
DESCRIPTION
The query command queries information about the mirage application.
QUERY OPTIONS
--depext
Enable call to `opam depext' in the project Makefile.
--extra-repos=NAME1:URL1,NAME2:URL2,...
(absent=opam-overlays:https://github.com/dune-universe/opam-overlays.git,mirage-overlays:https://github.com/dune-universe/mirage-opam-overlays.git
or MIRAGE_EXTRA_REPOS env)
Additional opam-repositories to use when using `opam monorepo
lock' to gather local sources. Default:
https://github.com/dune-universe/opam-overlays.git &
https://github.com/dune-universe/mirage-opam-overlays.git.
--no-depext
Disable call to `opam depext' in the project Makefile.
--no-extra-repo
Disable the use of any overlay repository.
MIRAGE PARAMETERS
-t TARGET, --target=TARGET (absent=unix or MODE env)
Target platform to compile the unikernel for. Valid values are:
one of unix, macosx, xen, virtio, hvt, muen, qubes, genode, spt,
unikraft-firecracker or unikraft-qemu
CONFIGURE OPTIONS
--context-file=FILE (absent=mirage.context)
The context file to use.
--dry-run
Display I/O actions instead of executing them.
-f FILE, --file=FILE, --config-file=FILE (absent=config.ml)
The configuration file to use.
-o FILE, --output=FILE
Name of the output file.
INFO (absent=packages)
The information to query. INFO must be one of 'name', 'packages',
'opam', 'files', 'Makefile', 'dune.config', 'dune.build',
'dune-project', 'dune-workspace' or 'dune.dist'
COMMON OPTIONS
--color=WHEN (absent=auto)
Colorize the output. WHEN must be one of auto, always or never.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of auto,
pager, groff or plain. With auto, the format is pager or plain
whenever the TERM env var is dumb or undefined.
-q, --quiet
Be quiet. Takes over -v and --verbosity.
-v, --verbose
Increase verbosity. Repeatable, but more than twice does not bring
more.
--verbosity=LEVEL (absent=warning)
Be more or less verbose. LEVEL must be one of quiet, error,
warning, info or debug. Takes over -v.
--version
Show version information.
EXIT STATUS
mirage query exits with:
0 on success.
123 on indiscriminate errors reported on standard error.
124 on command line parsing errors.
125 on unexpected internal errors (bugs).
ENVIRONMENT
These environment variables affect the execution of mirage query:
MIRAGE_EXTRA_REPOS
See option --extra-repos.
MODE
See option --target.
SEE ALSO
mirage(1)
No difference
$ diff d1 d2

View file

@ -0,0 +1,5 @@
open Mirage
let runtime_args = [ runtime_arg ~pos:__POS__ "Unikernel.hello" ]
let main = main ~runtime_args ~pos:__POS__ "App" job
let () = register ~src:`None "noop" [ main ]

View file

@ -0,0 +1,6 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Configure
$ ./config.exe configure
adding unit argument to 'start ()' (to delay execution)
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').

View file

@ -0,0 +1,7 @@
(executable
(name config)
(libraries mirage))
(cram
(package mirage)
(deps config.exe))

View file

@ -0,0 +1,4 @@
open Mirage
let main = main ~pos:__POS__ "App" job
let () = register ~src:`None "noop" [ if_impl Key.is_solo5 main main ]

View file

@ -0,0 +1,6 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Configure
$ ./config.exe configure
adding unit argument to 'start ()' (to delay execution)
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').

View file

@ -0,0 +1,7 @@
(executable
(name config)
(libraries mirage))
(cram
(package mirage)
(deps config.exe))

View file

@ -0,0 +1,4 @@
open Mirage
let main = main ~pos:__POS__ "App" job
let () = register ~src:`None "noop" [ main ]

View file

@ -0,0 +1,6 @@
$ export MIRAGE_DEFAULT_TARGET=unix
Configure
$ ./config.exe configure
adding unit argument to 'start ()' (to delay execution)
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').

View file

@ -0,0 +1,7 @@
(executable
(name config)
(libraries mirage))
(cram
(package mirage)
(deps config.exe))

View file

@ -0,0 +1,4 @@
open Mirage
let main = main ~pos:__POS__ "App" (job @-> job)
let () = register ~src:`None "noop" [ main $ noop ]

View file

@ -0,0 +1,4 @@
open Mirage
let main = main ~pos:__POS__ "App" (job @-> job)
let () = register ~src:`None "noop-functor.v0" [ main $ noop ]

View file

@ -0,0 +1,3 @@
open Mirage
let () = register ~src:`None "noop" [ noop ]

View file

@ -0,0 +1,18 @@
(executable
(name config)
(modules config)
(libraries mirage))
(executable
(name config_dash_in_name)
(modules config_dash_in_name)
(libraries mirage))
(executable
(name config_noop)
(modules config_noop)
(libraries mirage))
(cram
(package mirage)
(deps config.exe config_noop.exe config_dash_in_name.exe))

View file

@ -0,0 +1,82 @@
type t = {
cmd : string;
file : string;
args : string option;
target : [ `Unix | `Hvt ];
}
let target_str = function `Unix -> "unix" | `Hvt -> "hvt"
let v ?args x target = { cmd = "query " ^ x; file = x; target; args }
let gen t =
let file =
match t.target with
| `Unix -> t.file
| x -> Format.sprintf "%s-%s" t.file (target_str x)
in
let cmd =
match t.target with
| `Unix -> t.cmd
| x -> Format.sprintf "%s --target=%s" t.cmd (target_str x)
in
let cmd = match t.args with None -> cmd | Some a -> cmd ^ " " ^ a in
Format.printf
{|
(rule
(action
(with-stdout-to %s
(with-stderr-to %s.err
(setenv MIRAGE_DEFAULT_TARGET unix
(run ./config.exe %s))))))
(rule
(alias runtest)
(package mirage)
(action
(diff %s.expected %s)))
(rule
(alias runtest)
(package mirage)
(action
(diff %s.err.expected %s.err)))
|}
file file cmd file file file file
let of_target target =
List.iter gen
[
v "name" target;
v "opam" target;
v "packages" target;
v "files" target;
v "Makefile" target;
{
file = "Makefile.no-depext";
cmd = "query Makefile --no-depext";
args = None;
target;
};
{
file = "Makefile.depext";
cmd = "query Makefile --depext";
target;
args = None;
};
{ file = "x-dune"; cmd = "query dune --dry-run"; target; args = None };
{ file = "x-dune-base"; cmd = "query dune-base"; target; args = None };
{
file = "x-dune-project";
cmd = "query dune-project";
target;
args = None;
};
{
file = "x-dune-workspace";
cmd = "query dune-workspace --dry-run --build-dir foo";
target;
args = None;
};
]
let () = List.iter of_target [ `Unix; `Hvt ]

View file

@ -0,0 +1,153 @@
Query unikernel dune
$ ./config_dash_in_name.exe query dune.build
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
(copy_files# ./mirage/main.ml)
(rule
(target noop-functor.v0)
(enabled_if (= %{context_name} "default"))
(deps main.exe)
(action
(copy main.exe %{target})))
(executable
(name main)
(libraries cmdliner-stdlib duration lwt mirage-bootvar mirage-bootvar.unix
mirage-crypto-rng-mirage mirage-logs mirage-mtime mirage-mtime.unix
mirage-ptime mirage-ptime.unix mirage-runtime mirage-sleep
mirage-sleep.unix mirage-unix)
(link_flags (-thread))
(modules (:standard \ config))
(flags :standard -w -70)
(enabled_if (= %{context_name} "default"))
)
Query dist dune
$ ./config_dash_in_name.exe query dune.dist
(rule
(mode (promote (until-clean)))
(target noop-functor.v0)
(enabled_if (= %{context_name} "default"))
(action
(copy ../noop-functor.v0 %{target}))
)
Query makefile
$ ./config_dash_in_name.exe query Makefile --target unix
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-functor_v0-unix
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm depext-lockfile
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
depext-lockfile: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
echo " ↳ install external dependencies for monorepo"
env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo depext -y -l $<
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes
@$(MAKE) -s depext-lockfile
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop-functor.v0"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
...
Query dune-project
$ ./config_dash_in_name.exe query dune-project --target unix
(lang dune 2.9)
(name noop-functor.v0-unix)
(implicit_transitive_deps true)
Query unikernel dune (hvt)
$ ./config_dash_in_name.exe query --target hvt dune.build
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
(copy_files# ./mirage/main.ml)
(copy_files ./mirage/manifest.json)
(copy_files# ./mirage/manifest.ml)
(executable
(enabled_if (= %{context_name} "solo5"))
(name main)
(modes (native exe))
(libraries cmdliner-stdlib duration lwt mirage-bootvar mirage-bootvar.solo5
mirage-crypto-rng-mirage mirage-logs mirage-mtime mirage-mtime.solo5
mirage-ptime mirage-ptime.solo5 mirage-runtime mirage-sleep
mirage-sleep.solo5 mirage-solo5)
(link_flags :standard -w -70 -cclib "-z solo5-abi=hvt")
(modules (:standard \ config manifest))
(foreign_stubs (language c) (names manifest))
)
(rule
(targets manifest.c)
(deps manifest.json)
(action
(run solo5-elftool gen-manifest manifest.json manifest.c)))
(rule
(target noop-functor.v0.hvt)
(enabled_if (= %{context_name} "solo5"))
(deps main.exe)
(action
(copy main.exe %{target})))
Query dist dune (hvt)
$ ./config_dash_in_name.exe query --target hvt dune.dist
(rule
(mode (promote (until-clean)))
(target noop-functor.v0.hvt)
(enabled_if (= %{context_name} "solo5"))
(action
(copy ../noop-functor.v0.hvt %{target}))
)

View file

@ -0,0 +1,338 @@
$ export MIRAGE_DEFAULT_TARGET unix
Query opam file
$ ./config.exe query --target hvt opam
opam-version: "2.0"
maintainer: "dummy"
authors: "dummy"
homepage: "dummy"
bug-reports: "dummy"
dev-repo: "git://dummy"
synopsis: "Unikernel noop - switch dependencies"
description: """
It assumes that local dependencies are already
fetched.
"""
build: [make "build"]
install: [
[ "cp" "dist/noop.hvt" "%{bin}%/noop.hvt" ]
]
depends: [
"cmdliner-stdlib" { ?monorepo & >= "1.0.1" & < "2.0.0" }
"duration" { ?monorepo & < "1.0.0" }
"lwt" { ?monorepo }
"mirage" { build & >= "4.10.0" & < "4.11.0" }
"mirage-bootvar" { ?monorepo & >= "1.0.0" & < "2.0.0" }
"mirage-crypto-rng-mirage" { ?monorepo & >= "2.0.0" & < "3.0.0" }
"mirage-logs" { ?monorepo & >= "3.0.0" & < "4.0.0" }
"mirage-mtime" { ?monorepo & >= "5.2.0" & < "6.0.0" }
"mirage-ptime" { ?monorepo & >= "5.1.0" & < "6.0.0" }
"mirage-runtime" { ?monorepo & >= "4.10.0" & < "4.11.0" }
"mirage-sleep" { ?monorepo & >= "4.1.0" & < "5.0.0" }
"mirage-solo5" { ?monorepo & >= "0.10.0" & < "0.11.0" }
"ocaml-solo5" { build & >= "0.8.2" & < "2.0.0" }
"opam-monorepo" { build & >= "0.3.2" }
"solo5" { build & >= "0.7.5" & < "0.11.0" }
]
x-mirage-opam-lock-location: "mirage/noop-hvt.opam.locked"
x-mirage-configure: ["sh" "-exc" "mirage configure --target hvt --no-extra-repo"]
x-mirage-pre-build: [make "lock" "depext-lockfile" "pull"]
x-mirage-extra-repo: [
["opam-overlays" "https://github.com/dune-universe/opam-overlays.git"]
["mirage-overlays" "https://github.com/dune-universe/mirage-opam-overlays.git"]]
x-opam-monorepo-opam-provided: ["mirage" "ocaml-solo5" "opam-monorepo" "solo5"]
Query packages
$ ./config.exe query --target hvt packages
"cmdliner-stdlib" { ?monorepo & >= "1.0.1" & < "2.0.0" }
"duration" { ?monorepo & < "1.0.0" }
"lwt" { ?monorepo }
"mirage" { build & >= "4.10.0" & < "4.11.0" }
"mirage-bootvar" { ?monorepo & >= "1.0.0" & < "2.0.0" }
"mirage-crypto-rng-mirage" { ?monorepo & >= "2.0.0" & < "3.0.0" }
"mirage-logs" { ?monorepo & >= "3.0.0" & < "4.0.0" }
"mirage-mtime" { ?monorepo & >= "5.2.0" & < "6.0.0" }
"mirage-ptime" { ?monorepo & >= "5.1.0" & < "6.0.0" }
"mirage-runtime" { ?monorepo & >= "4.10.0" & < "4.11.0" }
"mirage-sleep" { ?monorepo & >= "4.1.0" & < "5.0.0" }
"mirage-solo5" { ?monorepo & >= "0.10.0" & < "0.11.0" }
"ocaml-solo5" { build & >= "0.8.2" & < "2.0.0" }
"opam-monorepo" { build & >= "0.3.2" }
"solo5" { build & >= "0.7.5" & < "0.11.0" }
Query files
$ ./config.exe query --target hvt files
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
main.ml manifest.json manifest.ml
Query Makefile
$ ./config.exe query --target hvt Makefile
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-hvt
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm depext-lockfile
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
depext-lockfile: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
echo " ↳ install external dependencies for monorepo"
env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo depext -y -l $<
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes
@$(MAKE) -s depext-lockfile
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop.hvt"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
Query Makefile without depexts
$ ./config.exe query --target hvt Makefile --no-depext
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-hvt
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes --no-depexts
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop.hvt"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
Query Makefile with depext
$ ./config.exe query --target hvt Makefile --depext
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-hvt
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm depext-lockfile
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
depext-lockfile: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
echo " ↳ install external dependencies for monorepo"
env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo depext -y -l $<
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes
@$(MAKE) -s depext-lockfile
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop.hvt"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
Query version
$ ./config.exe query --target hvt --version
v4.10.3
Query unikernel dune
$ ./config.exe query --target hvt dune.build
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
(copy_files# ./mirage/main.ml)
(copy_files ./mirage/manifest.json)
(copy_files# ./mirage/manifest.ml)
(executable
(enabled_if (= %{context_name} "solo5"))
(name main)
(modes (native exe))
(libraries cmdliner-stdlib duration lwt mirage-bootvar mirage-bootvar.solo5
mirage-crypto-rng-mirage mirage-logs mirage-mtime mirage-mtime.solo5
mirage-ptime mirage-ptime.solo5 mirage-runtime mirage-sleep
mirage-sleep.solo5 mirage-solo5)
(link_flags :standard -w -70 -cclib "-z solo5-abi=hvt")
(modules (:standard \ config manifest))
(foreign_stubs (language c) (names manifest))
)
(rule
(targets manifest.c)
(deps manifest.json)
(action
(run solo5-elftool gen-manifest manifest.json manifest.c)))
(rule
(target noop.hvt)
(enabled_if (= %{context_name} "solo5"))
(deps main.exe)
(action
(copy main.exe %{target})))
Query configuration dune
$ ./config.exe query --target hvt dune.config
(data_only_dirs duniverse dist)
(executable
(name config)
(modules config)
(flags :standard -warn-error -A)
(libraries mirage))
Query dune-project
$ ./config.exe query --target hvt dune-project
(lang dune 2.9)
(name noop-hvt)
(implicit_transitive_deps true)
Query dune-workspace
$ ./config.exe query --target hvt dune-workspace
(lang dune 2.9)
(context (default))
(context (default
(name solo5)
(host default)
(toolchain solo5)
(merlin)
(disable_dynamically_linked_foreign_archives true)
))

View file

@ -0,0 +1,153 @@
Query unikernel dune
$ ./config_noop.exe query dune.build
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
(copy_files# ./mirage/main.ml)
(rule
(target noop)
(enabled_if (= %{context_name} "default"))
(deps main.exe)
(action
(copy main.exe %{target})))
(executable
(name main)
(libraries cmdliner-stdlib duration lwt mirage-bootvar mirage-bootvar.unix
mirage-crypto-rng-mirage mirage-logs mirage-mtime mirage-mtime.unix
mirage-ptime mirage-ptime.unix mirage-runtime mirage-sleep
mirage-sleep.unix mirage-unix)
(link_flags (-thread))
(modules (:standard \ config))
(flags :standard -w -70)
(enabled_if (= %{context_name} "default"))
)
Query dist dune
$ ./config_noop.exe query dune.dist
(rule
(mode (promote (until-clean)))
(target noop)
(enabled_if (= %{context_name} "default"))
(action
(copy ../noop %{target}))
)
Query makefile
$ ./config_noop.exe query Makefile --target unix
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-unix
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm depext-lockfile
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
depext-lockfile: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
echo " ↳ install external dependencies for monorepo"
env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo depext -y -l $<
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes
@$(MAKE) -s depext-lockfile
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
...
Query dune-project
$ ./config_noop.exe query dune-project --target unix
(lang dune 2.9)
(name noop-unix)
(implicit_transitive_deps true)
Query unikernel dune (hvt)
$ ./config_noop.exe query --target hvt dune.build
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
(copy_files# ./mirage/main.ml)
(copy_files ./mirage/manifest.json)
(copy_files# ./mirage/manifest.ml)
(executable
(enabled_if (= %{context_name} "solo5"))
(name main)
(modes (native exe))
(libraries cmdliner-stdlib duration lwt mirage-bootvar mirage-bootvar.solo5
mirage-crypto-rng-mirage mirage-logs mirage-mtime mirage-mtime.solo5
mirage-ptime mirage-ptime.solo5 mirage-runtime mirage-sleep
mirage-sleep.solo5 mirage-solo5)
(link_flags :standard -w -70 -cclib "-z solo5-abi=hvt")
(modules (:standard \ config manifest))
(foreign_stubs (language c) (names manifest))
)
(rule
(targets manifest.c)
(deps manifest.json)
(action
(run solo5-elftool gen-manifest manifest.json manifest.c)))
(rule
(target noop.hvt)
(enabled_if (= %{context_name} "solo5"))
(deps main.exe)
(action
(copy main.exe %{target})))
Query dist dune (hvt)
$ ./config_noop.exe query --target hvt dune.dist
(rule
(mode (promote (until-clean)))
(target noop.hvt)
(enabled_if (= %{context_name} "solo5"))
(action
(copy ../noop.hvt %{target}))
)

View file

@ -0,0 +1,322 @@
$ export MIRAGE_DEFAULT_TARGET unix
Query name
$ ./config.exe query name
noop
Query opam file
$ ./config.exe query opam -t unix
opam-version: "2.0"
maintainer: "dummy"
authors: "dummy"
homepage: "dummy"
bug-reports: "dummy"
dev-repo: "git://dummy"
synopsis: "Unikernel noop - switch dependencies"
description: """
It assumes that local dependencies are already
fetched.
"""
build: [make "build"]
install: [
[ "cp" "dist/noop" "%{bin}%/noop" ]
]
depends: [
"cmdliner-stdlib" { ?monorepo & >= "1.0.1" & < "2.0.0" }
"duration" { ?monorepo & < "1.0.0" }
"lwt" { ?monorepo }
"mirage" { build & >= "4.10.0" & < "4.11.0" }
"mirage-bootvar" { ?monorepo & >= "1.0.0" & < "2.0.0" }
"mirage-crypto-rng-mirage" { ?monorepo & >= "2.0.0" & < "3.0.0" }
"mirage-logs" { ?monorepo & >= "3.0.0" & < "4.0.0" }
"mirage-mtime" { ?monorepo & >= "5.2.0" & < "6.0.0" }
"mirage-ptime" { ?monorepo & >= "5.1.0" & < "6.0.0" }
"mirage-runtime" { ?monorepo & >= "4.10.0" & < "4.11.0" }
"mirage-sleep" { ?monorepo & >= "4.1.0" & < "5.0.0" }
"mirage-unix" { ?monorepo & >= "5.0.0" & < "6.0.0" }
"opam-monorepo" { build & >= "0.3.2" }
]
x-mirage-opam-lock-location: "mirage/noop-unix.opam.locked"
x-mirage-configure: ["sh" "-exc" "mirage configure -t unix --no-extra-repo"]
x-mirage-pre-build: [make "lock" "depext-lockfile" "pull"]
x-mirage-extra-repo: [
["opam-overlays" "https://github.com/dune-universe/opam-overlays.git"]
["mirage-overlays" "https://github.com/dune-universe/mirage-opam-overlays.git"]]
x-opam-monorepo-opam-provided: ["mirage" "opam-monorepo"]
Query packages
$ ./config.exe query packages
"cmdliner-stdlib" { ?monorepo & >= "1.0.1" & < "2.0.0" }
"duration" { ?monorepo & < "1.0.0" }
"lwt" { ?monorepo }
"mirage" { build & >= "4.10.0" & < "4.11.0" }
"mirage-bootvar" { ?monorepo & >= "1.0.0" & < "2.0.0" }
"mirage-crypto-rng-mirage" { ?monorepo & >= "2.0.0" & < "3.0.0" }
"mirage-logs" { ?monorepo & >= "3.0.0" & < "4.0.0" }
"mirage-mtime" { ?monorepo & >= "5.2.0" & < "6.0.0" }
"mirage-ptime" { ?monorepo & >= "5.1.0" & < "6.0.0" }
"mirage-runtime" { ?monorepo & >= "4.10.0" & < "4.11.0" }
"mirage-sleep" { ?monorepo & >= "4.1.0" & < "5.0.0" }
"mirage-unix" { ?monorepo & >= "5.0.0" & < "6.0.0" }
"opam-monorepo" { build & >= "0.3.2" }
Query files
$ ./config.exe query files
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
main.ml
Query Makefile
$ ./config.exe query Makefile --target unix
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-unix
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm depext-lockfile
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
depext-lockfile: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
echo " ↳ install external dependencies for monorepo"
env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo depext -y -l $<
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes
@$(MAKE) -s depext-lockfile
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
Query Makefile without depexts
$ ./config.exe query Makefile --no-depext --target unix
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-unix
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes --no-depexts
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
Query Makefile with depext
$ ./config.exe query Makefile --depext --target unix
-include Makefile.user
BUILD_DIR = ./
MIRAGE_DIR = ./mirage
UNIKERNEL_NAME = noop-unix
OPAM = opam
all::
@$(MAKE) --no-print-directory depends
@$(MAKE) --no-print-directory build
.PHONY: all lock install-switch pull clean depend depends build repo-add repo-rm depext-lockfile
repo-add:
@printf "\033[2musing overlay repository mirage: [opam-overlays, mirage-overlays] \033[0m\n"
$(OPAM) repo add opam-overlays https://github.com/dune-universe/opam-overlays.git || $(OPAM) repo set-url opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo add mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git || $(OPAM) repo set-url mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
repo-rm:
@printf "\033[2mremoving overlay repository [opam-overlays, mirage-overlays]\033[0m\n"
$(OPAM) repo remove opam-overlays https://github.com/dune-universe/opam-overlays.git
$(OPAM) repo remove mirage-overlays https://github.com/dune-universe/mirage-opam-overlays.git
depext-lockfile: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
echo " ↳ install external dependencies for monorepo"
env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo depext -y -l $<
$(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@$(MAKE) -s repo-add
@echo " ↳ generate lockfile for monorepo dependencies"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo lock --require-cross-compile --build-only $(UNIKERNEL_NAME) -l $@ --ocaml-version $(shell ocamlc --version); (ret=$$?; $(MAKE) -s repo-rm && exit $$ret)
lock::
@$(MAKE) -B $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo "The lock file has been generated. Run 'make pull' to retrieve the sources, or 'make install-switch' to install the host dependencies."
pull:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam.locked
@echo " ↳ fetch monorepo dependencies in the duniverse folder"
@env OPAMVAR_monorepo="opam-monorepo" $(OPAM) monorepo pull -l $< -r $(abspath $(BUILD_DIR))
@echo "The sources have been pulled to the duniverse folder. Run 'make build' to build the unikernel."
install-switch:: $(MIRAGE_DIR)/$(UNIKERNEL_NAME).opam
@echo " ↳ opam install switch dependencies"
@$(OPAM) install $< --deps-only --yes
@$(MAKE) -s depext-lockfile
@echo "The dependencies have been installed. Run 'make build' to build the unikernel."
depends depend::
@$(MAKE) --no-print-directory lock
@$(MAKE) --no-print-directory install-switch
@$(MAKE) --no-print-directory pull
build::
dune build --profile release --root . $(BUILD_DIR)dist
@echo "Your unikernel binary is now ready in $(BUILD_DIR)dist/noop"
@echo "Execute the binary using solo5-hvt, solo5-spt, xl, ..."
clean::
mirage clean
Query version
$ ./config.exe query --version
v4.10.3
Query unikernel dune
$ ./config.exe query dune.build
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
(copy_files# ./mirage/main.ml)
(rule
(target noop)
(enabled_if (= %{context_name} "default"))
(deps main.exe)
(action
(copy main.exe %{target})))
(executable
(name main)
(libraries cmdliner-stdlib duration lwt mirage-bootvar mirage-bootvar.unix
mirage-crypto-rng-mirage mirage-logs mirage-mtime mirage-mtime.unix
mirage-ptime mirage-ptime.unix mirage-runtime mirage-sleep
mirage-sleep.unix mirage-unix)
(link_flags (-thread))
(modules (:standard \ config))
(flags :standard -w -70)
(enabled_if (= %{context_name} "default"))
)
Query configuration dune
$ ./config.exe query dune.config
(data_only_dirs duniverse dist)
(executable
(name config)
(modules config)
(flags :standard -warn-error -A)
(libraries mirage))
Query dune-project
$ ./config.exe query dune-project --target unix
(lang dune 2.9)
(name noop-unix)
(implicit_transitive_deps true)
Query dune-workspace
$ ./config.exe query dune-workspace
(lang dune 2.9)
(context (default))

View file

@ -0,0 +1,4 @@
open Mirage
let main = main "App.Make" ~pos:__POS__ (job @-> job) $ noop
let () = register "random" [ main ]

View file

@ -0,0 +1,7 @@
(cram
(deps
config.ml
(package mirage))
(enabled_if
(<> %{architecture} "i386"))
(package mirage))

View file

@ -0,0 +1,46 @@
Initialize a git repository:
$ git init --quiet
And set a user name for future commits:
$ git config user.email "noreply@mirage.io"
$ git config user.name "Camelus Dromedarius"
And set its "origin" remote to something:
$ git remote add origin https://github.com/notifications/invalid-repo.git
$ git remote show -n
origin
$ git branch
Make an empty commit and rename it to main. Otherwise we don't have any branches.
$ git commit --quiet --allow-empty -m 'Hello Mirage World'
$ git branch -m main
$ git branch
* main
Configure the project for Unix:
$ mirage configure -t unix
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
Check the source url of the generated opam package
$ cat mirage/random-unix.opam | grep "^url"
url { src: "git+https://github.com/notifications/invalid-repo.git#main" }
Now, let's use a remote with ssh transport:
$ git remote set-url origin git@github.com:notifications/invalid-repo.git
Configure the project again for Unix:
$ mirage configure -t unix
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
Check the source url of the generated opam package
$ cat mirage/random-unix.opam | grep "^url"
url { src: "git+https://github.com/notifications/invalid-repo.git#main" }

View file

@ -0,0 +1,339 @@
Configure the project for Unix:
$ mirage configure -t unix
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
$ ls . mirage/
.:
Makefile
_build
config.ml
dist
dune
dune-project
dune-workspace
dune.build
dune.config
mirage
mirage/:
context
dune-workspace.config
main.ml
random-unix.opam
$ cat mirage/main.ml
open Lwt.Infix
type 'a io = 'a Lwt.t
let return = Lwt.return
let run t = Unix_os.Main.run t ; exit
0
let mirage_runtime_delay__key = Mirage_runtime.register_arg @@
# 32 "lib/devices/runtime_arg.ml"
Mirage_runtime.delay
;;
let mirage_runtime_logs__key = Mirage_runtime.register_arg @@
# 199 "lib/devices/runtime_arg.ml"
Mirage_runtime.logs
;;
let cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true___key = Mirage_runtime.register_arg @@
# 382 "lib/mirage.ml"
Cmdliner_stdlib.setup ~backtrace:(Some true) ~randomize_hashtables:(Some true) ()
;;
# 23 "mirage/main.ml"
module App_make__12 = App.Make(Unit)
let mirage_bootvar__1 = lazy (
# 15 "lib/devices/argv.ml"
return (Mirage_bootvar.argv ())
);;
# 31 "mirage/main.ml"
let struct_end__2 = lazy (
let __mirage_bootvar__1 = Lazy.force mirage_bootvar__1 in
__mirage_bootvar__1 >>= fun _mirage_bootvar__1 ->
# 47 "lib/functoria/job.ml"
return Mirage_runtime.(with_argv (runtime_args ()) "random" _mirage_bootvar__1)
);;
# 39 "mirage/main.ml"
let cmdliner_stdlib__3 = lazy (
let _cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true_ = (cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true___key ()) in
return (_cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true_)
);;
# 45 "mirage/main.ml"
let mirage_runtime__4 = lazy (
let _mirage_runtime_delay = (mirage_runtime_delay__key ()) in
# 268 "lib/mirage.ml"
Mirage_sleep.ns (Duration.of_sec _mirage_runtime_delay)
);;
# 52 "mirage/main.ml"
let mirage_logs__5 = lazy (
let _mirage_runtime_logs = (mirage_runtime_logs__key ()) in
# 20 "lib/devices/reporter.ml"
let reporter = Mirage_logs.create () in
Mirage_runtime.set_level ~default:(Some Logs.Info) _mirage_runtime_logs;
Logs.set_reporter reporter;
Lwt.return reporter
);;
# 62 "mirage/main.ml"
let mirage_sleep__6 = lazy (
return ()
);;
# 67 "mirage/main.ml"
let mirage_ptime__7 = lazy (
return ()
);;
# 72 "mirage/main.ml"
let mirage_mtime__8 = lazy (
return ()
);;
# 77 "mirage/main.ml"
let mirage_crypto_rng_mirage__9 = lazy (
# 13 "lib/devices/random.ml"
Mirage_crypto_rng_mirage.initialize (module Mirage_crypto_rng.Fortuna)
);;
# 83 "mirage/main.ml"
let mirage_runtime__10 = lazy (
# 277 "lib/mirage.ml"
Mirage_runtime.set_name "random"; Lwt.return_unit
);;
# 89 "mirage/main.ml"
let unit__11 = lazy (
return ()
);;
# 94 "mirage/main.ml"
let app_make__12 = lazy (
let __unit__11 = Lazy.force unit__11 in
__unit__11 >>= fun _unit__11 ->
# 3 "config.ml"
(App_make__12.start _unit__11 : unit io)
);;
# 102 "mirage/main.ml"
let mirage_runtime__13 = lazy (
let __struct_end__2 = Lazy.force struct_end__2 in
let __cmdliner_stdlib__3 = Lazy.force cmdliner_stdlib__3 in
let __mirage_runtime__4 = Lazy.force mirage_runtime__4 in
let __mirage_logs__5 = Lazy.force mirage_logs__5 in
let __mirage_sleep__6 = Lazy.force mirage_sleep__6 in
let __mirage_ptime__7 = Lazy.force mirage_ptime__7 in
let __mirage_mtime__8 = Lazy.force mirage_mtime__8 in
let __mirage_crypto_rng_mirage__9 = Lazy.force mirage_crypto_rng_mirage__9 in
let __mirage_runtime__10 = Lazy.force mirage_runtime__10 in
let __app_make__12 = Lazy.force app_make__12 in
__struct_end__2 >>= fun _struct_end__2 ->
__cmdliner_stdlib__3 >>= fun _cmdliner_stdlib__3 ->
__mirage_runtime__4 >>= fun _mirage_runtime__4 ->
__mirage_logs__5 >>= fun _mirage_logs__5 ->
__mirage_sleep__6 >>= fun _mirage_sleep__6 ->
__mirage_ptime__7 >>= fun _mirage_ptime__7 ->
__mirage_mtime__8 >>= fun _mirage_mtime__8 ->
__mirage_crypto_rng_mirage__9 >>= fun _mirage_crypto_rng_mirage__9 ->
__mirage_runtime__10 >>= fun _mirage_runtime__10 ->
__app_make__12 >>= fun _app_make__12 ->
# 363 "lib/mirage.ml"
return ()
);;
# 128 "mirage/main.ml"
let () =
let t = Lazy.force struct_end__2 >>= fun _ ->
Lazy.force cmdliner_stdlib__3 >>= fun _ ->
Lazy.force mirage_runtime__4 >>= fun _ ->
Lazy.force mirage_logs__5 >>= fun _ ->
Lazy.force mirage_sleep__6 >>= fun _ ->
Lazy.force mirage_ptime__7 >>= fun _ ->
Lazy.force mirage_mtime__8 >>= fun _ ->
Lazy.force mirage_crypto_rng_mirage__9 >>= fun _ ->
Lazy.force mirage_runtime__10 >>= fun _ ->
Lazy.force mirage_runtime__13 in
run t
;;
$ mirage clean
Configure the project for Xen:
$ mirage configure -t xen
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
$ ls . mirage/
.:
Makefile
_build
config.ml
dist
dune
dune-project
dune-workspace
dune.build
dune.config
mirage
mirage/:
context
dune-workspace.config
main.ml
manifest.json
manifest.ml
random-xen.opam
random.xl
random.xl.in
random_libvirt.xml
$ cat mirage/main.ml
open Lwt.Infix
type 'a io = 'a Lwt.t
let return = Lwt.return
let run t = Xen_os.Main.run t ; exit
0
let mirage_runtime_delay__key = Mirage_runtime.register_arg @@
# 32 "lib/devices/runtime_arg.ml"
Mirage_runtime.delay
;;
let mirage_runtime_logs__key = Mirage_runtime.register_arg @@
# 199 "lib/devices/runtime_arg.ml"
Mirage_runtime.logs
;;
let cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true___key = Mirage_runtime.register_arg @@
# 382 "lib/mirage.ml"
Cmdliner_stdlib.setup ~backtrace:(Some true) ~randomize_hashtables:(Some true) ()
;;
# 23 "mirage/main.ml"
module App_make__12 = App.Make(Unit)
let mirage_bootvar__1 = lazy (
# 15 "lib/devices/argv.ml"
return (Mirage_bootvar.argv ())
);;
# 31 "mirage/main.ml"
let struct_end__2 = lazy (
let __mirage_bootvar__1 = Lazy.force mirage_bootvar__1 in
__mirage_bootvar__1 >>= fun _mirage_bootvar__1 ->
# 47 "lib/functoria/job.ml"
return Mirage_runtime.(with_argv (runtime_args ()) "random" _mirage_bootvar__1)
);;
# 39 "mirage/main.ml"
let cmdliner_stdlib__3 = lazy (
let _cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true_ = (cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true___key ()) in
return (_cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true_)
);;
# 45 "mirage/main.ml"
let mirage_runtime__4 = lazy (
let _mirage_runtime_delay = (mirage_runtime_delay__key ()) in
# 268 "lib/mirage.ml"
Mirage_sleep.ns (Duration.of_sec _mirage_runtime_delay)
);;
# 52 "mirage/main.ml"
let mirage_logs__5 = lazy (
let _mirage_runtime_logs = (mirage_runtime_logs__key ()) in
# 20 "lib/devices/reporter.ml"
let reporter = Mirage_logs.create () in
Mirage_runtime.set_level ~default:(Some Logs.Info) _mirage_runtime_logs;
Logs.set_reporter reporter;
Lwt.return reporter
);;
# 62 "mirage/main.ml"
let mirage_sleep__6 = lazy (
return ()
);;
# 67 "mirage/main.ml"
let mirage_ptime__7 = lazy (
return ()
);;
# 72 "mirage/main.ml"
let mirage_mtime__8 = lazy (
return ()
);;
# 77 "mirage/main.ml"
let mirage_crypto_rng_mirage__9 = lazy (
# 13 "lib/devices/random.ml"
Mirage_crypto_rng_mirage.initialize (module Mirage_crypto_rng.Fortuna)
);;
# 83 "mirage/main.ml"
let mirage_runtime__10 = lazy (
# 277 "lib/mirage.ml"
Mirage_runtime.set_name "random"; Lwt.return_unit
);;
# 89 "mirage/main.ml"
let unit__11 = lazy (
return ()
);;
# 94 "mirage/main.ml"
let app_make__12 = lazy (
let __unit__11 = Lazy.force unit__11 in
__unit__11 >>= fun _unit__11 ->
# 3 "config.ml"
(App_make__12.start _unit__11 : unit io)
);;
# 102 "mirage/main.ml"
let mirage_runtime__13 = lazy (
let __struct_end__2 = Lazy.force struct_end__2 in
let __cmdliner_stdlib__3 = Lazy.force cmdliner_stdlib__3 in
let __mirage_runtime__4 = Lazy.force mirage_runtime__4 in
let __mirage_logs__5 = Lazy.force mirage_logs__5 in
let __mirage_sleep__6 = Lazy.force mirage_sleep__6 in
let __mirage_ptime__7 = Lazy.force mirage_ptime__7 in
let __mirage_mtime__8 = Lazy.force mirage_mtime__8 in
let __mirage_crypto_rng_mirage__9 = Lazy.force mirage_crypto_rng_mirage__9 in
let __mirage_runtime__10 = Lazy.force mirage_runtime__10 in
let __app_make__12 = Lazy.force app_make__12 in
__struct_end__2 >>= fun _struct_end__2 ->
__cmdliner_stdlib__3 >>= fun _cmdliner_stdlib__3 ->
__mirage_runtime__4 >>= fun _mirage_runtime__4 ->
__mirage_logs__5 >>= fun _mirage_logs__5 ->
__mirage_sleep__6 >>= fun _mirage_sleep__6 ->
__mirage_ptime__7 >>= fun _mirage_ptime__7 ->
__mirage_mtime__8 >>= fun _mirage_mtime__8 ->
__mirage_crypto_rng_mirage__9 >>= fun _mirage_crypto_rng_mirage__9 ->
__mirage_runtime__10 >>= fun _mirage_runtime__10 ->
__app_make__12 >>= fun _app_make__12 ->
# 363 "lib/mirage.ml"
return ()
);;
# 128 "mirage/main.ml"
let () =
let t = Lazy.force struct_end__2 >>= fun _ ->
Lazy.force cmdliner_stdlib__3 >>= fun _ ->
Lazy.force mirage_runtime__4 >>= fun _ ->
Lazy.force mirage_logs__5 >>= fun _ ->
Lazy.force mirage_sleep__6 >>= fun _ ->
Lazy.force mirage_ptime__7 >>= fun _ ->
Lazy.force mirage_mtime__8 >>= fun _ ->
Lazy.force mirage_crypto_rng_mirage__9 >>= fun _ ->
Lazy.force mirage_runtime__10 >>= fun _ ->
Lazy.force mirage_runtime__13 in
run t
;;
$ mirage clean

View file

@ -0,0 +1,8 @@
open Mirage
let t = kv_ro @-> job
let test_typ () =
Alcotest.(check string) "pp" (Fmt.to_to_string Mirage.Type.pp t) "(_ -> _)"
let () = Alcotest.run "mirage" [ ("basic", [ ("pp", `Quick, test_typ) ]) ]

View file

@ -0,0 +1 @@
(* empty *)

View file

@ -0,0 +1,23 @@
open Mirage
(* This file exercises as many warnings as possible. It is thus a very poor
example of a config.ml file. *)
module T : sig end = struct
type t = ()
type t' = ()
end
let rec eth = etif default_network
let main = main "App.Make" ~pos:__POS__ (ethernet @-> job)
type ipv4_config = {
network : Ipaddr.V4.Prefix.t;
gateway : Ipaddr.V4.t option;
}
let () =
let ramdisk (conf : ipv4_config) =
match conf with { network } -> ramdisk "secrets\f42"
in
register "etif" [ main $ eth ]

View file

@ -0,0 +1,7 @@
(cram
(deps
config.ml
(package mirage))
(enabled_if ;XXX(reynir): not sure about this
(<> %{architecture} "i386"))
(package mirage))

View file

@ -0,0 +1,22 @@
Configure the project for Unix:
$ mirage configure -t unix 2>/dev/null
Successfully configured the unikernel. Now run 'make' (or more fine-grained steps: 'make all', 'make depends', or 'make lock').
The command succeeded and created a number of files. It produced a load of
warnings, but matching on the warnings given different compiler versions with
ever slightly different output is not worth it.
$ ls -a
.
..
Makefile
_build
config.ml
dist
dune
dune-project
dune-workspace
dune.build
dune.config
mirage

View file

@ -0,0 +1,6 @@
(cram
(package mirage)
(deps
unikernel.opam
(source_tree mini-opam-overlays/)
(source_tree mini-opam-repository/)))

View file

@ -0,0 +1,41 @@
$ opam-monorepo lock --require-cross-compile
==> Using 1 locally scanned package as the target.
==> Found 8 opam dependencies for the target package.
==> Querying opam database for their metadata and Dune compatibility.
==> Calculating exact pins for each of them.
==> Wrote lockfile with 4 entries to $TESTCASE_ROOT/unikernel.opam.locked. You can now run opam monorepo pull to fetch their sources.
$ cat unikernel.opam.locked
opam-version: "2.0"
synopsis: "opam-monorepo generated lockfile"
maintainer: "opam-monorepo"
depends: [
"dune" {= "3.0.0"}
"fmt" {= "0.9.0+dune" & ?vendor}
"gmp" {= "6.2.9+dune" & ?vendor}
"mirage-runtime" {= "4.0.0" & ?vendor}
"ocaml-base-compiler" {= "4.13.1"}
"ocaml-solo5" {= "0.8.0"}
"solo5" {= "0.7.1"}
"zarith" {= "1.12+dune+mirage" & ?vendor}
]
pin-depends: [
["fmt.0.9.0+dune" "https://fmt.src"]
["gmp.6.2.9+dune" "https://gmp.src"]
["mirage-runtime.4.0.0" "https://mirage.src"]
["zarith.1.12+dune+mirage" "https://github.com/ocaml/zarith.git"]
]
x-opam-monorepo-cli-args: ["--require-cross-compile"]
x-opam-monorepo-duniverse-dirs: [
["https://fmt.src" "fmt"]
["https://github.com/ocaml/zarith.git" "zarith"]
["https://gmp.src" "gmp"]
["https://mirage.src" "mirage"]
]
x-opam-monorepo-opam-provided: ["ocaml-solo5"]
x-opam-monorepo-opam-repositories: [
"file://$OPAM_MONOREPO_CWD/mini-opam-overlays"
"file://$OPAM_MONOREPO_CWD/mini-opam-repository"
]
x-opam-monorepo-root-packages: ["unikernel"]
x-opam-monorepo-version: "0.3"

View file

@ -0,0 +1,9 @@
opam-version: "2.0"
depends: ["dune"]
dev-repo: "fmt"
url {
src: "https://fmt.src"
}
build: [
["dune" "build"]
]

View file

@ -0,0 +1,10 @@
opam-version: "2.0"
depends: ["dune" "gmp"]
dev-repo: "zarith"
url {
src: "https://github.com/ocaml/zarith.git"
}
tags: [ "cross-compile" ]
build: [
["dune" "build"]
]

View file

@ -0,0 +1,6 @@
opam-version: "2.0"
depends: ["dune"]
dev-repo: "zarith"
url {
src: "https://zarith.src"
}

Some files were not shown because too many files have changed in this diff Show more