Apply manifest merging in tests
Merged manifests are easier to work with as the number of inputs increase.
This commit is contained in:
parent
6b7e439283
commit
fffd53664b
|
@ -45,4 +45,17 @@ in {
|
||||||
xmllint --noout $out
|
xmllint --noout $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
mergeManifests = inputs:
|
||||||
|
nixpkgs.legacyPackages.${localSystem}.writeTextFile {
|
||||||
|
name = "manifest.dhall";
|
||||||
|
text = with builtins;
|
||||||
|
let
|
||||||
|
f = head: input:
|
||||||
|
if hasAttr "manifest" input then
|
||||||
|
"${head},${input.pname}=${input.manifest}"
|
||||||
|
else
|
||||||
|
abort "${input.pname} does not have a manifest";
|
||||||
|
in (foldl' f "{" inputs) + "}";
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ in rec {
|
||||||
nic_bus = callPackage ./nic_bus { inherit (genode) base os; };
|
nic_bus = callPackage ./nic_bus { inherit (genode) base os; };
|
||||||
|
|
||||||
solo5 = let drv = callPackage ./solo5 { inherit (genode) base os; };
|
solo5 = let drv = callPackage ./solo5 { inherit (genode) base os; };
|
||||||
in addManifest drv // { tests = addManifest drv.tests; };
|
in addManifest drv // { tests = addManifest drv.tests // { pname = "solo5-tests"; }; };
|
||||||
|
|
||||||
sotest-producer = addManifest (callPackage ./sotest-producer {
|
sotest-producer = addManifest (callPackage ./sotest-producer {
|
||||||
stdenv = genode.stdenvGcc;
|
stdenv = genode.stdenvGcc;
|
||||||
|
|
|
@ -20,8 +20,11 @@ let
|
||||||
inherit apps testPkgs hostPkgs lib depot;
|
inherit apps testPkgs hostPkgs lib depot;
|
||||||
}).callTest;
|
}).callTest;
|
||||||
|
|
||||||
nova = (call: ((tests call) // { pci = call ./pci.nix { }; rtc = call ./rtc.nix { }; }))
|
nova = (call:
|
||||||
(import ./driver-nova.nix {
|
((tests call) // {
|
||||||
|
pci = call ./pci.nix { };
|
||||||
|
rtc = call ./rtc.nix { };
|
||||||
|
})) (import ./driver-nova.nix {
|
||||||
inherit apps system testPkgs hostPkgs lib depot;
|
inherit apps system testPkgs hostPkgs lib depot;
|
||||||
}).callTest;
|
}).callTest;
|
||||||
|
|
||||||
|
@ -37,5 +40,4 @@ let
|
||||||
}) (testsToList nova);
|
}) (testsToList nova);
|
||||||
|
|
||||||
in with builtins;
|
in with builtins;
|
||||||
listToAttrs
|
listToAttrs ((concatLists (map (testsToList) [ linux nova ])) ++ nova-sotest)
|
||||||
((concatLists (map (testsToList) [ linux nova ])) ++ nova-sotest)
|
|
||||||
|
|
|
@ -27,17 +27,15 @@ in λ(args : Args)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let baseLinux = env:BASE_LINUX_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
let os = env:OS_MANIFEST
|
|
||||||
|
|
||||||
in Genode.Boot.toRomPaths
|
in Genode.Boot.toRomPaths
|
||||||
[ { mapKey = "ld.lib.so"
|
[ { mapKey = "ld.lib.so"
|
||||||
, mapValue = baseLinux.bin.ld-linux.mapValue
|
, mapValue = manifest.base-linux.bin.ld-linux.mapValue
|
||||||
}
|
}
|
||||||
, baseLinux.bin.linux_timer_drv
|
, manifest.base-linux.bin.linux_timer_drv
|
||||||
, os.bin.init
|
, manifest.os.bin.init
|
||||||
, baseLinux.bin.core-linux
|
, manifest.base-linux.bin.core-linux
|
||||||
]
|
]
|
||||||
# args.rom
|
# args.rom
|
||||||
: Genode.Prelude.Map.Type Text Genode.Boot.Rom
|
: Genode.Prelude.Map.Type Text Genode.Boot.Rom
|
||||||
|
|
|
@ -34,15 +34,15 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
mkTest = { name ? "unamed", testScript, testConfig, env ? { }, ... }:
|
mkTest = { name ? "unamed", testScript, testConfig, testInputs ? [ ]
|
||||||
|
, env ? { }, ... }:
|
||||||
with testPkgs;
|
with testPkgs;
|
||||||
let
|
let
|
||||||
env' = {
|
env' = {
|
||||||
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
|
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
|
||||||
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
|
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
|
||||||
BASE_MANIFEST = testPkgs.genode.base.manifest;
|
MANIFEST = lib.mergeManifests (with testPkgs;
|
||||||
BASE_LINUX_MANIFEST = testPkgs.genode.base-linux.manifest;
|
[ genode.base genode.base-linux genode.os ] ++ testInputs);
|
||||||
OS_MANIFEST = testPkgs.genode.os.manifest;
|
|
||||||
} // env;
|
} // env;
|
||||||
|
|
||||||
toExports = env:
|
toExports = env:
|
||||||
|
@ -99,19 +99,18 @@ let
|
||||||
in test // {
|
in test // {
|
||||||
inherit driver test;
|
inherit driver test;
|
||||||
config = hostPkgs.runCommand (name + ".dhall") env' ''
|
config = hostPkgs.runCommand (name + ".dhall") env' ''
|
||||||
${apps.dhall.program} <<< "(${
|
${apps.dhall.program} <<< \
|
||||||
./driver-linux-config.dhall
|
"(${./driver-linux-config.dhall} ${testConfig})" > $out
|
||||||
} ${testConfig})" > $out
|
|
||||||
'';
|
'';
|
||||||
xml = hostPkgs.runCommand (name + ".config") env' ''
|
xml = hostPkgs.runCommand (name + ".config") env' ''
|
||||||
${apps.render-init.program} "(${
|
${apps.render-init.program} \
|
||||||
./driver-linux-config.dhall
|
"(${./driver-linux-config.dhall} ${testConfig}).config" > $out
|
||||||
} ${testConfig}).config" > $out
|
|
||||||
'';
|
'';
|
||||||
image = hostPkgs.runCommand (name + ".config") env' ''
|
image = hostPkgs.runCommand (name + ".config") env' ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
pushd $out
|
pushd $out
|
||||||
${apps.linux-image.program} "${./driver-linux-config.dhall} ${testConfig}"
|
${apps.linux-image.program} \
|
||||||
|
"${./driver-linux-config.dhall} ${testConfig}"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -61,19 +61,15 @@ in λ(args : Args)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let baseNova = env:BASE_NOVA_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
let os = env:OS_MANIFEST
|
|
||||||
|
|
||||||
let sotest = env:SOTEST_PRODUCER_MANIFEST
|
|
||||||
|
|
||||||
in Genode.Boot.toRomPaths
|
in Genode.Boot.toRomPaths
|
||||||
[ { mapKey = "ld.lib.so"
|
[ { mapKey = "ld.lib.so"
|
||||||
, mapValue = baseNova.lib.ld-nova.mapValue
|
, mapValue = manifest.base-nova.lib.ld-nova.mapValue
|
||||||
}
|
}
|
||||||
, baseNova.bin.nova_timer_drv
|
, manifest.base-nova.bin.nova_timer_drv
|
||||||
, os.bin.init
|
, manifest.os.bin.init
|
||||||
, sotest.bin.sotest-harness
|
, manifest.sotest-producer.bin.sotest-harness
|
||||||
]
|
]
|
||||||
# args.rom
|
# args.rom
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,17 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
mkTest = { name ? "unamed", testScript, testConfig, env ? { }, qemuMem ? 32
|
mkTest = { name ? "unamed", testScript, testConfig, testInputs ? [ ]
|
||||||
, ... # TODO: remove ...
|
, env ? { }, qemuMem ? 32, ... # TODO: remove ...
|
||||||
}@t:
|
}@t:
|
||||||
let
|
let
|
||||||
|
manifest = lib.mergeManifests (with testPkgs;
|
||||||
|
[ genode.base genode.base-nova genode.os sotest-producer ]
|
||||||
|
++ testInputs);
|
||||||
env' = {
|
env' = {
|
||||||
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
|
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
|
||||||
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
|
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
|
||||||
BASE_MANIFEST = testPkgs.genode.base.manifest;
|
MANIFEST = manifest;
|
||||||
BASE_NOVA_MANIFEST = testPkgs.genode.base-nova.manifest;
|
|
||||||
OS_MANIFEST = testPkgs.genode.os.manifest;
|
|
||||||
SOTEST_PRODUCER_MANIFEST = testPkgs.sotest-producer.manifest;
|
|
||||||
} // env;
|
} // env;
|
||||||
|
|
||||||
iso = apps.nova-iso.function env'
|
iso = apps.nova-iso.function env'
|
||||||
|
@ -127,24 +127,23 @@ let
|
||||||
test = passMeta (runTests driver);
|
test = passMeta (runTests driver);
|
||||||
|
|
||||||
in test // {
|
in test // {
|
||||||
inherit driver iso test;
|
inherit driver iso test manifest;
|
||||||
|
|
||||||
config = hostPkgs.runCommand (name + ".dhall") env' ''
|
config = hostPkgs.runCommand (name + ".dhall") env' ''
|
||||||
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
|
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
|
||||||
${apps.dhall.program} <<< "(${
|
${apps.dhall.program} <<< \
|
||||||
./driver-nova-config.dhall
|
"(${./driver-nova-config.dhall} ${testConfig})" > $out
|
||||||
} ${testConfig})" > $out
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
xml = hostPkgs.runCommand (name + ".config") env' ''
|
xml = hostPkgs.runCommand (name + ".config") env' ''
|
||||||
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
|
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
|
||||||
${apps.render-init.program} "(${
|
${apps.render-init.program} \
|
||||||
./driver-nova-config.dhall
|
"(${./driver-nova-config.dhall} ${testConfig}).config" > $out'';
|
||||||
} ${testConfig}).config" > $out'';
|
|
||||||
|
|
||||||
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''
|
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''
|
||||||
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
|
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
|
||||||
${apps.nova-image.program} image.elf "${./driver-nova-config.dhall} ${testConfig}"
|
${apps.nova-image.program} \
|
||||||
|
image.elf "${./driver-nova-config.dhall} ${testConfig}"
|
||||||
cp "${testPkgs.bender}" bender
|
cp "${testPkgs.bender}" bender
|
||||||
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
|
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
|
|
|
@ -81,12 +81,13 @@ in { config =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
in [ os.bin.fs_report
|
in Genode.Boot.toRomPaths
|
||||||
, os.bin.fs_rom
|
[ manifest.os.bin.fs_report
|
||||||
, os.bin.ram_fs
|
, manifest.os.bin.fs_rom
|
||||||
, os.bin.test-fs_report
|
, manifest.os.bin.ram_fs
|
||||||
, os.lib.vfs
|
, manifest.os.bin.test-fs_report
|
||||||
]
|
, manifest.os.lib.vfs
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ in { config =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let base = env:BASE_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
in Genode.Boot.toRomPaths [ base.bin.test-log ]
|
in Genode.Boot.toRomPaths [ manifest.base.bin.test-log ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,12 @@ in { config =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
in Genode.Boot.toRomPaths
|
in Genode.Boot.toRomPaths
|
||||||
[ os.bin.acpi_drv
|
[ manifest.os.bin.acpi_drv
|
||||||
, os.bin.platform_drv
|
, manifest.os.bin.platform_drv
|
||||||
, os.bin.report_rom
|
, manifest.os.bin.report_rom
|
||||||
, os.bin.test-pci
|
, manifest.os.bin.test-pci
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ in { config =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
in Genode.Boot.toRomPaths [ os.bin.test-rtc, os.bin.rtc_drv ]
|
in Genode.Boot.toRomPaths
|
||||||
|
[ manifest.os.bin.test-rtc, manifest.os.bin.rtc_drv ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ in { config =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
in Genode.Boot.toRomPaths [ os.bin.test-signal ]
|
in Genode.Boot.toRomPaths [ manifest.os.bin.test-signal ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
let Genode = env:DHALL_GENODE
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
let tests = env:SOLO5_TEST_MANIFEST
|
|
||||||
|
|
||||||
in { config =
|
in { config =
|
||||||
Genode.Init::{
|
Genode.Init::{
|
||||||
|
@ -36,5 +34,6 @@ in { config =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
Genode.Boot.toRomPaths [ tests.bin.solo5-test_blk, os.bin.ram_block ]
|
Genode.Boot.toRomPaths
|
||||||
|
[ manifest.solo5-tests.bin.solo5-test_blk, manifest.os.bin.ram_block ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
|
|
||||||
let Genode = env:DHALL_GENODE
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
let solo5 = env:SOLO5_MANIFEST
|
|
||||||
|
|
||||||
let RomMap = Genode.Prelude.Map.Type Text Genode.Boot.Rom
|
let RomMap = Genode.Prelude.Map.Type Text Genode.Boot.Rom
|
||||||
|
|
||||||
let Args = { config : Genode.Init.Type, rom : RomMap } : Type
|
let Args = { config : Genode.Init.Type, rom : RomMap } : Type
|
||||||
|
|
||||||
in λ(boot : Args)
|
in λ(boot : Args)
|
||||||
→ { config = boot.config
|
→ { config = boot.config
|
||||||
, rom = Genode.Boot.toRomPaths [ solo5.lib.solo5 ] # boot.rom
|
, rom =
|
||||||
|
Genode.Boot.toRomPaths [ (env:MANIFEST).solo5.lib.solo5 ] # boot.rom
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,7 @@ let
|
||||||
testEnv.mkTest (attrs // {
|
testEnv.mkTest (attrs // {
|
||||||
name = "solo5-" + name;
|
name = "solo5-" + name;
|
||||||
inherit testScript;
|
inherit testScript;
|
||||||
env = {
|
testInputs = [ pkgs.solo5 pkgs.solo5.tests ];
|
||||||
SOLO5_MANIFEST = pkgs.solo5.manifest;
|
|
||||||
SOLO5_TEST_MANIFEST = pkgs.solo5.tests.manifest;
|
|
||||||
};
|
|
||||||
testConfig = "(${./boot-wrapper.dhall} ${testConfig})";
|
testConfig = "(${./boot-wrapper.dhall} ${testConfig})";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,7 +24,7 @@ let
|
||||||
mkTests = testList: builtins.listToAttrs (map applyMkTest testList);
|
mkTests = testList: builtins.listToAttrs (map applyMkTest testList);
|
||||||
|
|
||||||
toSimple = name:
|
toSimple = name:
|
||||||
"(${./simple.dhall} (env:SOLO5_TEST_MANIFEST).bin.solo5-test_${name})";
|
"(${./simple.dhall} (env:MANIFEST).solo5-tests.bin.solo5-test_${name})";
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
let Genode = env:DHALL_GENODE
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
let tests = env:SOLO5_TEST_MANIFEST
|
|
||||||
|
|
||||||
in { config =
|
in { config =
|
||||||
Genode.Init::{
|
Genode.Init::{
|
||||||
|
@ -73,9 +71,9 @@ in { config =
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
Genode.Boot.toRomPaths
|
Genode.Boot.toRomPaths
|
||||||
[ os.bin.nic_loopback
|
[ manifest.os.bin.nic_loopback
|
||||||
, os.bin.nic_bridge
|
, manifest.os.bin.nic_bridge
|
||||||
, os.bin.ping
|
, manifest.os.bin.ping
|
||||||
, tests.bin.solo5-test_net
|
, manifest.solo5-tests.bin.solo5-test_net
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
let Genode = env:DHALL_GENODE
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
let tests = env:SOLO5_TEST_MANIFEST
|
|
||||||
|
|
||||||
in { config =
|
in { config =
|
||||||
Genode.Init::{
|
Genode.Init::{
|
||||||
|
@ -79,10 +77,10 @@ in { config =
|
||||||
}
|
}
|
||||||
, rom =
|
, rom =
|
||||||
Genode.Boot.toRomPaths
|
Genode.Boot.toRomPaths
|
||||||
[ tests.bin.solo5-test_net_2if
|
[ manifest.solo5-tests.bin.solo5-test_net_2if
|
||||||
, os.bin.sequence
|
, manifest.os.bin.sequence
|
||||||
, os.bin.nic_bridge
|
, manifest.os.bin.nic_bridge
|
||||||
, os.bin.nic_loopback
|
, manifest.os.bin.nic_loopback
|
||||||
, os.bin.ping
|
, manifest.os.bin.ping
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
let Genode = env:DHALL_GENODE
|
let Genode = env:DHALL_GENODE
|
||||||
|
|
||||||
let os = env:OS_MANIFEST
|
let manifest = env:MANIFEST
|
||||||
|
|
||||||
let tests = env:SOLO5_TEST_MANIFEST
|
let test = manifest.solo5-tests.bin.solo5-test_time
|
||||||
|
|
||||||
let test = tests.bin.solo5-test_time
|
|
||||||
|
|
||||||
in { config =
|
in { config =
|
||||||
Genode.Init::{
|
Genode.Init::{
|
||||||
|
@ -30,5 +28,5 @@ in { config =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, rom = Genode.Boot.toRomPaths [ test, os.bin.rtc_drv ]
|
, rom = Genode.Boot.toRomPaths [ test, manifest.os.bin.rtc_drv ]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue