Add block_router package
parent
918c74a111
commit
6558f3c232
@ -0,0 +1,135 @@
|
||||
-- SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
let Genode = env:DHALL_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
|
||||
|
||||
in Genode.Boot::{
|
||||
, config = Init::{
|
||||
, verbose = True
|
||||
, children =
|
||||
let blockTest =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "test-block-client"
|
||||
, resources = Resources::{ ram = Genode.units.MiB 5 }
|
||||
, routes =
|
||||
[ ServiceRoute.parent "Timer"
|
||||
, ServiceRoute.child "Block" "block_router"
|
||||
]
|
||||
}
|
||||
|
||||
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
|
||||
{ name = "second-test-partition" }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, 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
|
||||
}
|
||||
}
|
||||
, rom =
|
||||
Genode.BootModules.toRomPaths
|
||||
[ { mapKey = "gpt.rom", mapValue = "./gpt.raw" } ]
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
{ testEnv, pkgs, hostPkgs, ... }:
|
||||
with pkgs;
|
||||
|
||||
testEnv.mkTest {
|
||||
name = "block_router";
|
||||
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
|
||||
|
||||
testConfig = ./block_router.dhall;
|
||||
testInputs = map pkgs.genodeSources.make [
|
||||
"server/part_block"
|
||||
"server/ram_block"
|
||||
"test/block/client"
|
||||
] ++ [ pkgs.block_router ];
|
||||
testScript = ''
|
||||
catch { exec dd if=/dev/zero of=gpt.raw bs=512 count=7168 }
|
||||
exec ${hostPkgs.gptfdisk}/bin/sgdisk -o -n 3:2048:4095 -c 3:first-test-partition -n 31:4096:6143 -c 31:second-test-partition gpt.raw
|
||||
|
||||
run_genode_until {Tests finished successfully.*\n.*Tests finished successfully.*\n} 120
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue