chiark / gitweb /
dhcp: Add tests for DHCP options, file and sname fields
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 9 Dec 2013 21:43:14 +0000 (23:43 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Dec 2013 16:43:33 +0000 (11:43 -0500)
commita10c375e02da66efec40e28142bc22fd8955e968
tree8351fc1a84e95702a894509bee2fad7d79b3c888
parent78628cd27355a157bf44df1cb91f782150a7ca20
dhcp: Add tests for DHCP options, file and sname fields

Add a structure describing the DHCP file, sname and trailing options
fields. Create a messge holding these fields and call the internal
option parsing function.

In the test callback function verify that only regular options are
passed and figure out which part of the DHCP message is the one that
is being processed. As the test program knows the full contents of
the test options in the test structure, skip all non-regular fields
and verify that the option provided to the callback indeed is the
one expected. Check also if non-regular option fields are to be
ignored in the end of the option field as the callback is not called
again and the final check when the whole message has been processed
needs to be successful.

Add a boolean flag for pretty-printing, anticipate there will be a
nice option to toggle it in the future.
src/libsystemd-dhcp/test-dhcp-option.c