]> git.ozlabs.org Git - petitboot/blob - test/parser/test-pxe-discover-bootfile-absolute-conffile.c
utils/pb-sos: Don't create files in root by default
[petitboot] / test / parser / test-pxe-discover-bootfile-absolute-conffile.c
1
2 #include "parser-test.h"
3
4 #if 0 /* PARSER_EMBEDDED_CONFIG */
5 label linux
6 kernel vmlinux
7 initrd initrd
8 #endif
9
10 /**
11  * Test that a pxeconffile option (DHCP opt 209) takes precedence over
12  * configuration discovery, and is resolved as an absolute path, overriding
13  * any prefix in bootfile.
14  */
15
16 void run_test(struct parser_test *test)
17 {
18         struct discover_boot_option *opt;
19         struct discover_context *ctx;
20
21         /* fixme: we should have a normalised URL here */
22         test_read_conf_embedded_url(test, "tftp://host//dir1/conf");
23
24         test_set_event_source(test);
25         test_set_event_param(test->ctx->event, "bootfile", "dir2/binary");
26         test_set_event_param(test->ctx->event, "pxeconffile", "/dir1/conf");
27         test_set_event_param(test->ctx->event, "tftp", "host");
28
29         test_run_parser(test, "pxe");
30
31         ctx = test->ctx;
32
33         check_boot_option_count(ctx, 1);
34         opt = get_boot_option(ctx, 0);
35
36         check_name(opt, "linux");
37
38         check_resolved_url_resource(opt->boot_image,
39                         "tftp://host/dir1/vmlinux");
40         check_resolved_url_resource(opt->initrd,
41                         "tftp://host/dir1/initrd");
42 }