diff --git a/tests/default.nix b/tests/default.nix index 4faaf57..eda496f 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -10,7 +10,8 @@ let inherit nixpkgs localPackages legacyPackages; }; - testFiles = map callTest [ ./log.nix ./posix.nix ./vmm_x86.nix ./x86.nix ] + testFiles = + map callTest [ ./log.nix ./posix.nix ./vmm_arm.nix ./vmm_x86.nix ./x86.nix ] ++ (callTest ./solo5); testPkgs = genodepkgs; diff --git a/tests/vmm_arm.dhall b/tests/vmm_arm.dhall new file mode 100644 index 0000000..869e9ef --- /dev/null +++ b/tests/vmm_arm.dhall @@ -0,0 +1,99 @@ +-- SPDX-License-Identifier: CC0-1.0 + +let Test = ./test.dhall ? env:DHALL_GENODE_TEST + +let Genode = Test.Genode + +let XML = Genode.Prelude.XML + +let Init = Genode.Init + +let ServiceRoute = Init.ServiceRoute + +let Child = Init.Child + +in λ(guest : { linux : Text, dtb : Text, initrd : Text }) + → let init = + Init::{ + , children = toMap + { nic = + Child.flat + Child.Attributes::{ + , binary = "nic_router" + , config = Init.Config::{ + , content = + [ XML.leaf + { name = "default-policy" + , attributes = toMap { domain = "default" } + } + , XML.element + { name = "domain" + , attributes = toMap + { name = "default" + , interface = "10.0.1.1/24" + } + , content = + [ XML.leaf + { name = "dhcp-server" + , attributes = toMap + { ip_first = "10.0.1.2" + , ip_last = "10.0.1.254" + } + } + ] + } + ] + } + , provides = [ "Nic" ] + , resources = Init.Resources::{ ram = Genode.units.MiB 8 } + } + , earlycon = + Child.flat + Child.Attributes::{ + , binary = "log_terminal" + , provides = [ "Terminal" ] + } + , terminal_crosslink = + Child.flat + Child.Attributes::{ + , binary = "terminal_crosslink" + , provides = [ "Terminal" ] + } + , vmm = + Child.flat + Child.Attributes::{ + , binary = "vmm" + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 256 + } + , routes = + [ ServiceRoute.parent "VM" + , ServiceRoute.child "Nic" "nic" + , ServiceRoute.childLabel + "Terminal" + "earlycon" + (Some "earlycon") + (None Text) + , ServiceRoute.child "Terminal" "terminal_crosslink" + ] + } + , vm = + Child.flat + Child.Attributes::{ + , binary = "test-terminal_expect_send" + , config = Init.Config::{ + , attributes = toMap + { expect = "/ #", send = "ls", verbose = "yes" } + } + , routes = + [ ServiceRoute.child "Terminal" "terminal_crosslink" ] + } + } + , routes = [ ServiceRoute.parent "Timer" ] + } + + in Test::{ + , children = Test.initToChildren init + , rom = Genode.Boot.toRomPaths (toMap guest) + } diff --git a/tests/vmm_arm.nix b/tests/vmm_arm.nix new file mode 100644 index 0000000..7cd81ef --- /dev/null +++ b/tests/vmm_arm.nix @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: CC0-1.0 + +{ pkgs, localPackages, ... }: + +{ + name = "vmm_arm"; + constraints = specs: + with builtins; + all (f: any f specs) [ (spec: spec == "aarch64") ]; + machine = { + + config = with localPackages; + let + linux = fetchurl { + url = "http://genode.org/files/release-20.02/linux-arm64"; + hash = "sha256-H6FhNGgkApouy+PyjxrgAPnJSc4BIlWlpg+VhWiUI6o="; + }; + dtb = fetchurl { + url = "http://genode.org/files/release-20.02/dtb-arm64-virt"; + hash = "sha256-MFzwYtjAmR/V3WLkmWojYhi3aPrzEqsy1kA46Y512UM="; + }; + initrd = fetchurl { + url = "http://genode.org/files/release-20.02/initrd-arm64"; + hash = "sha256-iOKd2X2zgDIGeuLEDSSTLSw/Ywi7mDET36J1NAqgqls="; + }; + + guest = writeText "guest.dhall" '' + { linux = "${linux}", dtb = "${dtb}", initrd = "${initrd}" } + ''; + + in "${./vmm_arm.dhall} ${guest}"; + + inputs = with pkgs; + let + vmm' = genodeSources.buildUpstream { + name = "vmm_arm"; + targets = [ "server/vmm" ]; + KERNEL = "hw"; + }; + in [ vmm' ] ++ map genodeSources.depot [ + "log_terminal" + "nic_router" + "terminal_crosslink" + ] ++ map genodeSources.make [ "test/terminal_expect_send" ]; + }; + + testScript = '' + start_all() + machine.wait_until_serial_output("linuxrc") + ''; +} diff --git a/tests/vmm_x86.nix b/tests/vmm_x86.nix index e6f3ffd..eee6af7 100644 --- a/tests/vmm_x86.nix +++ b/tests/vmm_x86.nix @@ -3,7 +3,7 @@ { pkgs, ... }: { - name = "vmm"; + name = "vmm_x86"; constraints = specs: with builtins; all (f: any f specs) [ (spec: spec == "nova") (spec: spec == "x86") ];