2
0
Fork 0

Refactor tests to use nested Init/Child type

This commit is contained in:
Emery Hemingway 2020-02-21 22:55:50 +01:00
parent bfebc6dcef
commit 94868758e5
28 changed files with 541 additions and 510 deletions

View File

@ -4,13 +4,9 @@ let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let Args =
{ config : Genode.Init.Type
, rom : Genode.Prelude.Map.Type Text Genode.Boot.Rom
}
: Type
let Args = { config : Genode.Init.Type, rom : Genode.BootModules.Type } : Type
let RomEntry = Prelude.Map.Entry Text Genode.Boot.Rom
let RomEntry = Prelude.Map.Entry Text Genode.BootModules.ROM.Type
let addLine =
λ(e : RomEntry)

View File

@ -4,19 +4,21 @@ let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let RomEntry = Prelude.Map.Entry Text Genode.Boot.Rom
let BootModules = Genode.BootModules
let RomEntry = Prelude.Map.Entry Text BootModules.ROM.Type
let compile =
λ ( addressType
: Text
)
→ λ(rom : Prelude.Map.Type Text Genode.Boot.Rom)
→ λ(rom : Prelude.Map.Type Text BootModules.ROM.Type)
→ let NaturalIndex =
{ index : Natural, value : Text }
let TextIndex = { index : Text, value : Text }
let moduleKeys = Prelude.Map.keys Text Genode.Boot.Rom rom
let moduleKeys = Prelude.Map.keys Text BootModules.ROM.Type rom
let moduleValues =
let f =

View File

@ -5,11 +5,8 @@ let Genode = env:DHALL_GENODE
let render =
λ(boot : Genode.Boot.Type)
→ let rom =
[ { mapKey = "config"
, mapValue =
Genode.Boot.Rom.RomText (Genode.Init.render boot.config)
}
]
Genode.BootModules.toRomTexts
(toMap { config = Genode.Init.render boot.config })
# boot.rom
in rom

View File

@ -5,6 +5,9 @@ let Genode = env:DHALL_GENODE
let toRom =
λ(mapKey : Text)
→ λ(path : Text)
→ [ { mapKey = mapKey, mapValue = Genode.Boot.Rom.RomPath path } ]
→ [ { mapKey = mapKey
, mapValue = Genode.BootModules.ROM.Type.RomPath path
}
]
in toRom

View File

@ -41,11 +41,17 @@
shellHook = ''
export DHALL_PRELUDE="${packages.dhallPrelude}/package.dhall"
export DHALL_GENODE="${packages.dhallGenode}/package.dhall"
export BASE_MANIFEST="${packages.genode.base.manifest}"
export BASE_LINUX_MANIFEST="${packages.genode.base-linux.manifest}"
export BASE_HW_MANIFEST="${packages.base-hw-pc.manifest}"
export BASE_NOVA_MANIFEST="${packages.base-nova.manifest}"
export OS_MANIFEST="${packages.genode.os.manifest}"
export MANIFEST="${
with packages;
lib.mergeManifests [
base-hw-pc
base-nova
genode.base
genode.base-linux
genode.os
sotest-producer
]
}"
'';
};

View File

