2
0
Fork 0

Test consolidation

This commit is contained in:
Emery Hemingway 2020-04-13 23:56:01 +05:30
parent 6aa43a1129
commit 78c5a2bb19
21 changed files with 341 additions and 304 deletions

View File

@ -27,10 +27,11 @@ let addLine =
}
e.mapValue
in λ(args : Args) -> \(out : Text)
{ config = Genode.Init.render args.config
, script = Prelude.List.fold
in λ(args : Args)
→ λ(out : Text)
→ { config = Genode.Init.render args.config
, script =
Prelude.List.fold
RomEntry
args.rom
Text

View File

@ -1,6 +1,8 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Prelude = Genode.Prelude
@ -14,8 +16,8 @@ let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
in Genode.Boot::{
, config = Init::{
let init =
Init::{
, verbose = True
, children =
let blockTest =
@ -112,7 +114,9 @@ in Genode.Boot::{
[ XML.leaf
{ name = "partition"
, attributes = toMap
{ type = "24B69406-18A1-428D-908E-D21A1437122C" }
{ type =
"24B69406-18A1-428D-908E-D21A1437122C"
}
}
]
}
@ -129,6 +133,9 @@ in Genode.Boot::{
, test-part2 = blockTest
}
}
in Test::{
, children = Test.initToChildren init
, rom =
Genode.BootModules.toRomPaths
[ { mapKey = "gpt.rom", mapValue = "./gpt.raw" } ]

View File

@ -45,7 +45,7 @@ let
testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
testEnv' = {
DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";
XDG_CACHE_HOME = "/tmp";
DHALL_GENODE_TEST = "${./test.dhall}";
} // testEnv;
image = lib.hwImage name testEnv' testConfig';

View File

@ -43,7 +43,7 @@ let
testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
env' = {
DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";
XDG_CACHE_HOME = "/tmp";
DHALL_GENODE_TEST = "${./test.dhall}";
} // env;
build = lib.linuxScript name env' testConfig';
@ -70,9 +70,6 @@ let
global image_dir spawn_id
global env
set env(XDG_CACHE_HOME) /tmp
exec sh ${build}/script
spawn ./core-linux
@ -100,13 +97,13 @@ let
in test // {
inherit build driver test;
config = buildPackages.runCommand (name + ".dhall") env' ''
config = lib.runDhallCommand (name + ".dhall") env' ''
${apps.dhall.program} <<< "(${testConfig'}).config" > $out
'';
xml = buildPackages.runCommand (name + ".config") env' ''
xml = lib.runDhallCommand (name + ".config") env' ''
${apps.render-init.program} <<< "(${testConfig'}).config" > $out
'';
image = buildPackages.runCommand (name + ".image.elf") env' ''
image = lib.runDhallCommand (name + ".image.elf") env' ''
mkdir -p $out
pushd $out
. ${build}/script

View File

@ -46,7 +46,7 @@ let
testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
testEnv' = {
DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";
XDG_CACHE_HOME = "/tmp";
DHALL_GENODE_TEST = "${./test.dhall}";
} // testEnv;
image = lib.novaImage name testEnv' testConfig';

View File

@ -1,8 +1,10 @@
-- SPDX-License-Identifier: CC0-1.0
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let drivers = env:drivers ? ../compositions/pc-drivers.dhall
let Genode = env:DHALL_GENODE
let Genode = Test.Genode
let Init = Genode.Init
@ -24,8 +26,8 @@ let childRomRoute =
let label = λ(_ : Text) → { local = _, route = _ }
in Genode.Boot::{
, config = Init::{
let init =
Init::{
, verbose = True
, children = toMap
{ drivers =
@ -91,7 +93,8 @@ in Genode.Boot::{
}
}
}
, rom =
let rom =
Genode.Boot.toRomTexts
( toMap
{ capslock = "<feature_creep/>"
@ -146,4 +149,5 @@ in Genode.Boot::{
}
]
)
}
in Test::{ children = Test.initToChildren init, rom = rom }

View File

@ -1,11 +1,12 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Child = Genode.Init.Child
in Genode.Boot::{
, config = Genode.Init::{
in Test::{
, children = toMap
{ test-log =
Child.flat
@ -20,4 +21,3 @@ in Genode.Boot::{
}
}
}
}

View File

@ -1,11 +1,12 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Child = Genode.Init.Child
in Genode.Boot::{
, config = Genode.Init::{
in Test::{
, children = toMap
{ noux =
Child.flat
@ -43,4 +44,3 @@ in Genode.Boot::{
}
}
}
}

View File

@ -1,6 +1,8 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let XML = Genode.Prelude.XML
@ -14,8 +16,8 @@ let ServiceRoute = Init.ServiceRoute
let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label
in Genode.Boot::{
, config = Init::{
let init =
Init::{
, verbose = True
, children = toMap
{ test-pci =
@ -71,4 +73,5 @@ in Genode.Boot::{
}
}
}
}
in Test::{ children = Test.initToChildren init }

View File

@ -1,11 +1,13 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Child = Genode.Init.Child
in Genode.Boot::{
, config = Genode.Init::{
let init =
Genode.Init::{
, children = toMap
{ test-rtc =
Child.flat
@ -26,4 +28,5 @@ in Genode.Boot::{
}
}
}
}
in Test::{ children = Test.initToChildren init }

View File

@ -1,13 +1,14 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Init = Genode.Init
let Child = Init.Child
in Genode.Boot::{
, config = Init::{
in Test::{
, children = toMap
{ test-signal =
Child.flat
@ -23,4 +24,3 @@ in Genode.Boot::{
}
}
}
}

View File

@ -6,8 +6,8 @@ let Init = Genode.Init
let Child = Init.Child
in Genode.Boot::{
, config = Init::{
let init =
Init::{
, children = toMap
{ solo5 =
Child.flat
@ -35,4 +35,5 @@ in Genode.Boot::{
}
}
}
}
in Init.toChild init Init.Attributes.default

View File

@ -5,7 +5,7 @@ with pkgs;
let
defaultScript = ''
run_genode_until {SUCCESS} 30
run_genode_until {SOTEST END} 30
'';
mkTest' = { name, testConfig, testScript ? defaultScript, testInputs ? [ ]
@ -23,66 +23,30 @@ let
mkTests = testList: builtins.listToAttrs (map applyMkTest testList);
toSimple = name: ''(${./simple.dhall} \"solo5-test_${name}\")'';
genodeDepot = pkgs.genodeSources.depot;
genodeMake = pkgs.genodeSources.make;
tests = [
{
name = "blk";
testConfig = ./blk.dhall;
testInputs = [ (genodeDepot "ram_block") ];
}
{
name = "fpu";
testConfig = toSimple "fpu";
}
{
name = "globals";
testConfig = toSimple "globals";
}
{
name = "hello";
testConfig = toSimple "hello";
}
{
name = "net";
testConfig = ./net.dhall;
testInputs = (map genodeDepot [ "nic_bridge" "nic_loopback" ])
++ (map genodeMake [ "app/ping" ]);
}
{
name = "net_2if";
testConfig = ./net_2if.dhall;
testInputs = (map genodeDepot [ "sequence" "nic_bridge" "nic_loopback" ])
++ (map genodeMake [ "app/ping" ]);
}
{
name = "quiet";
testConfig = toSimple "quiet";
name = "multi";
testConfig = "${./.}/solo5.dhall";
testInputs = map genodeMake [ "app/ping" ] ++ (map genodeDepot [
"ram_block"
"nic_bridge"
"nic_loopback"
"sequence"
"rtc_drv"
]);
}
{
name = "ssp";
testConfig = toSimple "ssp";
testConfig = ./ssp.dhall;
testScript = ''
run_genode_until {Error: stack protector check failed} 30
'';
}
] ++ (testEnv.lib.optional (!testEnv.isLinux) {
name = "time";
testConfig = ./time.dhall;
testInputs = [ (genodeDepot "rtc_drv") ];
}
);
];
in mkTests tests

View File

@ -10,8 +10,8 @@ let Res = Init.Resources
let ServiceRoute = Init.ServiceRoute
in Genode.Boot::{
, config = Init::{
let init =
Init::{
, children = toMap
{ nic =
Child.flat
@ -72,4 +72,5 @@ in Genode.Boot::{
}
}
}
}
in Init.toChild init Init.Attributes.default

View File

@ -8,8 +8,8 @@ let Child = Init.Child
let Res = Init.Resources
in Genode.Boot::{
, config = Init::{
let init =
Init::{
, children = toMap
{ nic =
Child.flat
@ -81,4 +81,5 @@ in Genode.Boot::{
}
}
}
}
in Init.toChild init Init.Attributes.default

View File

@ -1,39 +0,0 @@
-- SPDX-License-Identifier: CC0-1.0
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let Init = Genode.Init
let Child = Init.Child
let Config = Init.Config
in λ(testBinary : Text)
→ Genode.Boot::{
, config = Init::{
, children = toMap
{ solo5 =
Child.flat
Child.Attributes::{
, binary = testBinary
, 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" ]
}
}
}
}

45
tests/solo5/solo5.dhall Normal file
View File

@ -0,0 +1,45 @@
-- SPDX-License-Identifier: CC0-1.0
let Test = ../test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Prelude = Genode.Prelude
let Init = Genode.Init
let Child = Init.Child
let Config = Init.Config
let toSimple =
λ(testName : Text)
→ Child.flat
Child.Attributes::{
, binary = "solo5-test_${testName}"
, 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" ]
}
let tests
: Prelude.Map.Type Text Child.Type
= [ { mapKey = "quiet", mapValue = toSimple "quiet" }
, { mapKey = "hello", mapValue = toSimple "hello" }
, { mapKey = "globals", mapValue = toSimple "globals" }
, { mapKey = "fpu", mapValue = toSimple "fpu" }
, { mapKey = "time", mapValue = ./time.dhall }
, { mapKey = "blk", mapValue = ./blk.dhall }
, { mapKey = "net", mapValue = ./net.dhall }
, { mapKey = "net_2if", mapValue = ./net_2if.dhall }
]
in Test::{ children = tests }

9
tests/solo5/ssp.dhall Normal file
View File

@ -0,0 +1,9 @@
-- SPDX-License-Identifier: CC0-1.0
let Test = ../test.dhall ? env:DHALL_GENODE_TEST
let Child = Test.Genode.Init.Child
let test = Child.flat Child.Attributes::{ binary = "solo5-test_ssp" }
in Test::{ children = toMap { ssp = test } }

View File

@ -2,32 +2,38 @@
let Genode = env:DHALL_GENODE
let Child = Genode.Init.Child
let Init = Genode.Init
in Genode.Boot::{
, config = Genode.Init::{
let Child = Init.Child
let init =
Init::{
, children = toMap
{ solo5 =
Child.flat
Child.Attributes::{
, binary = "solo5-test_time"
, exitPropagate = True
, resources = Genode.Init.Resources::{
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 3
}
, routes =
[ Genode.Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.child "Rtc" "clock"
[ Init.ServiceRoute.parent "Timer"
, Init.ServiceRoute.child "Rtc" "rtc_drv"
]
}
, clock =
, rtc_drv =
Child.flat
Child.Attributes::{
, binary = "rtc_drv"
, exitPropagate = True
, provides = [ "Rtc" ]
, routes = [ Genode.Init.ServiceRoute.parent "IO_PORT" ]
}
, routes = [ Init.ServiceRoute.parent "IO_PORT" ]
}
}
}
in Init.toChild
init
Init.Attributes::{ routes = [ Init.ServiceRoute.parent "IO_PORT" ] }

View File

@ -1,6 +1,7 @@
-- SPDX-License-Identifier: CC0-1.0
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = env:DHALL_GENODE
let Genode = Test.Genode
let Prelude = Genode.Prelude
@ -8,13 +9,18 @@ let Init = Genode.Init
let Child = Init.Child
let TextMapType = Prelude.Map.Type Text
let Children = TextMapType Child.Type
let wrapHarness
: Init.Type → Child.Type
= λ(init : Init.Type)
: Children → Child.Type
= λ(children : Children)
→ Child.nested
(toMap { init = Genode.Init.toChild init Init.Attributes.default })
children
Child.Attributes::{
, binary = "sotest-harness"
, exitPropagate = True
, resources = Init.Resources::{ ram = Genode.units.MiB 4 }
, routes =
[ Init.ServiceRoute.parentLabel
@ -28,12 +34,10 @@ let wrapHarness
]
}
let TextMapType = Prelude.Map.Type Text
in λ(boot : Genode.Boot.Type)
in λ(test : Test.Type)
→ λ(inputsManifest : TextMapType (TextMapType Text))
boot
⫽ { config = Init::{
→ Genode.Boot::{
, config = Init::{
, children =
[ { mapKey = "timer"
, mapValue =
@ -43,12 +47,12 @@ in λ(boot : Genode.Boot.Type)
, provides = [ "Timer" ]
}
}
, { mapKey = "harness", mapValue = wrapHarness boot.config }
, { mapKey = "harness", mapValue = wrapHarness test.children }
]
}
, rom =
let inputRoms =
Genode.BootModules.toRomPaths
test.rom
# Genode.BootModules.toRomPaths
( Prelude.List.concat
(Prelude.Map.Entry Text Text)
( Prelude.Map.values
@ -57,6 +61,4 @@ in λ(boot : Genode.Boot.Type)
inputsManifest
)
)
in boot.rom # inputRoms
}

32
tests/test.dhall Normal file
View File

@ -0,0 +1,32 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let Init = Genode.Init
in { Genode = Genode
, Type =
{ children : Prelude.Map.Type Text Init.Child.Type
, rom : Genode.BootModules.Type
}
, default.rom = [] : Genode.BootModules.Type
, initToChildren =
λ(init : Init.Type)
→ toMap
{ init =
Init.toChild
init
Init.Attributes::{
, 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"
]
}
}
}