From f894c2ef952533096642d7c15e7ee4491923754e Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 13 Nov 2020 00:22:27 +0100 Subject: [PATCH] WiP! tests/rsync: client connects to server, dies after fork --- tests/rsync.nix | 91 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 9 deletions(-) diff --git a/tests/rsync.nix b/tests/rsync.nix index d300ad8..b168526 100644 --- a/tests/rsync.nix +++ b/tests/rsync.nix @@ -1,15 +1,88 @@ { name = "rsync"; - machine = { pkgs, ... }: { - imports = [ ../nixos-modules/systemd.nix ../nixos-modules/hardware.nix ]; - networking.interfaces.eth1.genode.stack = "lwip"; - services.rsyncd = { - enable = true; - settings.root.path = "/"; + nodes = { + + server = { pkgs, ... }: { + imports = [ ../nixos-modules/systemd.nix ../nixos-modules/hardware.nix ]; + networking.interfaces.eth1.genode.stack = "lwip"; + services.rsyncd = { + enable = true; + settings.root.path = "/"; + }; + systemd.services.rsyncd.genode = { + enable = true; + interface = "eth1"; + }; }; - systemd.services.rsyncd.genode = { - enable = true; - interface = "eth1"; + + client = { pkgs, ... }: { + imports = [ ../nixos-modules/hardware.nix ]; + networking.interfaces.eth1.genode.stack = "lwip"; + genode.init.children.rsync = { + inputs = with pkgs; [ rsync ]; + configFile = pkgs.writeText "rsync-client.dhall" '' + let Genode = env:DHALL_GENODE + + let Init = Genode.Init + + let Child = Init.Child + + in Child.flat + Child.Attributes::{ + , binary = "rsync" + , exitPropagate = True + , resources = Genode.Init.Resources::{ + , caps = 500 + , ram = Genode.units.MiB 16 + } + , routes = + [ Init.ServiceRoute.child "File_system" "eth1.sockets" ] + , config = Init.Config::{ + , content = + let XML = Genode.Prelude.XML + + let VFS = Genode.VFS + + in [ XML.leaf + { name = "libc" + , attributes = toMap + { stdin = "/dev/null" + , stdout = "/dev/log" + , stderr = "/dev/log" + , socket = "/dev/sockets" + } + } + , VFS.vfs + [ VFS.dir + "dev" + [ VFS.leaf "log" + , VFS.leaf "null" + , VFS.dir + "sockets" + [ VFS.fs VFS.FS::{ label = "eth1.sockets" } ] + ] + ] + ] + # Genode.Prelude.List.map + Text + XML.Type + ( λ(x : Text) → + XML.leaf + { name = "arg", attributes = toMap { value = x } } + ) + [ "rsync", "-rvvv", "192.168.1.2::" ] + } + } + ''; + }; }; + }; + + testScript = '' + server.start() + server.wait_until_serial_output('lwIP Nic interface up address=192.168.1.2') + client.start() + client.wait_until_serial_output('child "rsync" exited') + ''; }