2
0
Fork 0
genodepkgs/tests/nix-store.dhall

120 lines
4.1 KiB
Plaintext

-- SPDX-License-Identifier: CC0-1.0
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
let Child = Init.Child
let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
let init =
λ(storeTarball : Text)
→ λ(testBinary : Text)
→ Init::{
, verbose = True
, routes =
[ ServiceRoute.parent "Timer"
, { service =
{ name = "ROM"
, label =
Init.LabelSelector.Type.Partial
{ prefix = Some "/nix/store/", suffix = None Text }
}
, route =
Init.Route.Type.Child
{ name = "nix/store-rom", label = None Text }
}
]
, children = toMap
{ nix/store-fs =
Child.flat
Child.Attributes::{
, binary = "vfs"
, config = Init.Config::{
, content =
[ XML.element
{ name = "vfs"
, attributes = XML.emptyAttributes
, content =
[ XML.leaf
{ name = "tar"
, attributes = toMap
{ name = "${storeTarball}" }
}
]
}
, XML.leaf
{ name = "default-policy"
, attributes = toMap { root = "/", writeable = "no" }
}
]
}
, provides = [ "File_system" ]
}
, nix/store-rom =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, resources = Resources::{ ram = Genode.units.MiB 8 }
, provides = [ "ROM" ]
, routes = [ ServiceRoute.child "File_system" "nix/store-fs" ]
}
, test-init =
Init.toChild
Init::{
, children = toMap
{ test =
Child.flat
Child.Attributes::{
, binary = "${testBinary}"
, exitPropagate = True
, resources = Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 4
}
, config = Genode.Init.Config::{
, attributes = toMap { ld_verbose = "yes" }
, content =
[ Prelude.XML.text
''
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log" />
<vfs> <dir> <log/> <null/> </dir> </vfs>
''
]
}
}
}
, verbose = True
}
Init.Attributes::{
, routes =
[ { service =
{ name = "ROM"
, label =
Init.LabelSelector.Type.Partial
{ prefix = Some "/nix/store/"
, suffix = None Text
}
}
, route =
Init.Route.Type.Child
{ name = "nix/store-rom", label = None Text }
}
]
}
}
}
in λ(storeTarball : Text)
→ λ(testBinary : Text)
→ Test::{ children = Test.initToChildren (init storeTarball testBinary) }