X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=test%2Fparser%2Ftest-grub2-pos-param.c;fp=test%2Fparser%2Ftest-grub2-pos-param.c;h=09ac8fc4558ba81ffc4f3bf74bcc6b9bf0c83b23;hb=c19daa69bc15e73b7ebf79d5280ba62c86c20b6f;hp=0000000000000000000000000000000000000000;hpb=939660528bf1568c55b6dcf982cc9020c1dbcdd2;p=petitboot diff --git a/test/parser/test-grub2-pos-param.c b/test/parser/test-grub2-pos-param.c new file mode 100644 index 0000000..09ac8fc --- /dev/null +++ b/test/parser/test-grub2-pos-param.c @@ -0,0 +1,35 @@ + +#include "parser-test.h" + +#if 0 /* PARSER_EMBEDDED_CONFIG */ + +function set_params_var { + params="$1 $2" +} +menuentry 'Linux' { + set_params_var abc 123 + linux test_kernel $params +} + +#endif + +void run_test(struct parser_test *test) +{ + struct discover_boot_option *opt; + struct discover_context *ctx; + + test_read_conf_embedded(test, "/boot/grub/grub.cfg"); + + test_run_parser(test, "grub2"); + + ctx = test->ctx; + + check_boot_option_count(ctx, 1); + opt = get_boot_option(ctx, 0); + + check_name(opt, "Linux"); + /* The linux command, $params is expected to have been set when + * set_params was called in menuentry. + */ + check_args(opt, "abc 123"); +}