Browse Source

Produce Sotest binaries.zip for every NOVA test

20.02
Emery Hemingway 2 years ago
parent
commit
f78cb9477e
  1. 13
      tests/default.nix
  2. 53
      tests/driver-nova-config.dhall
  3. 21
      tests/driver-nova.nix
  4. 54
      tests/driver-sotest-nova.nix

13
tests/default.nix

@ -25,16 +25,17 @@ let
inherit apps system testPkgs hostPkgs lib depot;
}).callTest;
sotest-nova = (call: ((tests call) // { pci = call ./pci.nix { }; }))
(import ./driver-sotest-nova.nix {
inherit apps system testPkgs hostPkgs lib depot;
}).callTest;
testsToList = tests:
map (test: {
inherit (test) name;
value = test;
}) (builtins.attrValues tests);
nova-sotest = map ({ name, value }: {
name = name + "-sotest";
value = value.sotest;
}) (testsToList nova);
in with builtins;
listToAttrs (concatLists (map (testsToList) [ linux nova sotest-nova ]))
listToAttrs
((concatLists (map (testsToList) [ linux nova ])) ++ nova-sotest)

53
tests/driver-nova-config.dhall

@ -2,10 +2,6 @@
let Genode = env:DHALL_GENODE
let baseNova = env:BASE_NOVA_MANIFEST
let os = env:OS_MANIFEST
let Args =
{ config : Genode.Init.Type, rom : Genode.Prelude.Map.Type Text Text }
: Type
@ -31,13 +27,50 @@ in λ(args : Args)
, provides = [ "Timer" ]
}
}
, { mapKey = "init", mapValue = Genode.Init.toStart args.config }
, { mapKey = "harness"
, mapValue =
let child = Genode.Init.toStart args.config
in Genode.Init.Start::{
, binary = "sotest-harness"
, exitPropagate = True
, resources =
{ caps = child.resources.caps + 128
, ram = child.resources.ram + Genode.units.MiB 1
}
, config =
Some
( Genode.Prelude.XML.element
{ name = "config"
, attributes =
Genode.Prelude.XML.emptyAttributes
, content =
[ Genode.Init.Start.toXML "init" child ]
}
)
, routes =
[ Genode.ServiceRoute.parentLabel
"LOG"
(Some "SOTEST")
(Some "platform")
]
}
}
]
}
, rom =
[ { mapKey = "ld.lib.so", mapValue = baseNova.lib.ld-nova.mapValue }
, baseNova.bin.nova_timer_drv
, os.bin.init
]
# args.rom
let baseNova = env:BASE_NOVA_MANIFEST
let os = env:OS_MANIFEST
let sotest = env:SOTEST_PRODUCER_MANIFEST
in [ { mapKey = "ld.lib.so"
, mapValue = baseNova.lib.ld-nova.mapValue
}
, baseNova.bin.nova_timer_drv
, os.bin.init
, sotest.bin.sotest-harness
]
# args.rom
}

21
tests/driver-nova.nix

@ -41,8 +41,10 @@ let
env' = {
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
BASE_MANIFEST = testPkgs.genode.base.manifest;
BASE_NOVA_MANIFEST = testPkgs.genode.base-nova.manifest;
OS_MANIFEST = testPkgs.genode.os.manifest;
SOTEST_PRODUCER_MANIFEST = testPkgs.sotest-producer.manifest;
} // env;
iso = apps.nova-iso.function env'
@ -126,15 +128,34 @@ let
in test // {
inherit driver iso test;
config = hostPkgs.runCommand (name + ".dhall") env' ''
${apps.dhall.program} <<< "(${
./driver-nova-config.dhall
} ${testConfig})" > $out
'';
xml = hostPkgs.runCommand (name + ".config") env' ''
${apps.render-init.program} "(${
./driver-nova-config.dhall
} ${testConfig}).config" > $out'';
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''
export XDG_CACHE_HOME=${TMPDIR:-/tmp}
${apps.nova-image.program} image.elf \
${./driver-nova-config.dhall} ${testConfig}
cp "${testPkgs.bender}" bender
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
mkdir -p $out/nix-support
${hostPkgs.zip}/bin/zip "$out/binaries.zip" \
bender hypervisor image.elf
${apps.dhall-to-yaml.program} < ${
./sotest_config.dhall
} > "$out/sotest_config.yaml"
echo file zip $out/binaries.zip >> "$out/nix-support/hydra-build-products"
echo file config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products"
'';
};
in {

54
tests/driver-sotest-nova.nix

@ -1,54 +0,0 @@
# SPDX-License-Identifier: CC0-1.0
{ system, apps, testPkgs, hostPkgs, lib, depot }:
let
mkTest = { name ? "unamed", testConfig, env ? { }, ... }:
let
env' = {
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
BASE_NOVA_MANIFEST = testPkgs.genode.base-nova.manifest;
OS_MANIFEST = testPkgs.genode.os.manifest;
SOTEST_PRODUCER_MANIFEST = testPkgs.sotest-producer.manifest;
} // env;
drv = hostPkgs.runCommand "nova-${name}-sotest" env' ''
${apps.nova-image.program} image.elf \
${./driver-nova-config.dhall} ${testConfig}
cp "${testPkgs.bender}" bender
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
mkdir -p $out/nix-support
${hostPkgs.zip}/bin/zip "$out/binaries.zip" \
bender hypervisor image.elf
${apps.dhall-to-yaml.program} < ${
./sotest_config.dhall
} > "$out/sotest_config.yaml"
echo file zip $out/binaries.zip >> "$out/nix-support/hydra-build-products"
echo file config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products"
'';
in drv // {
config = hostPkgs.runCommand (name + ".dhall") env' ''
${apps.dhall.program} <<< "(${
./driver-nova-config.dhall
} ${testConfig})" > $out
'';
xml = hostPkgs.runCommand (name + ".config") env' ''
${apps.render-init.program} "(${
./driver-nova-config.dhall
} ${testConfig}).config" > $out'';
};
in {
callTest = path: args:
(import path ({
testEnv = {
inherit mkTest lib;
isLinux = false;
isNova = true;
};
pkgs = testPkgs;
inherit depot;
} // args));
}
Loading…
Cancel
Save