From 15c8cadd1173f681142a3f48319a203d7b917850 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Fri, 6 Sep 2013 11:46:56 +0800 Subject: discover/pxe: check for a valid boot option before adding If we didn't find any valid boot options in the pxe buffer, we'll call discover_context_add_boot_option with a NULL boot option. This change adds a check before we try to add the boot option, and a test to verify this situation. Signed-off-by: Jeremy Kerr --- test/parser/test-pxe-empty.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/parser/test-pxe-empty.c (limited to 'test/parser/test-pxe-empty.c') diff --git a/test/parser/test-pxe-empty.c b/test/parser/test-pxe-empty.c new file mode 100644 index 0000000..eb3b758 --- /dev/null +++ b/test/parser/test-pxe-empty.c @@ -0,0 +1,19 @@ + +#include "parser-test.h" + +#if 0 /* PARSER_EMBEDDED_CONFIG */ + +#endif + +void run_test(struct parser_test *test) +{ + struct discover_context *ctx; + + test_read_conf_embedded(test); + test_set_conf_source(test, "tftp://host/dir/conf.txt"); + test_run_parser(test, "pxe"); + + ctx = test->ctx; + + check_boot_option_count(ctx, 0); +} -- cgit v1.2.1