@ -6,8 +6,8 @@ stdenv.mkDerivation {
name = "dhall-genode";
src = fetchgit {
url = "https://git.sr.ht/~ehmry/dhall-genode";
rev = "472a300141766e58a68b605568eb881e0a944eca";
sha256 = "03lxxrzyfkgf9c31ds93ndr1bl3a4rlynj377n9rhniz9xzl11y3";
rev = "8d489b24fad71df04e0facae561bac17a25cb2a5";
sha256 = "0ngp1ipypf72z7nxsx1xxc051yx3gw7556nfgwsplpxa2y9msp0q";
};
DHALL_PRELUDE = prelude + "/package.dhall";
buildCommand = ''

View File

@ -4,6 +4,6 @@ let Genode = env:DHALL_GENODE
let sumRam =
λ(boot : Genode.Boot.Type)
→ let sum = Genode.Init.sumResources boot.config in sum.ram
→ let sum = Genode.Init.resources boot.config in sum.ram
in sumRam

View File

@ -21,7 +21,7 @@ let
nova = (call:
((tests call) // {
noux = call ./noux.nix { };
# noux = call ./noux.nix { };
pci = call ./pci.nix { };
rtc = call ./rtc.nix { };
})) (import ./driver-nova.nix {
@ -30,6 +30,7 @@ let
hw = (call:
((tests call) // {
# noux = call ./noux.nix { };
pci = call ./pci.nix { };
rtc = call ./rtc.nix { };
})) (import ./driver-hw.nix {

View File

@ -2,28 +2,27 @@
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
in λ(boot : Genode.Boot.Type)
→ { config =
Genode.Init::{
, defaultRoutes =
Genode.Init.default.defaultRoutes
# [ Genode.ServiceRoute.parent "IO_MEM"
, Genode.ServiceRoute.parent "IO_PORT"
, Genode.ServiceRoute.parent "IRQ"
, Genode.ServiceRoute.child "Timer" "timer"
]
Init::{
, children =
[ { mapKey = "timer"
, mapValue =
Genode.Init.Start::{
, binary = "hw_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 = "hw_timer_drv"
, provides = [ "Timer" ]
}
}
, { mapKey = "harness", mapValue = wrapHarness boot.config }
]
}
, rom =
@ -33,6 +32,7 @@ in λ(boot : Genode.Boot.Type)
[ manifest.base-hw-pc.lib.ld
, manifest.base-hw-pc.bin.hw_timer_drv
, manifest.os.bin.init
, manifest.sotest-producer.bin.sotest-harness
]
# boot.rom
}

View File

@ -34,20 +34,22 @@ let
'';
};
defaultScript = ''run_genode_until {child "init" exited with exit value 0} 60'';
defaultScript = ''run_genode_until {[init] child "harness" exited with exit value 0} 60'';
mkTest = { name ? "unamed", testScript ? defaultScript, testConfig, testInputs ? [ ]
, env ? { }, ... # TODO: remove ...
}@t:
let
testConfig' = "${./driver-hw-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})";
testConfig' = "${./driver-hw-config.dhall} ${testConfig}";
manifest = lib.mergeManifests (with testPkgs;
[ base-hw-pc genode.os sotest-producer ]
++ testInputs);
env' = {
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest;
XDG_CACHE_HOME = "/tmp";
} // env;
image = apps.hw-image.function env' testConfig';
@ -91,7 +93,7 @@ let
global env
global spawn_id
set TEST_MIB [expr ($env(TEST_RAM) / 1048576) + 12]
set TEST_MIB [expr ($env(TEST_RAM) / 1048576) + 16]
spawn ${hostPkgs.qemu_test}/bin/qemu-system-x86_64 \
-machine q35 -serial mon:stdio -nographic \
-m size=$TEST_MIB \
@ -112,6 +114,7 @@ let
preferLocalBuild = true;
testName = name;
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest;
} ''
mkdir -p $out/bin
@ -135,14 +138,12 @@ let
inherit driver image test manifest;
config = hostPkgs.runCommand (name + ".dhall") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.dhall.program} <<< "${testConfig'}" > $out
'';
iso = apps.hw-iso.function env' testConfig';
xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.render-init.program} "(${testConfig'}).config" > $out'';
sotest = hostPkgs.runCommand "hw-${name}-sotest" env' ''

View File

@ -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
}

View File

@ -38,11 +38,14 @@ let
, env ? { }, ... }:
with testPkgs;
let
testConfig' = "${./driver-linux-config.dhall} ${testConfig}";
env' = {
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = lib.mergeManifests (with testPkgs;
[ genode.base-linux genode.os sotest-producer ] ++ testInputs);
XDG_CACHE_HOME = "/tmp";
} // env;
toExports = env:
@ -70,8 +73,7 @@ let
global env
set env(XDG_CACHE_HOME) /tmp
exec ${apps.linux-image.program} \
${./driver-linux-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})
exec ${apps.linux-image.program} ${testConfig'}
spawn ./core-linux
wait_for_output $wait_for_re $timeout_value $spawn_id
@ -81,7 +83,7 @@ let
driver = with hostPkgs;
runCommand "genode-test-driver-${name}" {
buildInputs = [ makeWrapper expect ];
inherit baseSetup testConfig testScript;
inherit baseSetup testScript;
preferLocalBuild = true;
testName = name;
} ''
@ -99,18 +101,15 @@ let
in test // {
inherit driver test;
config = hostPkgs.runCommand (name + ".dhall") env' ''
${apps.dhall.program} <<< \
"(${./driver-linux-config.dhall} ${testConfig})" > $out
${apps.dhall.program} <<< "(${testConfig'}).config" > $out
'';
xml = hostPkgs.runCommand (name + ".config") env' ''
${apps.render-init.program} \
"(${./driver-linux-config.dhall} ${testConfig}).config" > $out
${apps.render-init.program} "(${testConfig'}).config" > $out
'';
image = hostPkgs.runCommand (name + ".config") env' ''
image = hostPkgs.runCommand (name + ".image.elf") env' ''
mkdir -p $out
pushd $out
${apps.linux-image.program} \
"${./driver-linux-config.dhall} ${testConfig}"
${apps.linux-image.program} "${testConfig'}"
'';
};

