tests: add simple networking test
Just a test that pings one machine from another.
This commit is contained in:
parent
8dca0ca962
commit
b008da6c13
|
@ -11,6 +11,7 @@ let
|
|||
./bash.nix
|
||||
./hello.nix
|
||||
./log.nix
|
||||
./networking.nix
|
||||
./solo5/multi.nix
|
||||
./vmm_x86.nix
|
||||
./x86.nix
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
name = "networking";
|
||||
nodes = {
|
||||
|
||||
a = { pkgs, ... }: { imports = [ ../nixos-modules/hardware.nix ]; };
|
||||
|
||||
b = { config, pkgs, ... }: {
|
||||
imports = [ ../nixos-modules/hardware.nix ];
|
||||
networking.interfaces.eth1.genode.stack = null;
|
||||
genode.init.children.ping = {
|
||||
inputs = with pkgs.genodePackages; [ ping ];
|
||||
configFile = let
|
||||
ip = builtins.head config.networking.interfaces.eth1.ipv4.addresses;
|
||||
in pkgs.writeText "ping.dhall" ''
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
let Init = Genode.Init
|
||||
|
||||
let Child = Init.Child
|
||||
|
||||
in Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "ping"
|
||||
, resources = Init.Resources::{ ram = Genode.units.MiB 8 }
|
||||
, routes = [ Init.ServiceRoute.child "Nic" "eth1.driver" ]
|
||||
, config = Init.Config::{
|
||||
, attributes = toMap
|
||||
{ interface = "${ip.address}/${toString ip.prefixLength}"
|
||||
, dst_ip = "192.168.1.1"
|
||||
, period_sec = "1"
|
||||
, count = "10"
|
||||
, verbose = "yes"
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
testScript = ''
|
||||
start_all()
|
||||
b.wait_until_serial_output('child "ping" exited with exit value 0')
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue