2
0
Fork 0
genodepkgs/tests/test-wrapper.dhall

169 lines
5.3 KiB
Plaintext
Raw Normal View History

2020-04-13 20:26:01 +02:00
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
2020-04-13 20:26:01 +02:00
let Genode = Test.Genode
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
let Child = Init.Child
2020-04-13 20:26:01 +02:00
let TextMapType = Prelude.Map.Type Text
let Children = TextMapType Child.Type
let Manifest/Type = TextMapType (TextMapType Text)
let Manifest/toRoutes =
2020-08-29 17:31:53 +02:00
λ(manifest : Manifest/Type) →
Prelude.List.map
(Prelude.Map.Entry Text Text)
Init.ServiceRoute.Type
2020-08-29 17:31:53 +02:00
( λ(entry : Prelude.Map.Entry Text Text) →
{ service =
{ name = "ROM"
, label = Init.LabelSelector.Type.Last entry.mapKey
}
, route =
Init.Route.Type.Child
2020-05-29 18:34:22 +02:00
{ name = "store_rom"
, label = Some entry.mapValue
, diag = None Bool
}
}
)
( Prelude.List.concat
(Prelude.Map.Entry Text Text)
(Prelude.Map.values Text (Prelude.Map.Type Text Text) manifest)
)
2020-05-29 18:34:22 +02:00
let parentROMs =
Prelude.List.map
Text
Init.ServiceRoute.Type
2020-08-29 17:31:53 +02:00
( λ(label : Text) →
{ service =
{ name = "ROM", label = Init.LabelSelector.Type.Last label }
2020-05-29 18:34:22 +02:00
, route =
Init.Route.Type.Parent { label = Some label, diag = None Bool }
}
)
let wrapHarness
: Children → Manifest/Type → Child.Type
2020-08-29 17:31:53 +02:00
= λ(children : Children) →
λ(manifest : Manifest/Type) →
Child.nested
2020-04-13 20:26:01 +02:00
children
Child.Attributes::{
, binary = "sotest-harness"
2020-04-13 20:26:01 +02:00
, exitPropagate = True
, resources = Init.Resources::{ ram = Genode.units.MiB 4 }
, routes =
[ Init.ServiceRoute.parentLabel
"LOG"
(Some "SOTEST")
(Some "unlabeled")
, Init.ServiceRoute.parent "IO_MEM"
, Init.ServiceRoute.parent "IO_PORT"
, Init.ServiceRoute.parent "IRQ"
, Init.ServiceRoute.parent "VM"
, Init.ServiceRoute.child "Timer" "timer"
, Init.ServiceRoute.child "Rtc" "rtc"
2020-05-29 18:34:22 +02:00
, Init.ServiceRoute.child "File_system" "store_fs"
]
2020-05-29 18:34:22 +02:00
# parentROMs
[ "ld.lib.so"
, "init"
, "platform_info"
, "core_log"
, "kernel_log"
, "vfs"
, "libvfs.so"
, "cached_fs_rom"
]
# Manifest/toRoutes manifest
}
2020-08-29 17:31:53 +02:00
in λ(test : Test.Type) →
λ(storeSize : Natural) →
λ(storeManifest : Manifest/Type) →
λ(bootManifest : Manifest/Type) →
Genode.Boot::{
2020-04-13 20:26:01 +02:00
, config = Init::{
, children =
[ { mapKey = "timer"
, mapValue =
Child.flat
Child.Attributes::{
, binary = "timer_drv"
, provides = [ "Timer" ]
}
}
, { mapKey = "rtc"
, mapValue =
Child.flat
Child.Attributes::{
, binary = "rtc_drv"
, provides = [ "Rtc" ]
, routes = [ Init.ServiceRoute.parent "IO_PORT" ]
}
}
, { mapKey = "store_fs"
, mapValue =
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 = "store.tar" }
}
]
}
]
2020-06-06 22:10:32 +02:00
, defaultPolicy = Some Init.Config.DefaultPolicy::{
, attributes = toMap { root = "/", writeable = "no" }
}
}
, provides = [ "File_system" ]
}
}
, { mapKey = "store_rom"
, mapValue =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, provides = [ "ROM" ]
, resources = Init.Resources::{
, ram = storeSize + Genode.units.MiB 1
}
, routes =
[ Init.ServiceRoute.child "File_system" "store_fs" ]
}
}
, { mapKey = "harness"
, mapValue = wrapHarness test.children storeManifest
}
2020-04-13 20:26:01 +02:00
]
}
2020-04-13 20:26:01 +02:00
, rom =
test.rom
# Genode.BootModules.toRomPaths
( Prelude.List.concat
(Prelude.Map.Entry Text Text)
( Prelude.Map.values
Text
(Prelude.Map.Type Text Text)
bootManifest
2020-04-13 20:26:01 +02:00
)
)
}