View File

@ -2,28 +2,27 @@
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
in λ(boot : Genode.Boot.Type)
→ { config =
Genode.Init::{
, defaultRoutes =
Genode.Init.default.defaultRoutes
# [ Genode.ServiceRoute.parent "IO_MEM"
, Genode.ServiceRoute.parent "IO_PORT"
, Genode.ServiceRoute.parent "IRQ"
, Genode.ServiceRoute.child "Timer" "timer"
]
Init::{
, children =
[ { mapKey = "timer"
, mapValue =
Genode.Init.Start::{
, binary = "nova_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 = "nova_timer_drv"
, provides = [ "Timer" ]
}
}
, { mapKey = "harness", mapValue = wrapHarness boot.config }
]
}
, rom =
@ -33,6 +32,7 @@ in λ(boot : Genode.Boot.Type)
[ manifest.base-nova.lib.ld
, manifest.base-nova.bin.nova_timer_drv
, manifest.os.bin.init
, manifest.sotest-producer.bin.sotest-harness
]
# boot.rom
}

View File

@ -34,20 +34,22 @@ let
'';
};
defaultScript = ''run_genode_until {child "init" exited with exit value 0} 60'';
defaultScript = ''run_genode_until {[init] child "harness" exited with exit value 0} 60'';
mkTest = { name ? "unamed", testScript ? defaultScript, testConfig, testInputs ? [ ]
, env ? { }, ... # TODO: remove ...
}@t:
let
testConfig' = "${./driver-nova-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})";
testConfig' = "${./driver-nova-config.dhall} ${testConfig}";
manifest = lib.mergeManifests (with testPkgs;
[ base-nova genode.os sotest-producer ]
++ testInputs);
env' = {
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest;
XDG_CACHE_HOME = "/tmp";
} // env;
image = apps.nova-image.function env' testConfig';
@ -112,6 +114,7 @@ let
preferLocalBuild = true;
testName = name;
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest;
} ''
mkdir -p $out/bin
@ -142,7 +145,6 @@ let
iso = apps.nova-iso.function env' "${testConfig'}";
xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.render-init.program} "(${testConfig'}).config" > $out'';
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''

View File

@ -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
]
}

View File

