These tests exercise Fuchsia's DHCP client abilities when interacting with a Debian DHCP server.
The key pieces to this test are
resources
.dhcp_validity
test, there is a config file for dhcpd and a bash script that runs on the Debian guest. Those need to be included in the resources
section so that netemul can send them to the guest before test program runs.meta
.binaries
.deps
.tests
.tests
needs a name
that points to an empty binary and has an associated component manifest in the meta directory.See meta/dhcp_validity_test.cmx
.
"guest": [ { "files": { "data/dhcp_setup.sh": "/root/input/dhcp_setup.sh", "data/dhcpd.conf": "/etc/dhcp/dhcpd.conf" "data/dhcpd6.conf": "/etc/dhcp/dhcpd6.conf" }, "label": "debian_guest", "networks": [ "net" ], "url": "fuchsia-pkg://fuchsia.com/debian_guest#meta/debian_guest.cmx" } ],
files
contains a source to destination mapping for input files that should be transferred to the guest before the test starts.resources
section of the test_package
.label
defines the name of the guest that will be used to look up the guest during the test so that the test can control it.networks
lists the ethertap networks to which the guest will be connected. Currently, the guest may only connect to a single network.url
defines the type of guest VM will be launched for the test. Currently, only Debian guests are supported.The test program configures dhcpd on the Debian guest and then waits for 30 seconds to ensure that netstack gets a DHCP address. dhcpd.conf
and dhcp_setup.sh
are pushed to the guest by netemul before the test runs. The test leverages the GuestDiscoveryService
to get a handle to a GuestInteractionService
that enables the transfer of files and execution of commands on the guest (see the helper library).
Using the same setup, the test program also configures dhcpd on the Debian guest to serve DHCPv6 requests. It then launches a DHCPv6 client in Fuchsia and expects it get a predefined list of DNS servers from dhcpd on the Debian guest.