2
0
Fork 0

Test consolidation

This commit is contained in:
Ehmry - 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 e.mapValue
in λ(args : Args) -> \(out : Text) in λ(args : Args)
→ λ(out : Text)
{ config = Genode.Init.render args.config → { config = Genode.Init.render args.config
, script = Prelude.List.fold , script =
Prelude.List.fold
RomEntry RomEntry
args.rom args.rom
Text Text

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,12 @@
-- SPDX-License-Identifier: CC0-1.0 -- 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 let Child = Genode.Init.Child
in Genode.Boot::{ in Test::{
, config = Genode.Init::{
, children = toMap , children = toMap
{ noux = { noux =
Child.flat Child.flat
@ -43,4 +44,3 @@ in Genode.Boot::{
} }
} }
} }
}

View File

@ -1,6 +1,8 @@
-- SPDX-License-Identifier: CC0-1.0 -- 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 let XML = Genode.Prelude.XML
@ -14,8 +16,8 @@ let ServiceRoute = Init.ServiceRoute
let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label
in Genode.Boot::{ let init =
, config = Init::{ Init::{
, verbose = True , verbose = True
, children = toMap , children = toMap
{ test-pci = { 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 -- 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 let Child = Genode.Init.Child
in Genode.Boot::{ let init =
, config = Genode.Init::{ Genode.Init::{
, children = toMap , children = toMap
{ test-rtc = { test-rtc =
Child.flat 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 -- 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 Init = Genode.Init
let Child = Init.Child let Child = Init.Child
in Genode.Boot::{ in Test::{
, config = Init::{
, children = toMap , children = toMap
{ test-signal = { test-signal =
Child.flat Child.flat
@ -23,4 +24,3 @@ in Genode.Boot::{
} }
} }
} }
}

View File

@ -6,8 +6,8 @@ let Init = Genode.Init
let Child = Init.Child let Child = Init.Child
in Genode.Boot::{ let init =
, config = Init::{ Init::{
, children = toMap , children = toMap
{ solo5 = { solo5 =
Child.flat 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 let
defaultScript = '' defaultScript = ''
run_genode_until {SUCCESS} 30 run_genode_until {SOTEST END} 30
''; '';
mkTest' = { name, testConfig, testScript ? defaultScript, testInputs ? [ ] mkTest' = { name, testConfig, testScript ? defaultScript, testInputs ? [ ]
@ -23,66 +23,30 @@ let
mkTests = testList: builtins.listToAttrs (map applyMkTest testList); mkTests = testList: builtins.listToAttrs (map applyMkTest testList);
toSimple = name: ''(${./simple.dhall} \"solo5-test_${name}\")'';
genodeDepot = pkgs.genodeSources.depot; genodeDepot = pkgs.genodeSources.depot;
genodeMake = pkgs.genodeSources.make; genodeMake = pkgs.genodeSources.make;
tests = [ tests = [
{ {
name = "blk"; name = "multi";
testConfig = ./blk.dhall; testConfig = "${./.}/solo5.dhall";
testInputs = [ (genodeDepot "ram_block") ]; testInputs = map genodeMake [ "app/ping" ] ++ (map genodeDepot [
} "ram_block"
"nic_bridge"
{ "nic_loopback"
name = "fpu"; "sequence"
testConfig = toSimple "fpu"; "rtc_drv"
} ]);
{
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 = "ssp"; name = "ssp";
testConfig = toSimple "ssp"; testConfig = ./ssp.dhall;
testScript = '' testScript = ''
run_genode_until {Error: stack protector check failed} 30 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 in mkTests tests

View File

@ -10,8 +10,8 @@ let Res = Init.Resources
let ServiceRoute = Init.ServiceRoute let ServiceRoute = Init.ServiceRoute
in Genode.Boot::{ let init =
, config = Init::{ Init::{
, children = toMap , children = toMap
{ nic = { nic =
Child.flat 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 let Res = Init.Resources
in Genode.Boot::{ let init =
, config = Init::{ Init::{
, children = toMap , children = toMap
{ nic = { nic =
Child.flat 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 Genode = env:DHALL_GENODE
let Child = Genode.Init.Child let Init = Genode.Init
in Genode.Boot::{ let Child = Init.Child
, config = Genode.Init::{
let init =
Init::{
, children = toMap , children = toMap
{ solo5 = { solo5 =
Child.flat Child.flat
Child.Attributes::{ Child.Attributes::{
, binary = "solo5-test_time" , binary = "solo5-test_time"
, exitPropagate = True , exitPropagate = True
, resources = Genode.Init.Resources::{ , resources = Init.Resources::{
, caps = 256 , caps = 256
, ram = Genode.units.MiB 3 , ram = Genode.units.MiB 3
} }
, routes = , routes =
[ Genode.Init.ServiceRoute.parent "Timer" [ Init.ServiceRoute.parent "Timer"
, Genode.Init.ServiceRoute.child "Rtc" "clock" , Init.ServiceRoute.child "Rtc" "rtc_drv"
] ]
} }
, clock = , rtc_drv =
Child.flat Child.flat
Child.Attributes::{ Child.Attributes::{
, binary = "rtc_drv" , binary = "rtc_drv"
, exitPropagate = True
, provides = [ "Rtc" ] , 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 -- 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 let Prelude = Genode.Prelude
@ -8,13 +9,18 @@ let Init = Genode.Init
let Child = Init.Child let Child = Init.Child
let TextMapType = Prelude.Map.Type Text
let Children = TextMapType Child.Type
let wrapHarness let wrapHarness
: Init.Type → Child.Type : Children → Child.Type
= λ(init : Init.Type) = λ(children : Children)
→ Child.nested → Child.nested
(toMap { init = Genode.Init.toChild init Init.Attributes.default }) children
Child.Attributes::{ Child.Attributes::{
, binary = "sotest-harness" , binary = "sotest-harness"
, exitPropagate = True
, resources = Init.Resources::{ ram = Genode.units.MiB 4 } , resources = Init.Resources::{ ram = Genode.units.MiB 4 }
, routes = , routes =
[ Init.ServiceRoute.parentLabel [ Init.ServiceRoute.parentLabel
@ -28,12 +34,10 @@ let wrapHarness
] ]
} }
let TextMapType = Prelude.Map.Type Text in λ(test : Test.Type)
in λ(boot : Genode.Boot.Type)
→ λ(inputsManifest : TextMapType (TextMapType Text)) → λ(inputsManifest : TextMapType (TextMapType Text))
boot → Genode.Boot::{
⫽ { config = Init::{ , config = Init::{
, children = , children =
[ { mapKey = "timer" [ { mapKey = "timer"
, mapValue = , mapValue =
@ -43,12 +47,12 @@ in λ(boot : Genode.Boot.Type)
, provides = [ "Timer" ] , provides = [ "Timer" ]
} }
} }
, { mapKey = "harness", mapValue = wrapHarness boot.config } , { mapKey = "harness", mapValue = wrapHarness test.children }
] ]
} }
, rom = , rom =
let inputRoms = test.rom
Genode.BootModules.toRomPaths # Genode.BootModules.toRomPaths
( Prelude.List.concat ( Prelude.List.concat
(Prelude.Map.Entry Text Text) (Prelude.Map.Entry Text Text)
( Prelude.Map.values ( Prelude.Map.values
@ -57,6 +61,4 @@ in λ(boot : Genode.Boot.Type)
inputsManifest 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"
]
}
}
}