2
0
Fork 0

Consolidate SOTEST wrapper for all test platforms

This commit is contained in:
Ehmry - 2020-02-19 14:11:21 +01:00
parent a2fc8f8ed1
commit 83d8a8881d
7 changed files with 164 additions and 217 deletions

View File

@ -2,71 +2,37 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
in λ(boot : Genode.Boot.Type)
→ let child =
{ mapKey = "test", mapValue = Genode.Init.toStart boot.config }
in { 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"
]
, children =
[ { mapKey = "timer"
, mapValue =
Genode.Init.Start::{
, binary = "hw_timer_drv"
, resources = { caps = 96, ram = Genode.units.MiB 1 }
, provides = [ "Timer" ]
}
→ { 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"
]
, 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.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.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
}
, { mapKey = "harness"
, mapValue = Genode.Init.toStart boot.config
}
]
}
, rom =
let manifest = env:MANIFEST
in Genode.Boot.toRomPaths
[ manifest.base-hw-pc.lib.ld
, manifest.base-hw-pc.bin.hw_timer_drv
, manifest.os.bin.init
]
# boot.rom
}

View File

@ -40,6 +40,7 @@ let
, env ? { }, ... # TODO: remove ...
}@t:
let
testConfig' = "${./driver-hw-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})";
manifest = lib.mergeManifests (with testPkgs;
[ base-hw-pc genode.os sotest-producer ]
++ testInputs);
@ -49,8 +50,7 @@ let
MANIFEST = manifest;
} // env;
image = apps.hw-image.function env'
"${./driver-hw-config.dhall} ${testConfig}";
image = apps.hw-image.function env' testConfig';
baseSetup = ''
##
@ -91,9 +91,10 @@ let
global env
global spawn_id
set TEST_MIB [expr ($env(TEST_RAM) / 1048576) + 12]
spawn ${hostPkgs.qemu_test}/bin/qemu-system-x86_64 \
-machine q35 -serial mon:stdio -nographic \
-m size=[expr ($env(TEST_RAM) / 1048576) + 16] \
-m size=$TEST_MIB \
-kernel "${testPkgs.bender}" \
-initrd "${image}"
wait_for_output $wait_for_re $timeout_value $spawn_id
@ -107,7 +108,7 @@ let
driver = with hostPkgs;
buildPackages.runCommand "genode-test-driver-${name}" {
buildInputs = [ makeWrapper expect ];
inherit baseSetup testConfig testScript;
inherit baseSetup testScript;
preferLocalBuild = true;
testName = name;
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
@ -116,7 +117,7 @@ let
mkdir -p $out/bin
echo "$testScript" > $out/test-script
echo "$baseSetup" > $out/base-setup
eval $(${apps.dhall-to-bash.program} --declare "TEST_RAM" <<< "${./boot-ram.dhall} ${testConfig}")
eval $(${apps.dhall-to-bash.program} --declare "TEST_RAM" <<< "${./boot-ram.dhall} (${testConfig'})")
ln -s ${testDriver}/bin/genode-test-driver $out/bin/
wrapProgram $out/bin/genode-test-driver \
--set testScript "$testScript" \
@ -135,17 +136,14 @@ let
config = hostPkgs.runCommand (name + ".dhall") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.dhall.program} <<< \
"(${./driver-hw-config.dhall} ${testConfig})" > $out
${apps.dhall.program} <<< "${testConfig'}" > $out
'';
iso = apps.hw-iso.function env'
"(${./driver-hw-config.dhall} ${testConfig})";
iso = apps.hw-iso.function env' testConfig';
xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.render-init.program} \
"(${./driver-hw-config.dhall} ${testConfig}).config" > $out'';
${apps.render-init.program} "(${testConfig'}).config" > $out'';
sotest = hostPkgs.runCommand "hw-${name}-sotest" env' ''
cp "${testPkgs.bender}" bender

View File

@ -1,70 +1,36 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
in λ(boot : Genode.Boot.Type)
→ let child =
{ mapKey = "test", mapValue = Genode.Init.toStart boot.config }
in { 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" ]
}
→ { 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.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.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
}
, { mapKey = "harness"
, mapValue = Genode.Init.toStart boot.config
}
]
}
, rom =
let manifest = env:MANIFEST
in Genode.Boot.toRomPaths
[ manifest.base-linux.bin.core-linux
, manifest.base-linux.bin.ld
, manifest.base-linux.bin.linux_timer_drv
, manifest.os.bin.init
]
# boot.rom
: Genode.Prelude.Map.Type Text Genode.Boot.Rom
}

