2
0
Fork 0

Test of tftp_rom

This commit is contained in:
Ehmry - 2020-04-19 10:59:53 +05:30
parent 1ed34a9602
commit b7f3cfaa89
11 changed files with 242 additions and 7 deletions

View File

@ -99,6 +99,8 @@ in depotPkgs // {
NOVA = callPackage ./NOVA { };
rom_benchmark = callPackage ./rom_benchmark { };
solo5 = let drv = callPackage ./solo5 { };
in drv // { tests = drv.tests // { pname = "solo5-tests"; }; };
@ -118,7 +120,7 @@ in depotPkgs // {
owner = "ehmry";
repo = "genode-world";
rev = "tftp_rom";
hash = "sha256-C+M7H1duQbT6twWpx44C6MBh4JPyCdg5h3nqpMZAcHA=";
hash = "sha256-xYjLbGcz49I/AxSaNT3kB4BmaYGxhwxtbw+PZxgAbnQ=";
};
in "echo 'REPOSITORIES += ${genodeWorld}' >> $BUILD_DIR/etc/build.conf";
portInputs = with genodeSources.ports; [ lwip ];

View File

@ -251,10 +251,11 @@ in genodeSources // {
inherit buildUpstream buildDepot ports specs toolchain genodeBase;
make = target:
buildUpstream {
let attrs = buildOverrides.${target} or { };
in buildUpstream ({
name = builtins.replaceStrings [ "/" ] [ "-" ] target;
targets = [ target ];
};
} // attrs);
depot = name:
let attrs = buildOverrides.${name} or { };

View File

@ -2,7 +2,7 @@
{ buildPackages }:
with buildPackages; {
dde_bsd.hash = "sha256-2ilZs6JkcQAvU/sQYnHunGtGRZDt7qLTpKZxQxSOf2I=";
dde_ipxe.hash = "sha256-uK110Cr01D6I2Fo0ZNP5U7rheseuH7LsghSPdFaGU3k=";
dde_ipxe.hash = "sha256-Rulyc1r5xPwsOnVQobcB6Z67XWM5CF/PwyRVng9MFO8=";
dde_linux.hash = "sha256-3G5Mprv9ZBNhDJRuVF6Nrkp3KbFaN10IKFq0OdyAY9M=";
dde_rump = {
hash = "sha256-Wr5otGkWEa+5xImsFHQzwap5LckNEbyWA/7xbNcOreI=";

View File

@ -8,6 +8,8 @@ with ports; {
portInputs = [ dde_linux ];
};
ipxe_nic_drv.portInputs = [ dde_ipxe ];
libc.portInputs = [ libc ];
lighttpd.portInputs = [ libc lighttpd openssl zlib ];

View File

@ -0,0 +1,36 @@
# SPDX-License-Identifier: CC0-1.0
{ stdenv, fetchgit, buildPackages }:
stdenv.mkDerivation rec {
pname = "rom_benchmark";
version = "0.1";
nativeBuildInputs = with buildPackages; [ tup ];
src = fetchgit {
url = "https://git.sr.ht/~ehmry/rom_benchmark";
rev = "v" + version;
sha256 = "0j0ir4zv0bxf0d2k0giykcm3wwqr4wdv3ix42751sd9v1wwgbbjg";
};
configurePhase = ''
# Scan repository and generate script
tup init
tup generate buildPhase.sh
'';
buildPhase = ''
pushd .
source buildPhase.sh
popd
'';
installPhase = "install -Dm755 {.,$out}/rom_benchmark";
meta = with stdenv.lib; {
license = licenses.gpl3;
maintainers = [ maintainers.ehmry ];
};
}

View File

@ -34,6 +34,7 @@ let
noux = call ./noux.nix { };
pci = call ./pci.nix { };
rtc = call ./rtc.nix { };
tftp_rom = call ./tftp_rom.nix { };
})) (import ./driver-nova.nix {
inherit apps addManifest buildPackages depot lib nixpkgs testPkgs;
}).callTest;

View File

