2
0
Fork 0
Browse Source

Bump dhall-genode

• update dhall-genode revision
• render top-level init config with lib.renderDhallInit
• convert Init.Start.config to optionals
• lib.validate renderDhallInit XML
20.02
Emery Hemingway 3 years ago
parent
commit
ef9f76744f
  1. 4
      dhall/genode.nix
  2. 5
      lib/default.nix
  3. 49
      tests/libc.dhall
  4. 7
      tests/log.dhall
  5. 126
      tests/pci.dhall
  6. 17
      tests/signal.dhall

4
dhall/genode.nix

@ -6,6 +6,6 @@
fetchgit {
url = "https://git.sr.ht/~ehmry/dhall-genode";
rev = "4e05e7bf88e53c81a8f00460673fd48e858c6dfc";
sha256 = "0y92jinqr26wlrychk8mi58kqwmy4y25c2ffks3r3m78i8andi8y";
rev = "c9a9c18dc8dd45198dbf0a53732ca02079fee0fd";
sha256 = "1fcfyfcnm6snpagf3ii70p8vdy7na9lv6c3izlckyp6gvgadyyjn";
}

5
lib/default.nix

@ -24,7 +24,7 @@ in {
renderDhallInit = path: args:
hostPkgs.runCommand "init.xml" {
preferLocalBuild = true;
buildInputs = [ hostPkgs.dhall ];
buildInputs = with hostPkgs; [ dhall libxml2 ];
initConfig = path;
initArgs = args;
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
@ -32,8 +32,9 @@ in {
} ''
export XDG_CACHE_HOME=$NIX_BUILD_TOP
dhall text \
<<< 'let Prelude = env:DHALL_GENODE in Prelude.Init.render (Prelude.Init::{ children = toMap (env:initConfig env:initArgs) })' \
<<< 'let Prelude = env:DHALL_GENODE in Prelude.Init.render (env:initConfig env:initArgs)' \
> $out
xmllint --noout $out
'';
x86_64-genode.buildNovaIso = { name, rom }:

49
tests/libc.dhall

@ -1,24 +1,33 @@
let Genode = env:DHALL_GENODE
in λ(_ : {})
→ { test-libc =
Genode.Init.Start::{
, binary = "test-libc"
, resources = { caps = 200, ram = Genode.units.MiB 400 }
, routes = [ Genode.ServiceRoute.parent "Timer" ]
, config =
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>
''
in λ ( _
: {}
)
→ Genode.Init::{
, verbose = True
, children =
toMap
{ test-libc =
Genode.Init.Start::{
, binary = "test-libc"
, 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
}
: Genode.Init.Start.Type
}

7
tests/log.dhall

@ -1,3 +1,8 @@
let Genode = env:DHALL_GENODE ? ../dhall-genode/package.dhall
in λ(_ : {}) → { test-log = Genode.Init.Start::{ binary = "test-log" } }
in λ(_ : {})
→ Genode.Init::{
, verbose = True
, children =
toMap { test-log = Genode.Init.Start::{ binary = "test-log" } }
}

126
tests/pci.dhall

@ -3,62 +3,72 @@ let Genode = env:DHALL_GENODE
in λ ( _
: {}
)
→ { test-pci =
Genode.Init.Start::{
, binary = "test-pci"
, resources = { caps = 96, ram = Genode.units.MiB 2 }
, routes = [ Genode.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 =
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>
''
}
, 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"
]
}
, 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 =
Genode.Prelude.XML.text
''
<config>
<policy label_prefix="test-pci"> <pci class="ALL"/> </policy>
</config>
''
}
→ Genode.Init::{
, verbose = True
, children =
toMap
{ test-pci =
Genode.Init.Start::{
, binary = "test-pci"
, resources = { caps = 96, ram = Genode.units.MiB 2 }
, routes =
[ Genode.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>
''
)
}
, 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"
]
}
, 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>
''
)
}
}
}

17
tests/signal.dhall

@ -1,11 +1,16 @@
let Genode = env:DHALL_GENODE ? ../dhall-genode/package.dhall
in λ(_ : {})
→ { test-signal =
Genode.Init.Start::{
, binary = "test-signal"
, resources = { caps = 500, ram = Genode.units.MiB 10 }
, routes = [ Genode.ServiceRoute.parent "Timer" ]
→ Genode.Init::{
, verbose = True
, children =
toMap
{ test-signal =
Genode.Init.Start::{
, binary = "test-signal"
, resources = { caps = 500, ram = Genode.units.MiB 10 }
, routes = [ Genode.ServiceRoute.parent "Timer" ]
}
: Genode.Init.Start.Type
}
: Genode.Init.Start.Type
}

Loading…
Cancel
Save