Refactor tests to use nested Init/Child type
parent
bfebc6dcef
commit
94868758e5
@ -1,36 +1,41 @@
|
||||
-- SPDX-License-Identifier: CC0-1.0
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
let Init = Genode.Init
|
||||
|
||||
let Child = Init.Child
|
||||
|
||||
let wrapHarness
|
||||
: Init.Type → Child.Type
|
||||
= env:DHALL_WRAP_HARNESS ? ./sotest-wrapper.dhall
|
||||
|
||||
let Child = Genode.Init.Child
|
||||
|
||||
in λ(boot : Genode.Boot.Type)
|
||||
→ { config =
|
||||
Genode.Init::{
|
||||
, verbose = True
|
||||
, defaultRoutes =
|
||||
Genode.Init.default.defaultRoutes
|
||||
# [ Genode.ServiceRoute.child "Timer" "timer" ]
|
||||
, children =
|
||||
[ { mapKey = "timer"
|
||||
, mapValue =
|
||||
Genode.Init.Start::{
|
||||
, binary = "linux_timer_drv"
|
||||
, resources = { caps = 96, ram = Genode.units.MiB 1 }
|
||||
, provides = [ "Timer" ]
|
||||
}
|
||||
}
|
||||
, { mapKey = "harness"
|
||||
, mapValue = Genode.Init.toStart boot.config
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "linux_timer_drv"
|
||||
, provides = [ "Timer" ]
|
||||
}
|
||||
}
|
||||
, { mapKey = "harness", mapValue = wrapHarness boot.config }
|
||||
]
|
||||
}
|
||||
, rom =
|
||||
let manifest = env:MANIFEST
|
||||
|
||||
in Genode.Boot.toRomPaths
|
||||
in Genode.BootModules.toRomPaths
|
||||
[ manifest.base-linux.bin.core-linux
|
||||
, manifest.base-linux.bin.ld
|
||||
, manifest.base-linux.bin.linux_timer_drv
|
||||
, manifest.os.bin.init
|
||||
, manifest.sotest-producer.bin.sotest-harness
|
||||
]
|
||||
# boot.rom
|
||||
: Genode.Prelude.Map.Type Text Genode.Boot.Rom
|
||||
: Genode.BootModules.Type
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
-- SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
in { config =
|
||||
Genode.Init::{
|
||||
, verbose = True
|
||||
, children =
|
||||
toMap
|
||||
{ test-libc =
|
||||
Genode.Init.Start::{
|
||||
, binary = "test-libc"
|
||||
, exitPropagate = True
|
||||
, resources = { caps = 200, ram = Genode.units.MiB 400 }
|
||||
, routes = [ Genode.ServiceRoute.parent "Timer" ]
|
||||
, config =
|
||||
Some
|
||||
( Genode.Prelude.XML.text
|
||||
''
|
||||
<config>
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<inline name="rtc">2019-08-20 15:01</inline>
|
||||
</dir>
|
||||
</vfs>
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
</config>
|
||||
''
|
||||
)
|
||||
}
|
||||
: Genode.Init.Start.Type
|
||||
}
|
||||
}
|
||||
, rom =
|
||||
let manifest = env:MANIFEST
|
||||
|
||||
in Genode.Boot.toRomPaths
|
||||
[ manifest.libc.lib.libc
|
||||
manifest.libc.lib.libm
|
||||
manifest.test-libc.bin.test-libc
|
||||
]
|
||||
}
|
@ -1,53 +1,29 @@
|
||||
-- SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
let Prelude = Genode.Prelude
|
||||
let Init = Genode.Init
|
||||
|
||||
let Child = Init.Child
|
||||
|
||||
in λ(boot : Genode.Boot.Type)
|
||||
→ let child =
|
||||
{ mapKey = "test", mapValue = Genode.Init.toStart boot.config }
|
||||
|
||||
in { config =
|
||||
Genode.Init::{
|
||||
, verbose = True
|
||||
, children =
|
||||
toMap
|
||||
{ harness =
|
||||
Genode.Init.Start::{
|
||||
, binary = "sotest-harness"
|
||||
, exitPropagate = True
|
||||
, resources =
|
||||
{ caps = child.mapValue.resources.caps + 128
|
||||
, ram =
|
||||
child.mapValue.resources.ram
|
||||
+ Genode.units.MiB 1
|
||||
}
|
||||
, config =
|
||||
Some
|
||||
( Prelude.XML.element
|
||||
{ name = "config"
|
||||
, attributes = Prelude.XML.emptyAttributes
|
||||
, content =
|
||||
[ Genode.Init.Start.toXML
|
||||
child.mapKey
|
||||
child.mapValue
|
||||
]
|
||||
}
|
||||
)
|
||||
, routes =
|
||||
[ Genode.ServiceRoute.parentLabel
|
||||
"LOG"
|
||||
(Some "SOTEST")
|
||||
(Some "unlabeled")
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
, rom =
|
||||
let manifest = env:MANIFEST
|
||||
|
||||
in Genode.Boot.toRomPaths
|
||||
[ manifest.sotest-producer.bin.sotest-harness ]
|
||||
# boot.rom
|
||||
: Genode.Prelude.Map.Type Text Genode.Boot.Rom
|
||||
let wrapSotest
|
||||
: Init.Type → Child.Type
|
||||
= λ(init : Init.Type)
|
||||
→ Child.nested
|
||||
(toMap { init = Genode.Init.toChild init Init.Attributes.default })
|
||||
Child.Attributes::{
|
||||
, binary = "sotest-harness"
|
||||
, 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.child "Timer" "timer"
|
||||
]
|
||||
}
|
||||
|
||||
in wrapSotest
|
||||
|
Loading…
Reference in New Issue