@ -38,7 +38,8 @@ let
''run_genode_until {[init] child "harness" exited with exit value 0} 60'';
mkTest = { name ? "unamed", testScript ? defaultScript, testConfig
, testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t:
, testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false
, extraSotest ? [ ], ... }@t:
let
manifest = lib.mergeManifests (map addManifest (with testPkgs;
[ base-nova (genodeSources.make "init") sotest-producer ]
@ -123,6 +124,7 @@ let
--set testScript "$testScript" \
--set baseSetup "$baseSetup" \
--set TEST_RAM $RAM \
--set-default out /tmp \
'';
passMeta = drv:
@ -148,9 +150,10 @@ let
cp "${testPkgs.bender}" bender
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
cp ${image} image.elf
find ${toString extraSotest} -type f -exec cp {} ./ \;
mkdir -p $out/nix-support
${buildPackages.zip}/bin/zip "$out/binaries.zip" \
hypervisor image.elf
*
${apps.dhall-to-yaml.program} < ${
./sotest_nova_config.dhall
} > "$out/sotest_config.yaml"

View File

@ -29,7 +29,7 @@ let
tests = [
{
name = "multi";
sotest = true;
sotest = false;
testConfig = "${./.}/solo5.dhall";
testInputs = map genodeMake [ "app/ping" ] ++ (map genodeDepot [
"ram_block"

View File

@ -27,6 +27,12 @@ let wrapHarness
"LOG"
(Some "SOTEST")
(Some "unlabeled")
, { service =
{ name = "LOG"
, label = Init.LabelSelector.Type.Last "unlabeled"
}
, route = Init.Route.Type.Parent { label = Some "unlabeled" }
}
, Init.ServiceRoute.parent "IO_MEM"
, Init.ServiceRoute.parent "IO_PORT"
, Init.ServiceRoute.parent "IRQ"

153
tests/tftp_rom.dhall Normal file
View File

@ -0,0 +1,153 @@
-- SPDX-License-Identifier: CC0-1.0
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
let Genode = Test.Genode
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Init = Genode.Init
let Child = Init.Child
let Resources = Init.Resources
let ServiceRoute = Init.ServiceRoute
let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label
let benchmarkAttrs =
Child.Attributes::{
, binary = "rom_benchmark"
, config =
{ attributes = toMap { interations = "8" }
, content =
Prelude.List.map
Text
XML.Type
( λ(label : Text)
→ XML.element
{ name = "rom"
, attributes = XML.emptyAttributes
, content = [ XML.text label ]
}
)
[ "rom_benchmark" ]
}
}
let test =
Genode.Init::{
, children = toMap
{ acpi_drv =
Child.flat
Child.Attributes::{
, binary = "acpi_drv"
, resources = Resources::{
, caps = 400
, ram = Genode.units.MiB 4
, constrainPhys = True
}
, provides = [ "Platform", "Acpi" ]
, romReports = [ label "acpi", label "smbios_table" ]
, routes =
[ ServiceRoute.parent "IRQ"
, ServiceRoute.parent "IO_MEM"
, ServiceRoute.parent "IO_PORT"
]
}
, nic_drv =
Child.flat
Child.Attributes::{
, binary = "ipxe_nic_drv"
, exitPropagate = True
, provides = [ "Nic" ]
, resources = Resources::{
, caps = 128
, ram = Genode.units.MiB 4
}
, routes =
[ ServiceRoute.parent "Timer"
, ServiceRoute.parent "IO_MEM"
, ServiceRoute.parent "IO_PORT"
, ServiceRoute.childLabel
"Platform"
"platform_drv"
(None Text)
(Some "ipxe_nic_drv")
]
}
, platform_drv =
Child.flat
Child.Attributes::{
, binary = "platform_drv"
, resources = Resources::{
, caps = 800
, ram = Genode.units.MiB 4
, constrainPhys = True
}
, reportRoms = [ label "acpi" ]
, provides = [ "Platform", "Acpi" ]
, routes =
[ ServiceRoute.parent "Timer"
, ServiceRoute.parent "IRQ"
, ServiceRoute.parent "IO_MEM"
, ServiceRoute.parent "IO_PORT"
]
, config = Init.Config::{
, content =
[ XML.text
''
<policy label_suffix="ipxe_nic_drv"> <pci class="ETHERNET"/> </policy>
''
]
}
}
, tftp_rom =
Child.flat
Child.Attributes::{
, binary = "tftp_rom"
, config = Init.Config::{
, attributes = toMap { verbose = "yes", dhcp = "yes" }
, content =
[ XML.text
''
<default-policy ip="10.0.2.2"/>
''
]
}
, exitPropagate = True
, provides = [ "ROM" ]
, resources = Resources::{ ram = Genode.units.MiB 32 }
, routes =
[ ServiceRoute.child "Nic" "nic_drv"
, ServiceRoute.parent "Timer"
]
}
, benchmark =
Child.flat
( benchmarkAttrs
⫽ { exitPropagate = True
, routes =
[ { service =
{ name = "ROM"
, label = Init.LabelSelector.Type.Last "ld.lib.so"
}
, route = Init.Route.parent
}
, ServiceRoute.child "ROM" "tftp_rom"
, ServiceRoute.parent "Timer"
]
}
)
}
}
in Test::{
, children = toMap
{ baseline = Child.flat benchmarkAttrs
, test = Init.toChild test Init.Attributes.default
}
}

31
tests/tftp_rom.nix Normal file
View File

@ -0,0 +1,31 @@
# SPDX-License-Identifier: CC0-1.0
{ buildPackages, testEnv, pkgs, ... }:
with pkgs;
let tftpRoot = pkgs.rom_benchmark;
in testEnv.mkTest {
name = "tftp_rom";
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
testConfig = ./tftp_rom.dhall;
testInputs = [ pkgs.tftp_rom pkgs.rom_benchmark ]
++ map pkgs.genodeSources.depot [
"acpi_drv"
"ipxe_nic_drv"
"platform_drv"
"report_rom"
];
testScript = ''
run_genode_until {SOTEST END} 60
'';
qemuArgs = [
"-netdev user,id=n0,restrict=on,tftp=${tftpRoot}"
"-device e1000,netdev=n0"
# "-object filter-dump,id=f0,netdev=n0,file=qemu.pcap"
];
sotest = true;
extraSotest = [ pkgs.rom_benchmark ];
}