From ed9be0bb76747cb1b43c51ecb7df296913452d49 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Tue, 20 Oct 2020 02:55:51 +0200 Subject: [PATCH] WiP! tox-bootstrapd test --- overlay/default.nix | 9 +++ tests/default.nix | 11 +++- tests/tox-bootstrapd.dhall | 127 +++++++++++++++++++++++++++++++++++++ tests/tox-bootstrapd.nix | 18 ++++++ 4 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 tests/tox-bootstrapd.dhall create mode 100644 tests/tox-bootstrapd.nix diff --git a/overlay/default.nix b/overlay/default.nix index be02726..4488960 100644 --- a/overlay/default.nix +++ b/overlay/default.nix @@ -72,12 +72,21 @@ in { genodeSources = buildPackages.callPackage ../packages/genodelabs { inherit flake; }; + libconfig = overrideHostAttrs libconfig + (attrs: { configureFlags = [ "--disable-examples" ]; }); + libcCrossChooser = name: if stdenv.targetPlatform.isGenode then targetPackages.genodeLibcCross else prev.libcCrossChooser name; + libtoxcore = overrideHost libtoxcore { + libopus = null; + libvpx = null; + ncurses = null; + }; + llvmPackages_8 = callPackage ./llvm-8 ({ inherit (stdenvAdapters) overrideCC; inherit (targetPackages.genodeSources) genodeBase; diff --git a/tests/default.nix b/tests/default.nix index 2b0f417..b4d99d2 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -8,9 +8,14 @@ let inherit nixpkgs localPackages legacyPackages; }; - testFiles = - map callTest [ ./log.nix ./posix.nix ./vmm_arm.nix ./vmm_x86.nix ./x86.nix ] - ++ (callTest ./solo5); + testFiles = map callTest [ + ./log.nix + ./posix.nix + ./tox-bootstrapd.nix + ./vmm_arm.nix + ./vmm_x86.nix + ./x86.nix + ] ++ (callTest ./solo5); testPkgs = genodepkgs; diff --git a/tests/tox-bootstrapd.dhall b/tests/tox-bootstrapd.dhall new file mode 100644 index 0000000..194cbb1 --- /dev/null +++ b/tests/tox-bootstrapd.dhall @@ -0,0 +1,127 @@ +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 toArgsXML = + Prelude.List.map + Text + XML.Type + ( λ(value : Text) → + XML.leaf { name = "arg", attributes = toMap { value } } + ) + +let tox-bootstrap = + Init::{ + , verbose = True + , routes = + [ ServiceRoute.parent "Timer" + , ServiceRoute.child "Platform" "platform_drv" + ] + , children = toMap + { tox-bootstrapd = + Child.flat + Child.Attributes::{ + , binary = "tox-bootstrapd" + , exitPropagate = True + , resources = Resources::{ ram = Genode.units.MiB 16 } + , config = Init.Config::{ + , content = + [ XML.text + '' + + + + + + enable_motd = true + motd = "Genode Tox bootstrapd test" + + + + '' + ] + # toArgsXML + [ "tox-bootstrapd" + , "--config=/config" + , "--foreground" + , "--log-backend=stdout" + ] + } + , routes = [ ServiceRoute.child "Nic" "nic_drv" ] + } + , nic_drv = + Child.flat + Child.Attributes::{ + , binary = "ipxe_nic_drv" + , provides = [ "Nic" ] + , resources = Init.Resources::{ + , caps = 128 + , ram = Genode.units.MiB 4 + } + , routes = [ ServiceRoute.child "Platform" "platform_drv" ] + } + , 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" + ] + } + , 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 "IRQ" + , ServiceRoute.parent "IO_MEM" + , ServiceRoute.parent "IO_PORT" + ] + , config = Init.Config::{ + , policies = + [ Init.Config.Policy::{ + , label = Init.LabelSelector.prefix "nic_drv" + , content = + [ XML.leaf + { name = "pci" + , attributes = toMap { class = "ETHERNET" } + } + ] + } + ] + } + } + } + } + +in Test::{ children = Test.initToChildren tox-bootstrap } diff --git a/tests/tox-bootstrapd.nix b/tests/tox-bootstrapd.nix new file mode 100644 index 0000000..e6afe1e --- /dev/null +++ b/tests/tox-bootstrapd.nix @@ -0,0 +1,18 @@ +{ pkgs, legacyPackages, ... }: + +{ + name = "tox-bootstrapd"; + constraints = builtins.any (spec: spec == "x86"); + machine = { + config = ./tox-bootstrapd.dhall; + inputs = map pkgs.genodeSources.depot [ + "acpi_drv" + "ipxe_nic_drv" + "libc" + "platform_drv" + "posix" + "report_rom" + "vfs_lwip" + ] ++ (with legacyPackages; [ libtoxcore ]); + }; +}