View File

@ -71,7 +71,7 @@ let
set env(XDG_CACHE_HOME) /tmp
exec ${apps.linux-image.program} \
${./driver-linux-config.dhall} ${testConfig}
${./driver-linux-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})
spawn ./core-linux
wait_for_output $wait_for_re $timeout_value $spawn_id

View File

@ -2,71 +2,37 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
in λ(boot : Genode.Boot.Type)
→ let child =
{ mapKey = "test", mapValue = Genode.Init.toStart boot.config }
in { 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"
]
, children =
[ { mapKey = "timer"
, mapValue =
Genode.Init.Start::{
, binary = "nova_timer_drv"
, resources = { caps = 96, ram = Genode.units.MiB 1 }
, provides = [ "Timer" ]
}
→ { 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"
]
, 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.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.base-nova.lib.ld
, manifest.base-nova.bin.nova_timer_drv
, manifest.os.bin.init
, manifest.sotest-producer.bin.sotest-harness
]
# boot.rom
}
, { mapKey = "harness"
, mapValue = Genode.Init.toStart boot.config
}
]
}
, rom =
let manifest = env:MANIFEST
in Genode.Boot.toRomPaths
[ manifest.base-nova.lib.ld
, manifest.base-nova.bin.nova_timer_drv
, manifest.os.bin.init
]
# boot.rom
}

View File

@ -40,6 +40,7 @@ let
, env ? { }, ... # TODO: remove ...
}@t:
let
testConfig' = "${./driver-nova-config.dhall} (${./sotest-wrapper.dhall} ${testConfig})";
manifest = lib.mergeManifests (with testPkgs;
[ base-nova genode.os sotest-producer ]
++ testInputs);
@ -49,8 +50,7 @@ let
MANIFEST = manifest;
} // env;
image = apps.nova-image.function env'
"${./driver-nova-config.dhall} ${testConfig}";
image = apps.nova-image.function env' testConfig';
baseSetup = ''
##
@ -91,9 +91,10 @@ let
global env
global spawn_id
set TEST_MIB [expr ($env(TEST_RAM) / 1048576) + 24]
spawn ${hostPkgs.qemu_test}/bin/qemu-system-x86_64 \
-machine q35 -serial mon:stdio -nographic \
-m size=[expr ($env(TEST_RAM) / 1048576) + 16] \
-m size=$TEST_MIB \
-kernel "${testPkgs.bender}" \
-initrd "${testPkgs.NOVA}/hypervisor-x86_64 arg=iommu novpid serial,${image}"
wait_for_output $wait_for_re $timeout_value $spawn_id
@ -107,7 +108,7 @@ let
driver = with hostPkgs;
buildPackages.runCommand "genode-test-driver-${name}" {
buildInputs = [ makeWrapper expect ];
inherit baseSetup testConfig testScript;
inherit baseSetup testScript;
preferLocalBuild = true;
testName = name;
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
@ -116,7 +117,7 @@ let
mkdir -p $out/bin
echo "$testScript" > $out/test-script
echo "$baseSetup" > $out/base-setup
eval $(${apps.dhall-to-bash.program} --declare "TEST_RAM" <<< "${./boot-ram.dhall} ${testConfig}")
eval $(${apps.dhall-to-bash.program} --declare "TEST_RAM" <<< "${./boot-ram.dhall} (${testConfig'})")
ln -s ${testDriver}/bin/genode-test-driver $out/bin/
wrapProgram $out/bin/genode-test-driver \
--set testScript "$testScript" \
@ -135,17 +136,14 @@ let
config = hostPkgs.runCommand (name + ".dhall") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.dhall.program} <<< \
"(${./driver-nova-config.dhall} ${testConfig})" > $out
${apps.dhall.program} <<< "${testConfig'}" > $out
'';
iso = apps.nova-iso.function env'
"(${./driver-nova-config.dhall} ${testConfig})";
iso = apps.nova-iso.function env' "${testConfig'}";
xml = hostPkgs.runCommand (name + ".config") env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.render-init.program} \
"(${./driver-nova-config.dhall} ${testConfig}).config" > $out'';
${apps.render-init.program} "(${testConfig'}).config" > $out'';
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''
cp "${testPkgs.bender}" bender

View File

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