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 Prelude = Genode.Prelude
let Args = let Args = { config : Genode.Init.Type, rom : Genode.BootModules.Type } : Type
{ config : Genode.Init.Type
, rom : Genode.Prelude.Map.Type Text Genode.Boot.Rom
}
: Type
let RomEntry = Prelude.Map.Entry Text Genode.Boot.Rom let RomEntry = Prelude.Map.Entry Text Genode.BootModules.ROM.Type
let addLine = let addLine =
λ(e : RomEntry) λ(e : RomEntry)

View File

@ -4,19 +4,21 @@ let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude 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 = let compile =
λ ( addressType λ ( addressType
: Text : Text
) )
→ λ(rom : Prelude.Map.Type Text Genode.Boot.Rom) → λ(rom : Prelude.Map.Type Text BootModules.ROM.Type)
→ let NaturalIndex = → let NaturalIndex =
{ index : Natural, value : Text } { index : Natural, value : Text }
let TextIndex = { index : Text, 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 moduleValues =
let f = let f =

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,6 @@ let Genode = env:DHALL_GENODE
let sumRam = let sumRam =
λ(boot : Genode.Boot.Type) λ(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 in sumRam

View File

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

View File

@ -2,28 +2,27 @@
let Genode = env:DHALL_GENODE 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) in λ(boot : Genode.Boot.Type)
→ { config = → { config =
Genode.Init::{ 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"
]
, children = , children =
[ { mapKey = "timer" [ { mapKey = "timer"
, mapValue = , mapValue =
Genode.Init.Start::{ Child.flat
, binary = "hw_timer_drv" Child.Attributes::{
, resources = { caps = 96, ram = Genode.units.MiB 1 } , binary = "hw_timer_drv"
, provides = [ "Timer" ] , provides = [ "Timer" ]
} }
}
, { mapKey = "harness"
, mapValue = Genode.Init.toStart boot.config
} }
, { mapKey = "harness", mapValue = wrapHarness boot.config }
] ]
} }
, rom = , rom =
@ -33,6 +32,7 @@ in λ(boot : Genode.Boot.Type)
[ manifest.base-hw-pc.lib.ld [ manifest.base-hw-pc.lib.ld
, manifest.base-hw-pc.bin.hw_timer_drv , manifest.base-hw-pc.bin.hw_timer_drv
, manifest.os.bin.init , manifest.os.bin.init
, manifest.sotest-producer.bin.sotest-harness
] ]
# boot.rom # 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 ? [ ] mkTest = { name ? "unamed", testScript ? defaultScript, testConfig, testInputs ? [ ]
, env ? { }, ... # TODO: remove ... , env ? { }, ... # TODO: remove ...
}@t: }@t:
let let
testConfig' = "${./driver-hw-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})"; testConfig' = "${./driver-hw-config.dhall} ${testConfig}";
manifest = lib.mergeManifests (with testPkgs; manifest = lib.mergeManifests (with testPkgs;
[ base-hw-pc genode.os sotest-producer ] [ base-hw-pc genode.os sotest-producer ]
++ testInputs); ++ testInputs);
env' = { env' = {
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall"; DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall"; DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest; MANIFEST = manifest;
XDG_CACHE_HOME = "/tmp";
} // env; } // env;
image = apps.hw-image.function env' testConfig'; image = apps.hw-image.function env' testConfig';
@ -91,7 +93,7 @@ let
global env global env
global spawn_id 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 \ spawn ${hostPkgs.qemu_test}/bin/qemu-system-x86_64 \
-machine q35 -serial mon:stdio -nographic \ -machine q35 -serial mon:stdio -nographic \
-m size=$TEST_MIB \ -m size=$TEST_MIB \
@ -112,6 +114,7 @@ let
preferLocalBuild = true; preferLocalBuild = true;
testName = name; testName = name;
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall"; DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest; MANIFEST = manifest;
} '' } ''
mkdir -p $out/bin mkdir -p $out/bin
@ -135,14 +138,12 @@ let
inherit driver image test manifest; inherit driver image test manifest;
config = hostPkgs.runCommand (name + ".dhall") env' '' config = hostPkgs.runCommand (name + ".dhall") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.dhall.program} <<< "${testConfig'}" > $out ${apps.dhall.program} <<< "${testConfig'}" > $out
''; '';
iso = apps.hw-iso.function env' testConfig'; iso = apps.hw-iso.function env' testConfig';
xml = hostPkgs.runCommand (name + ".config") env' '' xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.render-init.program} "(${testConfig'}).config" > $out''; ${apps.render-init.program} "(${testConfig'}).config" > $out'';
sotest = hostPkgs.runCommand "hw-${name}-sotest" env' '' sotest = hostPkgs.runCommand "hw-${name}-sotest" env' ''

View File

@ -1,36 +1,41 @@
-- SPDX-License-Identifier: CC0-1.0 -- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE 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) in λ(boot : Genode.Boot.Type)
→ { config = → { config =
Genode.Init::{ Genode.Init::{
, verbose = True
, defaultRoutes =
Genode.Init.default.defaultRoutes
# [ Genode.ServiceRoute.child "Timer" "timer" ]
, children = , children =
[ { mapKey = "timer" [ { mapKey = "timer"
, mapValue = , mapValue =
Genode.Init.Start::{ Child.flat
, binary = "linux_timer_drv" Child.Attributes::{
, resources = { caps = 96, ram = Genode.units.MiB 1 } , binary = "linux_timer_drv"
, provides = [ "Timer" ] , provides = [ "Timer" ]
} }
}
, { mapKey = "harness"
, mapValue = Genode.Init.toStart boot.config
} }
, { mapKey = "harness", mapValue = wrapHarness boot.config }
] ]
} }
, rom = , rom =
let manifest = env:MANIFEST let manifest = env:MANIFEST
in Genode.Boot.toRomPaths in Genode.BootModules.toRomPaths
[ manifest.base-linux.bin.core-linux [ manifest.base-linux.bin.core-linux
, manifest.base-linux.bin.ld , manifest.base-linux.bin.ld
, manifest.base-linux.bin.linux_timer_drv , manifest.base-linux.bin.linux_timer_drv
, manifest.os.bin.init , manifest.os.bin.init
, manifest.sotest-producer.bin.sotest-harness
] ]
# boot.rom # boot.rom
: Genode.Prelude.Map.Type Text Genode.Boot.Rom : Genode.BootModules.Type
} }

View File

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

View File

@ -2,28 +2,27 @@
let Genode = env:DHALL_GENODE 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) in λ(boot : Genode.Boot.Type)
→ { config = → { config =
Genode.Init::{ 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"
]
, children = , children =
[ { mapKey = "timer" [ { mapKey = "timer"
, mapValue = , mapValue =
Genode.Init.Start::{ Child.flat
, binary = "nova_timer_drv" Child.Attributes::{
, resources = { caps = 96, ram = Genode.units.MiB 1 } , binary = "nova_timer_drv"
, provides = [ "Timer" ] , provides = [ "Timer" ]
} }
}
, { mapKey = "harness"
, mapValue = Genode.Init.toStart boot.config
} }
, { mapKey = "harness", mapValue = wrapHarness boot.config }
] ]
} }
, rom = , rom =
@ -33,6 +32,7 @@ in λ(boot : Genode.Boot.Type)
[ manifest.base-nova.lib.ld [ manifest.base-nova.lib.ld
, manifest.base-nova.bin.nova_timer_drv , manifest.base-nova.bin.nova_timer_drv
, manifest.os.bin.init , manifest.os.bin.init
, manifest.sotest-producer.bin.sotest-harness
] ]
# boot.rom # 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 ? [ ] mkTest = { name ? "unamed", testScript ? defaultScript, testConfig, testInputs ? [ ]
, env ? { }, ... # TODO: remove ... , env ? { }, ... # TODO: remove ...
}@t: }@t:
let let
testConfig' = "${./driver-nova-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})"; testConfig' = "${./driver-nova-config.dhall} ${testConfig}";
manifest = lib.mergeManifests (with testPkgs; manifest = lib.mergeManifests (with testPkgs;
[ base-nova genode.os sotest-producer ] [ base-nova genode.os sotest-producer ]
++ testInputs); ++ testInputs);
env' = { env' = {
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall"; DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall"; DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest; MANIFEST = manifest;
XDG_CACHE_HOME = "/tmp";
} // env; } // env;
image = apps.nova-image.function env' testConfig'; image = apps.nova-image.function env' testConfig';
@ -112,6 +114,7 @@ let
preferLocalBuild = true; preferLocalBuild = true;
testName = name; testName = name;
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall"; DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
DHALL_WRAP_HARNESS = ./sotest-wrapper.dhall;
MANIFEST = manifest; MANIFEST = manifest;
} '' } ''
mkdir -p $out/bin mkdir -p $out/bin
@ -142,7 +145,6 @@ let
iso = apps.nova-iso.function env' "${testConfig'}"; iso = apps.nova-iso.function env' "${testConfig'}";
xml = hostPkgs.runCommand (name + ".config") env' '' xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.render-init.program} "(${testConfig'}).config" > $out''; ${apps.render-init.program} "(${testConfig'}).config" > $out'';
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' '' 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 Genode = env:DHALL_GENODE
let Child = Genode.Init.Child
in { config = in { config =
Genode.Init::{ Genode.Init::{
, verbose = True
, children = , children =
toMap toMap
{ test-log = { test-log =
Genode.Init.Start::{ Child.flat
, binary = "test-log" Child.Attributes::{
, exitPropagate = True , binary = "test-log"
, resources = { caps = 500, ram = Genode.units.MiB 10 } , exitPropagate = True
, routes = [ Genode.ServiceRoute.parent "Timer" ] , resources =
} Genode.Init.Resources::{
, caps = 500
, ram = Genode.units.MiB 10
}
, routes = [ Genode.Init.ServiceRoute.parent "Timer" ]
}
} }
} }
, rom = , rom =

View File

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

View File

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

View File

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

View File

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

View File

@ -2,38 +2,45 @@
let Genode = env:DHALL_GENODE let Genode = env:DHALL_GENODE
let manifest = env:MANIFEST let Init = Genode.Init
let Child = Init.Child
in { config = in { config =
Genode.Init::{ Init::{
, children = , children =
toMap toMap
{ solo5 = { solo5 =
Genode.Init.Start::{ Child.flat
, binary = "solo5-test_blk" Child.Attributes::{
, exitPropagate = True , binary = "solo5-test_blk"
, resources = { caps = 256, ram = Genode.units.MiB 3 } , exitPropagate = True
, routes = , resources =
[ Genode.ServiceRoute.parent "Timer" Init.Resources::{ caps = 256, ram = Genode.units.MiB 3 }
, Genode.ServiceRoute.child "Block" "block" , routes =
] [ Init.ServiceRoute.parent "Timer"
} , Init.ServiceRoute.child "Block" "block"
]
}
, block = , block =
Genode.Init.Start::{ Child.flat
, binary = "ram_block" Child.Attributes::{
, provides = [ "Block" ] , binary = "ram_block"
, resources = { caps = 96, ram = Genode.units.MiB 9 } , provides = [ "Block" ]
, config = , resources = Init.Resources::{ ram = Genode.units.MiB 9 }
Some , config =
( Genode.Prelude.XML.text Init.Config::{
'' , attributes =
<config size="8M" block_size="4096"/> toMap { size = "8M", block_size = "4096" }
'' }
) }
}
} }
} }
, rom = , rom =
Genode.Boot.toRomPaths let manifest = env:MANIFEST
[ manifest.solo5-tests.bin.solo5-test_blk, manifest.os.bin.ram_block ]
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 Genode = env:DHALL_GENODE
let RomMap = Genode.Prelude.Map.Type Text Genode.Boot.Rom in λ(boot : Genode.Boot.Type)
let Args = { config : Genode.Init.Type, rom : RomMap } : Type
in λ(boot : Args)
→ { config = boot.config → { config = boot.config
, rom = , 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"; name = "net";
testConfig = ./net.dhall; testConfig = ./net.dhall;
testScript = ''
run_genode_until {child "init" exited with exit value 0} 30
'';
} }
{ {
name = "net_2if"; name = "net_2if";
testConfig = ./net_2if.dhall; 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 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 = in { config =
Genode.Init::{ Init::{
, children = , children =
toMap toMap
{ nic = { nic =
Genode.Init.Start::{ Child.flat
, binary = "nic_loopback" Child.Attributes::{
, provides = [ "Nic" ] , binary = "nic_loopback"
} , provides = [ "Nic" ]
}
, bridge = , bridge =
Genode.Init.Start::{ Child.flat
, binary = "nic_bridge" Child.Attributes::{
, resources = { caps = 200, ram = Genode.units.MiB 6 } , binary = "nic_bridge"
, provides = [ "Nic" ] , resources = Res::{ caps = 200, ram = Genode.units.MiB 6 }
, routes = [ Genode.ServiceRoute.child "Nic" "nic" ] , provides = [ "Nic" ]
, config = , routes = [ ServiceRoute.child "Nic" "nic" ]
Some , config =
( Genode.Prelude.XML.text Init.Config::{
'' , attributes = toMap { mac = "02:02:02:02:03:00" }
<config mac="02:02:02:02:03:00" verbose="no"> , content =
<policy label_prefix="solo5" ip_addr="10.0.0.2"/> [ Genode.Prelude.XML.text
<default-policy/> ''
</config> <policy label_prefix="solo5" ip_addr="10.0.0.2"/>
'' <default-policy/>
) ''
} ]
}
}
, solo5 = , solo5 =
Genode.Init.Start::{ Child.flat
, binary = "solo5-test_net" Child.Attributes::{
, resources = { caps = 256, ram = Genode.units.MiB 3 } , binary = "solo5-test_net"
, routes = , resources = Res::{ caps = 256, ram = Genode.units.MiB 3 }
[ Genode.ServiceRoute.parent "Timer" , routes =
, Genode.ServiceRoute.child "Nic" "bridge" [ ServiceRoute.parent "Timer"
] , ServiceRoute.child "Nic" "bridge"
, config = ]
Some , config =
( Genode.Prelude.XML.text Init.Config::{
"<config><cmdline>limit</cmdline></config>" , content =
) [ Genode.Prelude.XML.text "<cmdline>limit</cmdline>"
} ]
}
}
, ping = , ping =
Genode.Init.Start::{ Child.flat
, binary = "ping" Child.Attributes::{
, exitPropagate = True , binary = "ping"
, resources = { caps = 128, ram = Genode.units.MiB 6 } , exitPropagate = True
, routes = , resources = Res::{ caps = 128, ram = Genode.units.MiB 6 }
[ Genode.ServiceRoute.parent "Timer" , routes =
, Genode.ServiceRoute.child "Nic" "bridge" [ ServiceRoute.parent "Timer"
] , ServiceRoute.child "Nic" "bridge"
, config = ]
Some , config =
( Genode.Prelude.XML.leaf Init.Config::{
{ name = "config" , attributes =
, attributes = toMap
toMap { interface = "10.0.0.72/24"
{ interface = "10.0.0.72/24" , dst_ip = "10.0.0.2"
, dst_ip = "10.0.0.2" , period_sec = "1"
, period_sec = "1" , verbose = "no"
, verbose = "no" }
} }
} }
)
}
} }
} }
, rom = , rom =
Genode.Boot.toRomPaths let manifest = env:MANIFEST
[ manifest.os.bin.nic_loopback
, manifest.os.bin.nic_bridge in Genode.BootModules.toRomPaths
, manifest.os.bin.ping [ manifest.os.bin.nic_loopback
, manifest.solo5-tests.bin.solo5-test_net , 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 Genode = env:DHALL_GENODE
let manifest = env:MANIFEST let Init = Genode.Init
let Child = Init.Child
let Res = Init.Resources
in { config = in { config =
Genode.Init::{ Init::{
, children = , children =
toMap toMap
{ nic = { nic =
Genode.Init.Start::{ Child.flat
, binary = "nic_loopback" Child.Attributes::{
, provides = [ "Nic" ] , binary = "nic_loopback"
} , provides = [ "Nic" ]
}
, bridge = , bridge =
Genode.Init.Start::{ Child.flat
, binary = "nic_bridge" Child.Attributes::{
, resources = { caps = 200, ram = Genode.units.MiB 8 } , binary = "nic_bridge"
, provides = [ "Nic" ] , resources = Res::{ caps = 200, ram = Genode.units.MiB 8 }
, routes = [ Genode.ServiceRoute.child "Nic" "nic" ] , provides = [ "Nic" ]
, config = , routes = [ Genode.Init.ServiceRoute.child "Nic" "nic" ]
Some , config =
( Genode.Prelude.XML.text Init.Config::{
'' , content =
<config mac="02:02:02:02:03:00" verbose="no"> [ Genode.Prelude.XML.text
<policy label="solo5 -> service0" ip_addr="10.0.0.2"/> ''
<policy label="solo5 -> service1" ip_addr="10.1.0.2"/> <policy label="solo5 -> service0" ip_addr="10.0.0.2"/>
<default-policy/> <policy label="solo5 -> service1" ip_addr="10.1.0.2"/>
</config> <default-policy/>
'' ''
) ]
} }
}
, solo5 = , solo5 =
Genode.Init.Start::{ Child.flat
, binary = "solo5-test_net_2if" Child.Attributes::{
, resources = { caps = 256, ram = Genode.units.MiB 5 } , binary = "solo5-test_net_2if"
, routes = , resources = Res::{ caps = 256, ram = Genode.units.MiB 5 }
[ Genode.ServiceRoute.parent "Timer" , routes =
, Genode.ServiceRoute.child "Nic" "bridge" [ Genode.Init.ServiceRoute.parent "Timer"
] , Genode.Init.ServiceRoute.child "Nic" "bridge"
, config = ]
Some , config =
( Genode.Prelude.XML.text Init.Config::{
'' , content =
<config><cmdline>limit</cmdline></config> [ Genode.Prelude.XML.text
'' ''
) "<cmdline>limit</cmdline>"
} ''
]
}
}
, clients = , clients =
Genode.Init.Start::{ Child.flat
, binary = "sequence" Child.Attributes::{
, exitPropagate = True , binary = "sequence"
, resources = { caps = 256, ram = Genode.units.MiB 8 } , exitPropagate = True
, routes = , resources = Res::{ caps = 256, ram = Genode.units.MiB 8 }
[ Genode.ServiceRoute.parent "Timer" , routes =
, Genode.ServiceRoute.child "Nic" "bridge" [ Genode.Init.ServiceRoute.parent "Timer"
] , Genode.Init.ServiceRoute.child "Nic" "bridge"
, config = ]
Some , config =
( Genode.Prelude.XML.text Init.Config::{
'' , content =
<config> [ Genode.Prelude.XML.text
<start name="ping0"> ''
<binary name="ping"/> <start name="ping0">
<config interface="10.0.0.72/24" dst_ip="10.0.0.2" period_sec="1" count="4"/> <binary name="ping"/>
</start> <config interface="10.0.0.72/24" dst_ip="10.0.0.2" period_sec="1" count="4"/>
<start name="ping1"> </start>
<binary name="ping"/> <start name="ping1">
<config interface="10.1.0.72/24" dst_ip="10.1.0.2" period_sec="1" count="4"/> <binary name="ping"/>
</start> <config interface="10.1.0.72/24" dst_ip="10.1.0.2" period_sec="1" count="4"/>
</config> </start>
'' ''
) ]
} }
}
} }
} }
, rom = , rom =
Genode.Boot.toRomPaths let manifest = env:MANIFEST
[ manifest.solo5-tests.bin.solo5-test_net_2if
, manifest.os.bin.sequence in Genode.BootModules.toRomPaths
, manifest.os.bin.nic_bridge [ manifest.solo5-tests.bin.solo5-test_net_2if
, manifest.os.bin.nic_loopback , manifest.os.bin.sequence
, manifest.os.bin.ping , 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 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 = → { config =
Genode.Init::{ Init::{
, children = , children =
toMap toMap
{ solo5 = { solo5 =
Genode.Init.Start::{ Child.flat
, binary = testBinary.mapKey Child.Attributes::{
, exitPropagate = True , binary = testBinary.mapKey
, resources = { caps = 256, ram = Genode.units.MiB 3 } , exitPropagate = True
, config = , resources =
Some Init.Resources::{
( Genode.Prelude.XML.element , caps = 256
{ name = "config" , ram = Genode.units.MiB 3
, attributes = }
[] : Genode.Prelude.Map.Type Text Text , config =
, content = Config::{
[ Genode.Prelude.XML.element , content =
{ name = "cmdline" [ Prelude.XML.element
, attributes = { name = "cmdline"
[] : Genode.Prelude.Map.Type Text Text , attributes = Prelude.XML.emptyAttributes
, content = , content = [ Prelude.XML.text "Hello_Solo5" ]
[ Genode.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 Genode = env:DHALL_GENODE
let manifest = env:MANIFEST let Child = Genode.Init.Child
let test = manifest.solo5-tests.bin.solo5-test_time
in { config = in { config =
Genode.Init::{ Genode.Init::{
, children = , children =
toMap toMap
{ solo5 = { solo5 =
Genode.Init.Start::{ Child.flat
, binary = test.mapKey Child.Attributes::{
, exitPropagate = True , binary = "solo5-test_time"
, resources = { caps = 256, ram = Genode.units.MiB 3 } , exitPropagate = True
, routes = , resources =
[ Genode.ServiceRoute.parent "Timer" Genode.Init.Resources::{
, Genode.ServiceRoute.child "Rtc" "clock" , caps = 256
] , ram = Genode.units.MiB 3
} }
, routes =
[ Genode.Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.child "Rtc" "clock"
]
}
, clock = , clock =
Genode.Init.Start::{ Child.flat
, binary = "rtc_drv" Child.Attributes::{
, provides = [ "Rtc" ] , binary = "rtc_drv"
, routes = [ Genode.ServiceRoute.parent "IO_PORT" ] , 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 -- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude let Init = Genode.Init
in λ(boot : Genode.Boot.Type) let Child = Init.Child
→ let child =
{ mapKey = "test", mapValue = Genode.Init.toStart boot.config } let wrapSotest
: Init.Type → Child.Type
in { config = = λ(init : Init.Type)
Genode.Init::{ → Child.nested
, verbose = True (toMap { init = Genode.Init.toChild init Init.Attributes.default })
, children = Child.Attributes::{
toMap , binary = "sotest-harness"
{ harness = , resources = Init.Resources::{ ram = Genode.units.MiB 4 }
Genode.Init.Start::{ , routes =
, binary = "sotest-harness" [ Init.ServiceRoute.parentLabel
, exitPropagate = True "LOG"
, resources = (Some "SOTEST")
{ caps = child.mapValue.resources.caps + 128 (Some "unlabeled")
, ram = , Init.ServiceRoute.parent "IO_MEM"
child.mapValue.resources.ram , Init.ServiceRoute.parent "IO_PORT"
+ Genode.units.MiB 1 , Init.ServiceRoute.parent "IRQ"
} , Init.ServiceRoute.child "Timer" "timer"
, 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
} }
in wrapSotest