diff --git a/apps/linux-image/script.dhall b/apps/linux-image/script.dhall index 8ee0b2c..4b5789d 100644 --- a/apps/linux-image/script.dhall +++ b/apps/linux-image/script.dhall @@ -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) diff --git a/apps/modules.as.dhall b/apps/modules.as.dhall index c60bf80..42ff906 100644 --- a/apps/modules.as.dhall +++ b/apps/modules.as.dhall @@ -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 = diff --git a/apps/render-rom.dhall b/apps/render-rom.dhall index 758065e..ba432a5 100644 --- a/apps/render-rom.dhall +++ b/apps/render-rom.dhall @@ -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 diff --git a/apps/to-rom.dhall b/apps/to-rom.dhall index 505bcfd..9b938a3 100644 --- a/apps/to-rom.dhall +++ b/apps/to-rom.dhall @@ -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 diff --git a/flake.nix b/flake.nix index dd0d0a1..4390079 100644 --- a/flake.nix +++ b/flake.nix @@ -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 + ] + }" ''; }; diff --git a/packages/dhall/genode.nix b/packages/dhall/genode.nix index 2c5b916..015824f 100644 --- a/packages/dhall/genode.nix +++ b/packages/dhall/genode.nix @@ -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 = '' diff --git a/tests/boot-ram.dhall b/tests/boot-ram.dhall index 03422a1..1a20451 100644 --- a/tests/boot-ram.dhall +++ b/tests/boot-ram.dhall @@ -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 diff --git a/tests/default.nix b/tests/default.nix index afe6ea4..11c2bd8 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -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 { diff --git a/tests/driver-hw-config.dhall b/tests/driver-hw-config.dhall index d2b8bbd..370d5ed 100644 --- a/tests/driver-hw-config.dhall +++ b/tests/driver-hw-config.dhall @@ -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 } diff --git a/tests/driver-hw.nix b/tests/driver-hw.nix index dc66f68..28ea7cf 100644 --- a/tests/driver-hw.nix +++ b/tests/driver-hw.nix @@ -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' '' diff --git a/tests/driver-linux-config.dhall b/tests/driver-linux-config.dhall index 6ae4675..4885942 100644 --- a/tests/driver-linux-config.dhall +++ b/tests/driver-linux-config.dhall @@ -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 } diff --git a/tests/driver-linux.nix b/tests/driver-linux.nix index fc567c7..1d9bab7 100644 --- a/tests/driver-linux.nix +++ b/tests/driver-linux.nix @@ -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'}" ''; }; diff --git a/tests/driver-nova-config.dhall b/tests/driver-nova-config.dhall index 429636a..57b66d7 100644 --- a/tests/driver-nova-config.dhall +++ b/tests/driver-nova-config.dhall @@ -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 } diff --git a/tests/driver-nova.nix b/tests/driver-nova.nix index 01c1836..38ad1c2 100644 --- a/tests/driver-nova.nix +++ b/tests/driver-nova.nix @@ -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' '' diff --git a/tests/libc.dhall b/tests/libc.dhall deleted file mode 100644 index 565b1be..0000000 --- a/tests/libc.dhall +++ /dev/null @@ -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 - '' - - - - - 2019-08-20 15:01 - - - - - '' - ) - } - : 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 - ] - } diff --git a/tests/log.dhall b/tests/log.dhall index d5a28b6..b4174c7 100644 --- a/tests/log.dhall +++ b/tests/log.dhall @@ -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 = diff --git a/tests/noux.dhall b/tests/noux.dhall index fca51b7..8e17f82 100644 --- a/tests/noux.dhall +++ b/tests/noux.dhall @@ -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 - '' - - - - - - - echo "hello world" - - - - - - - '' - ) - } + 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 + '' + + + + + + echo "hello world" + + + + + + '' + ] + } + } } } , rom = diff --git a/tests/pci.dhall b/tests/pci.dhall index 91d17f0..10bf6a6 100644 --- a/tests/pci.dhall +++ b/tests/pci.dhall @@ -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 - '' - - - - - '' - ) - } + Child.flat + Child.Attributes::{ + , binary = "report_rom" + , provides = [ "ROM", "Report" ] + , config = + Init.Config::{ + , content = + [ XML.text + '' + + + '' + ] + } + } , 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 - '' - - - - '' - ) - } + 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 + '' + + '' + ] + } + } } } , rom = diff --git a/tests/rtc.dhall b/tests/rtc.dhall index 1473363..f307b95 100644 --- a/tests/rtc.dhall +++ b/tests/rtc.dhall @@ -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 = diff --git a/tests/signal.dhall b/tests/signal.dhall index df4650e..780389d 100644 --- a/tests/signal.dhall +++ b/tests/signal.dhall @@ -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 = diff --git a/tests/solo5/blk.dhall b/tests/solo5/blk.dhall index c0dc6e1..53fd456 100644 --- a/tests/solo5/blk.dhall +++ b/tests/solo5/blk.dhall @@ -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 - '' - - '' - ) - } + 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 + ] } diff --git a/tests/solo5/boot-wrapper.dhall b/tests/solo5/boot-wrapper.dhall index a3f91b7..24688b1 100644 --- a/tests/solo5/boot-wrapper.dhall +++ b/tests/solo5/boot-wrapper.dhall @@ -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 } diff --git a/tests/solo5/default.nix b/tests/solo5/default.nix index 7263181..369bd85 100644 --- a/tests/solo5/default.nix +++ b/tests/solo5/default.nix @@ -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 - ''; } { diff --git a/tests/solo5/net.dhall b/tests/solo5/net.dhall index ea98ddb..4b9e2ed 100644 --- a/tests/solo5/net.dhall +++ b/tests/solo5/net.dhall @@ -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 - '' - - - - - '' - ) - } + 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 + '' + + + '' + ] + } + } , 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 - "limit" - ) - } + 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 "limit" + ] + } + } , 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 + ] } diff --git a/tests/solo5/net_2if.dhall b/tests/solo5/net_2if.dhall index de09a92..1290996 100644 --- a/tests/solo5/net_2if.dhall +++ b/tests/solo5/net_2if.dhall @@ -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 - '' - - - - - - '' - ) - } + 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 + '' + + + + '' + ] + } + } , 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 - '' - limit - '' - ) - } + 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 + '' + "limit" + '' + ] + } + } , 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 - '' - - - - - - - - - - - '' - ) - } + 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 + '' + + + + + + + + + '' + ] + } + } } } , 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 + ] } diff --git a/tests/solo5/simple.dhall b/tests/solo5/simple.dhall index 2d8bf40..257b7a4 100644 --- a/tests/solo5/simple.dhall +++ b/tests/solo5/simple.dhall @@ -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 ] } diff --git a/tests/solo5/time.dhall b/tests/solo5/time.dhall index 6aaced3..d1d65ee 100644 --- a/tests/solo5/time.dhall +++ b/tests/solo5/time.dhall @@ -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 + ] } diff --git a/tests/sotest-wrapper.dhall b/tests/sotest-wrapper.dhall index 6edab4b..66b8df9 100644 --- a/tests/sotest-wrapper.dhall +++ b/tests/sotest-wrapper.dhall @@ -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