2
0
Fork 0
genodepkgs/tests/block_router.dhall

143 lines
5.5 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 =
Init::{
, verbose = True
, routes =
[ ServiceRoute.parent "Timer"
, ServiceRoute.child "Block" "block_router"
]
, children =
let blockTest =
Child.flat
Child.Attributes::{
, binary = "test-block-client"
, resources = Resources::{ ram = Genode.units.MiB 5 }
}
in toMap
{ block_device =
Child.flat
Child.Attributes::{
, binary = "ram_block"
, config = Init.Config::{
, attributes = toMap
{ file = "gpt.rom", block_size = "512" }
}
, provides = [ "Block" ]
, resources = Resources::{ ram = Genode.units.MiB 8 }
}
, part_block =
Child.flat
Child.Attributes::{
, binary = "part_block"
, config = Init.Config::{
, attributes = toMap { use_gpt = "yes" }
, content =
Prelude.List.map
Natural
XML.Type
( λ(i : Natural)
→ XML.leaf
{ name = "policy"
, attributes =
let partition =
Prelude.Natural.show (i + 1)
in toMap
{ label_suffix = " ${partition}"
, partition = partition
, writeable = "yes"
}
}
)
(Prelude.Natural.enumerate 128)
# [ XML.leaf
{ name = "report"
, attributes = toMap { partitions = "yes" }
}
]
}
, resources = Resources::{ ram = Genode.units.MiB 10 }
, provides = [ "Block" ]
, routes =
[ ServiceRoute.child "Block" "block_device"
, ServiceRoute.child "Report" "block_router"
]
}
, block_router =
Child.flat
Child.Attributes::{
, binary = "block_router"
, config = Init.Config::{
, content =
[ XML.element
{ name = "policy"
, attributes = toMap
{ label_prefix = "test-part1" }
, content =
[ XML.leaf
{ name = "partition"
, attributes = toMap
{ name = "best partition ever" }
}
, XML.leaf
{ name = "partition"
, attributes = toMap
{ name = "first-test-partition"
, timeout = "2"
}
}
]
}
, XML.element
{ name = "policy"
, attributes = toMap
{ label_prefix = "test-part2" }
, content =
[ XML.leaf
{ name = "partition"
, attributes = toMap
{ type =
"24B69406-18A1-428D-908E-D21A1437122C"
}
}
]
}
]
}
, resources = Resources::{ ram = Genode.units.MiB 10 }
, provides = [ "Block", "Report" ]
, routes =
[ ServiceRoute.parent "Timer"
, ServiceRoute.child "Block" "part_block"
]
}
, test-part1 = blockTest
, test-part2 = blockTest
}
}
in Test::{
, children = Test.initToChildren init
, rom =
Genode.BootModules.toRomPaths
[ { mapKey = "gpt.rom", mapValue = "./gpt.raw" } ]
}