@ -2,18 +2,24 @@
let Genode = env:DHALL_GENODE
let Child = Genode.Init.Child
in { config =
Genode.Init::{
, verbose = True
, children =
toMap
{ test-log =
Genode.Init.Start::{
, binary = "test-log"
, exitPropagate = True
, resources = { caps = 500, ram = Genode.units.MiB 10 }
, routes = [ Genode.ServiceRoute.parent "Timer" ]
}
Child.flat
Child.Attributes::{
, binary = "test-log"
, exitPropagate = True
, resources =
Genode.Init.Resources::{
, caps = 500
, ram = Genode.units.MiB 10
}
, routes = [ Genode.Init.ServiceRoute.parent "Timer" ]
}
}
}
, rom =

View File

@ -2,37 +2,49 @@
let Genode = env:DHALL_GENODE
let Child = Genode.Init.Child
in { config =
Genode.Init::{
, verbose = True
, children =
toMap
{ noux =
Genode.Init.Start::{
, binary = "noux"
, exitPropagate = True
, resources = { caps = 500, ram = Genode.units.MiB 10 }
, routes = [ Genode.ServiceRoute.parent "Timer" ]
, config =
Some
( Genode.Prelude.XML.text
''
<config stdin="/script" stdout="/dev/log" stderr="/dev/log">
<fstab>
<tar name="bash-minimal.tar" />
<dir name="dev"> <log/> <null/> <zero/> </dir>
<dir name="tmp"> <ram /> </dir>
<inline name="script">
echo "hello world"
</inline>
</fstab>
<start name="/bin/bash">
<env name="TERM" value="screen" />
</start>
</config>
''
)
}
Child.flat
Child.Attributes::{
, binary = "noux"
, exitPropagate = True
, resources =
Genode.Init.Resources::{
, caps = 500
, ram = Genode.units.MiB 10
}
, routes = [ Genode.Init.ServiceRoute.parent "Timer" ]
, config =
Genode.Init.Config::{
, attributes =
toMap
{ stdin = "/script"
, stdout = "/dev/log"
, stderr = "/dev/log"
}
, content =
[ Genode.Prelude.XML.text
''
<fstab>
<tar name="bash-minimal.tar" />
<dir name="dev"> <log/> <null/> <zero/> </dir>
<dir name="tmp"> <ram /> </dir>
<inline name="script">
echo "hello world"
</inline>
</fstab>
<start name="/bin/bash">
<env name="TERM" value="screen" />
</start>
''
]
}
}
}
}
, rom =

View File

@ -2,75 +2,95 @@
let Genode = env:DHALL_GENODE
let XML = Genode.Prelude.XML
let Init = Genode.Init
let Child = Init.Child
let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
in { config =
Genode.Init::{
Init::{
, verbose = True
, children =
toMap
{ test-pci =
Genode.Init.Start::{
, binary = "test-pci"
, exitPropagate = True
, resources = { caps = 96, ram = Genode.units.MiB 3 }
, routes =
[ Genode.ServiceRoute.child "Platform" "platform_drv" ]
}
Child.flat
Child.Attributes::{
, binary = "test-pci"
, exitPropagate = True
, resources = Resources::{ ram = Genode.units.MiB 3 }
, routes = [ ServiceRoute.child "Platform" "platform_drv" ]
}
, acpi_report_rom =
Genode.Init.Start::{
, binary = "report_rom"
, resources = { caps = 96, ram = Genode.units.MiB 2 }
, provides = [ "ROM", "Report" ]
, config =
Some
( Genode.Prelude.XML.text
''
<config system="yes">
<policy label="smbios_decoder -> smbios_table" report="acpi_drv -> smbios_table"/>
<policy label="platform_drv -> acpi" report="acpi_drv -> acpi"/>
</config>
''
)
}
Child.flat
Child.Attributes::{
, binary = "report_rom"
, provides = [ "ROM", "Report" ]
, config =
Init.Config::{
, content =
[ XML.text
''
<policy label="smbios_decoder -> smbios_table" report="acpi_drv -> smbios_table"/>
<policy label="platform_drv -> acpi" report="acpi_drv -> acpi"/>
''
]
}
}
, acpi_drv =
Genode.Init.Start::{
, binary = "acpi_drv"
, resources = { caps = 400, ram = Genode.units.MiB 4 }
, constrainPhys = True
, provides = [ "Platform", "Acpi" ]
, routes =
[ Genode.ServiceRoute.child "Report" "acpi_report_rom"
, Genode.ServiceRoute.parent "IRQ"
, Genode.ServiceRoute.parent "IO_MEM"
, Genode.ServiceRoute.parent "IO_PORT"
]
}
Child.flat
Child.Attributes::{
, binary = "acpi_drv"
, resources =
Resources::{
, caps = 400
, ram = Genode.units.MiB 4
, constrainPhys = True
}
, provides = [ "Platform", "Acpi" ]
, routes =
[ ServiceRoute.child "Report" "acpi_report_rom"
, ServiceRoute.parent "IRQ"
, ServiceRoute.parent "IO_MEM"
, ServiceRoute.parent "IO_PORT"
]
}
, platform_drv =
Genode.Init.Start::{
, binary = "platform_drv"
, resources = { caps = 800, ram = Genode.units.MiB 4 }
, constrainPhys = True
, provides = [ "Platform", "Acpi" ]
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.parent "IRQ"
, Genode.ServiceRoute.parent "IO_MEM"
, Genode.ServiceRoute.parent "IO_PORT"
, Genode.ServiceRoute.childLabel
"ROM"
"acpi_report_rom"
(Some "acpi")
(None Text)
]
, config =
Some
( Genode.Prelude.XML.text
''
<config>
<policy label_prefix="test-pci"> <pci class="ALL"/> </policy>
</config>
''
)
}
Child.flat
Child.Attributes::{
, binary = "platform_drv"
, resources =
Resources::{
, caps = 800
, ram = Genode.units.MiB 4
, constrainPhys = True
}
, provides = [ "Platform", "Acpi" ]
, routes =
[ ServiceRoute.parent "Timer"
, ServiceRoute.parent "IRQ"
, ServiceRoute.parent "IO_MEM"
, ServiceRoute.parent "IO_PORT"
, ServiceRoute.childLabel
"ROM"
"acpi_report_rom"
(Some "acpi")
(None Text)
]
, config =
Init.Config::{
, content =
[ XML.text
''
<policy label_prefix="test-pci"> <pci class="ALL"/> </policy>
''
]
}
}
}
}
, rom =

View File

@ -2,27 +2,29 @@
let Genode = env:DHALL_GENODE
let Child = Genode.Init.Child
in { config =
Genode.Init::{
, verbose = True
, children =
toMap
{ test-rtc =
Genode.Init.Start::{
, binary = "test-rtc"
, resources = { caps = 128, ram = Genode.units.MiB 2 }
, exitPropagate = True
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.child "Rtc" "rtc_drv"
]
}
Child.flat
Child.Attributes::{
, binary = "test-rtc"
, exitPropagate = True
, routes =
[ Genode.Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.child "Rtc" "rtc_drv"
]
}
, rtc_drv =
Genode.Init.Start::{
, binary = "rtc_drv"
, provides = [ "Rtc" ]
, routes = [ Genode.ServiceRoute.parent "IO_PORT" ]
}
Child.flat
Child.Attributes::{
, binary = "rtc_drv"
, provides = [ "Rtc" ]
, routes = [ Genode.Init.ServiceRoute.parent "IO_PORT" ]
}
}
}
, rom =

View File

@ -2,17 +2,27 @@
let Genode = env:DHALL_GENODE
let Init = Genode.Init
let Child = Init.Child
in { config =
Genode.Init::{
, verbose = True
Init::{
, children =
toMap
{ test-signal =
Genode.Init.Start::{
, binary = "test-signal"
, exitPropagate = True
, resources = { caps = 500, ram = Genode.units.MiB 10 }
}
Child.flat
Child.Attributes::{
, binary = "test-signal"
, exitPropagate = True
, priority = 5
, resources =
Init.Resources::{
, caps = 500
, ram = Genode.units.MiB 10
}
, routes = [ Init.ServiceRoute.parent "Timer" ]
}
}
}
, rom =

View File

@ -2,38 +2,45 @@
let Genode = env:DHALL_GENODE
let manifest = env:MANIFEST
let Init = Genode.Init
let Child = Init.Child
in { config =
Genode.Init::{
Init::{
, children =
toMap
{ solo5 =
Genode.Init.Start::{
, binary = "solo5-test_blk"
, exitPropagate = True
, resources = { caps = 256, ram = Genode.units.MiB 3 }
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.child "Block" "block"
]
}
Child.flat
Child.Attributes::{
, binary = "solo5-test_blk"
, exitPropagate = True
, resources =
Init.Resources::{ caps = 256, ram = Genode.units.MiB 3 }
, routes =
[ Init.ServiceRoute.parent "Timer"
, Init.ServiceRoute.child "Block" "block"
]
}
, block =
Genode.Init.Start::{
, binary = "ram_block"
, provides = [ "Block" ]
, resources = { caps = 96, ram = Genode.units.MiB 9 }
, config =
Some
( Genode.Prelude.XML.text
''
<config size="8M" block_size="4096"/>
''
)
}
Child.flat
Child.Attributes::{
, binary = "ram_block"
, provides = [ "Block" ]
, resources = Init.Resources::{ ram = Genode.units.MiB 9 }
, config =
Init.Config::{
, attributes =
toMap { size = "8M", block_size = "4096" }
}
}
}
}
, rom =
Genode.Boot.toRomPaths
[ manifest.solo5-tests.bin.solo5-test_blk, manifest.os.bin.ram_block ]
let manifest = env:MANIFEST
in Genode.BootModules.toRomPaths
[ manifest.solo5-tests.bin.solo5-test_blk
, manifest.os.bin.ram_block
]
}

View File

@ -2,12 +2,9 @@
let Genode = env:DHALL_GENODE
let RomMap = Genode.Prelude.Map.Type Text Genode.Boot.Rom
let Args = { config : Genode.Init.Type, rom : RomMap } : Type
in λ(boot : Args)
in λ(boot : Genode.Boot.Type)
→ { config = boot.config
, rom =
Genode.Boot.toRomPaths [ (env:MANIFEST).solo5.lib.solo5 ] # boot.rom
Genode.BootModules.toRomPaths [ (env:MANIFEST).solo5.lib.solo5 ]
# boot.rom
}

View File

@ -50,17 +50,11 @@ let
{
name = "net";
testConfig = ./net.dhall;
testScript = ''
run_genode_until {child "init" exited with exit value 0} 30
'';
}
{
name = "net_2if";
testConfig = ./net_2if.dhall;
testScript = ''
run_genode_until {child "init" exited with exit value 0} 30
'';
}
{

View File

@ -2,78 +2,89 @@
let Genode = env:DHALL_GENODE
let manifest = env:MANIFEST
let Init = Genode.Init
let Child = Init.Child
let Res = Init.Resources
let ServiceRoute = Init.ServiceRoute
in { config =
Genode.Init::{
Init::{
, children =
toMap
{ nic =
Genode.Init.Start::{
, binary = "nic_loopback"
, provides = [ "Nic" ]
}
Child.flat
Child.Attributes::{
, binary = "nic_loopback"
, provides = [ "Nic" ]
}
, bridge =
Genode.Init.Start::{
, binary = "nic_bridge"
, resources = { caps = 200, ram = Genode.units.MiB 6 }
, provides = [ "Nic" ]
, routes = [ Genode.ServiceRoute.child "Nic" "nic" ]
, config =
Some
( Genode.Prelude.XML.text
''
<config mac="02:02:02:02:03:00" verbose="no">
<policy label_prefix="solo5" ip_addr="10.0.0.2"/>
<default-policy/>
</config>
''
)
}
Child.flat
Child.Attributes::{
, binary = "nic_bridge"
, resources = Res::{ caps = 200, ram = Genode.units.MiB 6 }
, provides = [ "Nic" ]
, routes = [ ServiceRoute.child "Nic" "nic" ]
, config =
Init.Config::{
, attributes = toMap { mac = "02:02:02:02:03:00" }
, content =
[ Genode.Prelude.XML.text
''
<policy label_prefix="solo5" ip_addr="10.0.0.2"/>
<default-policy/>
''
]
}
}
, solo5 =
Genode.Init.Start::{
, binary = "solo5-test_net"
, resources = { caps = 256, ram = Genode.units.MiB 3 }
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.child "Nic" "bridge"
]
, config =
Some
( Genode.Prelude.XML.text
"<config><cmdline>limit</cmdline></config>"
)
}
Child.flat
Child.Attributes::{
, binary = "solo5-test_net"
, resources = Res::{ caps = 256, ram = Genode.units.MiB 3 }
, routes =
[ ServiceRoute.parent "Timer"
, ServiceRoute.child "Nic" "bridge"
]
, config =
Init.Config::{
, content =
[ Genode.Prelude.XML.text "<cmdline>limit</cmdline>"
]
}
}
, ping =
Genode.Init.Start::{
, binary = "ping"
, exitPropagate = True
, resources = { caps = 128, ram = Genode.units.MiB 6 }
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.child "Nic" "bridge"
]
, config =
Some
( Genode.Prelude.XML.leaf
{ name = "config"
, attributes =
toMap
{ interface = "10.0.0.72/24"
, dst_ip = "10.0.0.2"
, period_sec = "1"
, verbose = "no"
}
}
)
}
Child.flat
Child.Attributes::{
, binary = "ping"
, exitPropagate = True
, resources = Res::{ caps = 128, ram = Genode.units.MiB 6 }
, routes =
[ ServiceRoute.parent "Timer"
, ServiceRoute.child "Nic" "bridge"
]
, config =
Init.Config::{
, attributes =
toMap
{ interface = "10.0.0.72/24"
, dst_ip = "10.0.0.2"
, period_sec = "1"
, verbose = "no"
}
}
}
}
}
, rom =
Genode.Boot.toRomPaths
[ manifest.os.bin.nic_loopback
, manifest.os.bin.nic_bridge
, manifest.os.bin.ping
, manifest.solo5-tests.bin.solo5-test_net
]
let manifest = env:MANIFEST
in Genode.BootModules.toRomPaths
[ manifest.os.bin.nic_loopback
, manifest.os.bin.nic_bridge
, manifest.os.bin.ping
, manifest.solo5-tests.bin.solo5-test_net
]
}

View File

@ -2,85 +2,97 @@
let Genode = env:DHALL_GENODE
let manifest = env:MANIFEST
let Init = Genode.Init
let Child = Init.Child
let Res = Init.Resources
in { config =
Genode.Init::{
Init::{
, children =
toMap
{ nic =
Genode.Init.Start::{
, binary = "nic_loopback"
, provides = [ "Nic" ]
}
Child.flat
Child.Attributes::{
, binary = "nic_loopback"
, provides = [ "Nic" ]
}
, bridge =
Genode.Init.Start::{
, binary = "nic_bridge"
, resources = { caps = 200, ram = Genode.units.MiB 8 }
, provides = [ "Nic" ]
, routes = [ Genode.ServiceRoute.child "Nic" "nic" ]
, config =
Some
( Genode.Prelude.XML.text
''
<config mac="02:02:02:02:03:00" verbose="no">
<policy label="solo5 -> service0" ip_addr="10.0.0.2"/>
<policy label="solo5 -> service1" ip_addr="10.1.0.2"/>
<default-policy/>
</config>
''
)
}
Child.flat
Child.Attributes::{
, binary = "nic_bridge"
, resources = Res::{ caps = 200, ram = Genode.units.MiB 8 }
, provides = [ "Nic" ]
, routes = [ Genode.Init.ServiceRoute.child "Nic" "nic" ]
, config =
Init.Config::{
, content =
[ Genode.Prelude.XML.text
''
<policy label="solo5 -> service0" ip_addr="10.0.0.2"/>
<policy label="solo5 -> service1" ip_addr="10.1.0.2"/>
<default-policy/>
''
]
}
}
, solo5 =
Genode.Init.Start::{
, binary = "solo5-test_net_2if"
, resources = { caps = 256, ram = Genode.units.MiB 5 }
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.child "Nic" "bridge"
]
, config =
Some
( Genode.Prelude.XML.text
''
<config><cmdline>limit</cmdline></config>
''
)
}
Child.flat
Child.Attributes::{
, binary = "solo5-test_net_2if"
, resources = Res::{ caps = 256, ram = Genode.units.MiB 5 }
, routes =
[ Genode.Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.child "Nic" "bridge"
]
, config =
Init.Config::{
, content =
[ Genode.Prelude.XML.text
''
"<cmdline>limit</cmdline>"
''
]
}
}
, clients =
Genode.Init.Start::{
, binary = "sequence"
, exitPropagate = True
, resources = { caps = 256, ram = Genode.units.MiB 8 }
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.child "Nic" "bridge"
]
, config =
Some
( Genode.Prelude.XML.text
''
<config>
<start name="ping0">
<binary name="ping"/>
<config interface="10.0.0.72/24" dst_ip="10.0.0.2" period_sec="1" count="4"/>
</start>
<start name="ping1">
<binary name="ping"/>
<config interface="10.1.0.72/24" dst_ip="10.1.0.2" period_sec="1" count="4"/>
</start>
</config>
''
)
}
Child.flat
Child.Attributes::{
, binary = "sequence"
, exitPropagate = True
, resources = Res::{ caps = 256, ram = Genode.units.MiB 8 }
, routes =
[ Genode.Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.child "Nic" "bridge"
]
, config =
Init.Config::{
, content =
[ Genode.Prelude.XML.text
''
<start name="ping0">
<binary name="ping"/>
<config interface="10.0.0.72/24" dst_ip="10.0.0.2" period_sec="1" count="4"/>
</start>
<start name="ping1">
<binary name="ping"/>
<config interface="10.1.0.72/24" dst_ip="10.1.0.2" period_sec="1" count="4"/>
</start>
''
]
}
}
}
}
, rom =
Genode.Boot.toRomPaths
[ manifest.solo5-tests.bin.solo5-test_net_2if
, manifest.os.bin.sequence
, manifest.os.bin.nic_bridge
, manifest.os.bin.nic_loopback
, manifest.os.bin.ping
]
let manifest = env:MANIFEST
in Genode.BootModules.toRomPaths
[ manifest.solo5-tests.bin.solo5-test_net_2if
, manifest.os.bin.sequence
, manifest.os.bin.nic_bridge
, manifest.os.bin.nic_loopback
, manifest.os.bin.ping
]
}

View File

@ -2,37 +2,42 @@
let Genode = env:DHALL_GENODE
in λ(testBinary : Genode.Prelude.Map.Entry Text Text)
let Prelude = Genode.Prelude
let Init = Genode.Init
let Child = Init.Child
let Config = Init.Config
in λ(testBinary : Prelude.Map.Entry Text Text)
→ { config =
Genode.Init::{
Init::{
, children =
toMap
{ solo5 =
Genode.Init.Start::{
, binary = testBinary.mapKey
, exitPropagate = True
, resources = { caps = 256, ram = Genode.units.MiB 3 }
, config =
Some
( Genode.Prelude.XML.element
{ name = "config"
, attributes =
[] : Genode.Prelude.Map.Type Text Text
, content =
[ Genode.Prelude.XML.element
{ name = "cmdline"
, attributes =
[] : Genode.Prelude.Map.Type Text Text
, content =
[ Genode.Prelude.XML.text
"Hello_Solo5"
]
}
]
}
)
}
Child.flat
Child.Attributes::{
, binary = testBinary.mapKey
, exitPropagate = True
, resources =
Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 3
}
, config =
Config::{
, content =
[ Prelude.XML.element
{ name = "cmdline"
, attributes = Prelude.XML.emptyAttributes
, content = [ Prelude.XML.text "Hello_Solo5" ]
}
]
}
, routes = [ Init.ServiceRoute.parent "Timer" ]
}
}
}
, rom = Genode.Boot.toRomPaths [ testBinary ]
, rom = Genode.BootModules.toRomPaths [ testBinary ]
}

View File

@ -2,31 +2,41 @@
let Genode = env:DHALL_GENODE
let manifest = env:MANIFEST
let test = manifest.solo5-tests.bin.solo5-test_time
let Child = Genode.Init.Child
in { config =
Genode.Init::{
, children =
toMap
{ solo5 =
Genode.Init.Start::{
, binary = test.mapKey
, exitPropagate = True
, resources = { caps = 256, ram = Genode.units.MiB 3 }
, routes =
[ Genode.ServiceRoute.parent "Timer"
, Genode.ServiceRoute.child "Rtc" "clock"
]
}
Child.flat
Child.Attributes::{
, binary = "solo5-test_time"
, exitPropagate = True
, resources =
Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 3
}
, routes =
[ Genode.Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.child "Rtc" "clock"
]
}
, clock =
Genode.Init.Start::{
, binary = "rtc_drv"
, provides = [ "Rtc" ]
, routes = [ Genode.ServiceRoute.parent "IO_PORT" ]
}
Child.flat
Child.Attributes::{
, binary = "rtc_drv"
, provides = [ "Rtc" ]
, routes = [ Genode.Init.ServiceRoute.parent "IO_PORT" ]
}
}
}
, rom = Genode.Boot.toRomPaths [ test, manifest.os.bin.rtc_drv ]
, rom =
let manifest = env:MANIFEST
in Genode.BootModules.toRomPaths
[ manifest.solo5-tests.bin.solo5-test_time
, manifest.os.bin.rtc_drv
]
}

View File

@ -1,53 +1,29 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let Init = Genode.Init
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 Child = Init.Child
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