summaryrefslogtreecommitdiffstats
path: root/test/parser
Commit message (Collapse)AuthorAgeFilesLines
* test/parser: Add rhel8 test data to check_DATAHEADmasterJeremy Kerr2020-01-251-0/+2
| | | | | | We want these included in the distribtion tarball too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add RHEL8 grub config testJeremy Kerr2019-11-293-0/+212
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add test for recent RHCOS grub2 configJeremy Kerr2019-11-293-0/+233
| | | | | | | Add a test for a RHCOS grub2 boot config, using the ignition firstboot facility. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: implement 'source' commandJeremy Kerr2019-11-295-0/+205
| | | | | | | | | | This change add support for the grub2 'source' command, executing a referenced script in the current parse context. We impose a limit of 10 (concurrent) source commands, to prevent infinite recursion. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow (device)/path references in general script usageJeremy Kerr2019-11-292-0/+57
| | | | | | | | | | | Currently, we have support for grub2 (device)/path syntax for boot resources. This change allows this syntax for general paths in grub2 scripts (for example, -f tests). This involves exposing grub2_lookup_device, to allow the script execution code to resolve pathnames. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: add support for grub2-style path specifiers in resourcesJeremy Kerr2019-11-292-0/+89
| | | | | | | | | | | | This change incorporates the grub2-style (device)/path specifiers in the grub2 parser's resource code. This allows the boot option paths to use device-specific references. Device names are looked-up using the UUID and kernel IDs, but with the lookup logic specific to a new function (grub2_lookup_device), so that can be extended in a future change. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add support for UUID and label for 'search' commandJeremy Kerr2019-11-293-0/+104
| | | | | | | | This change adds support for searching by UUID and filesystem label. We still fall back to passthrough if the UUID is not found, but we now resolve to device ID strings. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: test for (ignored) --no-floppy argumentJeremy Kerr2019-11-291-2/+4
| | | | | | | --no-floppy is used almost everywhere, so add it to the tests. The code will already ignore unknown arguments, but ensure that this works OK. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Use getopt for `search` argument parsingJeremy Kerr2019-11-292-0/+34
| | | | | | | | | | | | The search command will be extended to add the full set of grub2-style arguments, so switch to using getopt, rather than manual parsing. This means we now support `--set=foo` and `--set foo` style arguments, both of which appear in the docs and common grub configs. Also, add a small test for the search argument handling. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow to separate the --id argument using a space charJavier Martinez Canillas2019-06-213-0/+70
| | | | | | | | | | | | The GRUB menuentry command allows to separate the arguments for options using either a '=' or a ' '. The latter is the convention used when the menu entries are defined in the GRUB config file, but this is currently not supported by Petitboot. Add tests to cover both using '--id=foo' and '--id foo' as options. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub2: Allow using title for default even if id was definedJavier Martinez Canillas2019-06-211-2/+2
| | | | | | | | | | | | | | | A default menu entry can be chosen using any of the following attributes: index, title or id (if the entry was defined with the --id option). But Petitboot doesn't honor this correctly and only compares the default with the menu entry title if the entry doesn't have an id defined. This is wrong since an index or title can be used even if an id was defined. This issue wasn't covered by the test that sets a default using a title because the menu entries didn't have an id defined. Add an id to them. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Recognise and open LUKS encrypted partitionsSamuel Mendoza-Jonas2019-03-261-0/+6
| | | | | | | | | | | | | | Handle devices encrypted with LUKS and call cryptsetup to open them if a client sends the associated password. If a new device has the "crypto_LUKS" filesystem type it is marked as a LUKS device and sent to clients but further discovery is not performed. Once a client sends the device's password cryptsetup is called to open it. The opened device will appear separately, so the source device is "forgotten" at this point and then the newly opened device is treated as a normal partition. On destruction the device is "closed" with cryptsetup so that discovery can start from the beginning. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* lib/url: Include port in pb_url_to_string()v1.10.1Samuel Mendoza-Jonas2019-02-012-0/+41
| | | | | | | | And include a pxe-parser test which uses a port in the path prefix to exercise this. This could cause PXE discovery failures if parameters such as pathprefix included a port in the URL. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Reimplement native-parser as a Bison parserSamuel Mendoza-Jonas2018-11-166-3/+150
| | | | | | | | | | | | | | | | | | | Occasionally you look at some code and realise that a) this never gets built, and b) even if it did it would never compile. Today's example is native-parser.c which we must have just assumed worked for quite a while. The native parser has bitrotted entirely and needs to be brought up to date. While we're here, lets take the chance to implement a proper grammar for it. This helps us reason more effectively about the parser, lets us extend it easily in the future, and.. I wanted to write a Bison parser too. This implements most of the old functionality, but drops off some smaller details like settings icons which needs some separate attention to bring up to date. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/kboot-parser: Recognise 'default' parameterv1.9.1Samuel Mendoza-Jonas2018-08-282-0/+31
| | | | | | | | | | | | | The kboot parser doesn't set a default option. Change it so that if we see the 'default' parameter we match against this value when deciding if an option should be set as default. For example: default=linux linux='/vmlinux initrd=/initrd arg1=value1 arg2' Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* test/parser: Add parser_is_uniqueGeoff Levand2018-08-071-0/+12
| | | | | Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/pxe-parser: Parse simple iPXE scriptsSamuel Mendoza-Jonas2018-07-104-0/+122
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: implement a periodic requery for network devicesJeremy Kerr2018-07-091-0/+7
| | | | | | | | | | | | | | | | | | If we boot a machine before external (network) dependencies are properly configured, it will have tried once to download configuration, and possibly failed due to that configuration not being present. This change introduces a periodic requery of network resources. After a timeout, petitboot will either re-acquire its DHCP lease (causing any downloads to be re-processed, possibly with different parameters from the new lease), or re-download a statically defined URL. This timeout defaults to five minutes (similar to pxelinux), and is configurable by DHCP option 211, "reboot time". Signed-off-by: Jeremy Kerr <jk@ozlabs.org> [added test stub] Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub: Improve BLS grub environment variables expansionJavier Martinez Canillas2018-06-182-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The fields from a BootLoaderSpec file can contain environment variables, in GRUB 2 these are show verbatim and are evaluated later when an entry is selected. But on Petitboot these have to be expanded before creating the GRUB 2 resources and show in the UI the values after the evaluation. The current blscfg handler had a very limited support for variables, it only had support for the options field and also didn't take into account that variables could be mixed with literal values. So for example the following fields were not expanded correctly: linux $bootprefix/vmlinuz options $kernelopts foo=bar options foo=bar $kernelopts options $kernelopts $debugopts Also change some of the tests to cover mixing variables and literals. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub: Use different paths to search for the BLS directoryJavier Martinez Canillas2018-06-186-12/+24
| | | | | | | | | | | | | | | | Currenlty the BLS fragments are only searched in the /loader/entries directory, but this assumes that there is a boot partition mounted in /boot. This may not always be the case, /boot may not be a mount point and just a directory inside the root partition. To cover this case, Petitboot tries to find a GRUB 2 config file in different paths. So let's do the same for the BLS files directory. Also change some of the unit tests to use /boot/loader/entries as a BLS directory instead of /loader/entries. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* test/parser: Make parser_scandir() ignore files with path len less than dirJavier Martinez Canillas2018-06-181-0/+3
| | | | | | | | | | | | | Both the test files and directories added into the test harness are stored into the same file list. So the parser_scandir() stub compares the absolute file path of the files and the directory to scan, to know if a file belongs to the directory. Files whose absolute file path length isn't bigger than the directory to scan should just be ignored, since it means they can't be from that dir. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/syslinux-parser: consistent cmdline arg processingBrett Grandbois2018-06-123-6/+17
| | | | | | | | | | | In signed-boot environments consistent handling of kernel commandline options is essential as they must be pre-signed. In the syslinux parser ensure that in the absence of a global APPEND they are processed exactly as found and not with the leading space that the current APPEND processing has as a shortcut. Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub: Allow to set a default index for BLS entriesJavier Martinez Canillas2018-04-182-0/+46
| | | | | | | | | | | | When the BLS support was added, the conclusion was that default indexes didn't apply for BLS snippets. But for GRUB 2 the indexes refers to the boot menu entries in memory, regardless of how these were generated. Since in GRUB 2 is valid to set a default index even for menu entries generated from BLS fragments, allow this to also be done in Petitboot. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub: Add blscfg command support to parse BootLoaderSpec filesJavier Martinez Canillas2018-03-237-0/+236
| | | | | | | | | | | | | | | | | The BootLoaderSpec (BLS) defines a file format for boot configurations, so bootloaders can parse these files and create their boot menu entries by using the information provided by them [0]. This allow to configure the boot items as drop-in files in a directory instead of having to parse and modify a bootloader configuration file. The GRUB 2 bootloader provides a blscfg command that parses these files and creates menu entries using this information. Add support for it. [0]: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* test/parser: Fixed uninitialized variable warningJoel Stanley2018-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Clang has a problem with list_for_each_entry: test/parser/utils.c:290:36: error: variable 'file' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized] list_for_each_entry(&test->files, f, list) { ^ ./lib/list/list.h:30:3: note: expanded from macro 'list_for_each_entry' _pos; _pos = list_next_entry(_list, _pos, _member)) ^~~~ test/parser/utils.c:300:7: note: uninitialized use occurs here if (!file) { ^~~~ test/parser/utils.c:290:36: note: remove the condition if it is always true list_for_each_entry(&test->files, f, list) { ^ ./lib/list/list.h:30:3: note: expanded from macro 'list_for_each_entry' _pos; _pos = list_next_entry(_list, _pos, _member)) ^ test/parser/utils.c:288:28: note: initialize the variable 'file' to silence this warning struct test_file *f, *file; ^ = NULL Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* syslinux: add syslinux parser supportBrett Grandbois2018-02-098-2/+216
| | | | | Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* test/parser: test no whitespace on grub menuentryBrett Grandbois2018-02-082-0/+39
| | | | | Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/pxe-parser: Fix relative parsing for manual config filesSamuel Mendoza-Jonas2017-12-122-0/+43
| | | | | | | | | | | | Manually specified config files are asynchronously downloaded by device_handler_process_url() before being parsed. This overwrites the 'pxeconffile' parameter, causing the parser to create relative paths relative to the downloaded file's path, not the original remote path. Work around this by setting 'pxeconffile-local' instead to differentiate between the original config file's location and the local copy. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Handle and track plugin_optionsSamuel Mendoza-Jonas2017-08-153-0/+20
| | | | | | | | | | Track plugin_options in the device_handler. Plugins can be added with device_handler_add_plugin_option() and accessed via device_handler_get_plugin(). Extend discover_server to support the new 'add' and 'remove' pb-protocol actions and advertise new plugins to connecting clients. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/paths: Add network jobs to queueSamuel Mendoza-Jonas2017-07-111-0/+8
| | | | | | | | | Load tasks that start before the network is available will fail. Rather than just fail these tasks, add them to a queue that is processed once the network is ready. This helps users who try to request files early in setup, as well as very early running load tasks. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Record IP address of network interfacesSamuel Mendoza-Jonas2016-12-201-0/+8
| | | | | | | | If an interface has a valid IP address (either via DHCP or static config) store it in the interface_info struct so it can be referenced later. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/paths: Add stdout callback parameter for load_url_async()Samuel Mendoza-Jonas2016-12-201-1/+6
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Add reference to url in load_url_resultJeremy Kerr2016-12-201-0/+1
| | | | | | | We may want to access the loaded URL in a async handler. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: add handler reference to struct discover_contextJeremy Kerr2016-12-201-0/+1
| | | | | | | | | | | | | Since the device handler provides the status message functions, we need a pointer to it for device discovery (which we use a struct discover_context for). This change adds a 'handler' member to struct discover_context, to allow status reporting. Since we now have a handler, there's no need for the network pointer, so provide an accessor function instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* types: shorten boot_status definitionsJeremy Kerr2016-12-201-2/+2
| | | | | | | | | | | struct boot_status is a bit misnamed; we report status on things that aren't just the boot status (eg, discovery). This change refactors struct boot_status into just struct status. We give the type enum a name, and shorten the enum values to suit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Pass UUID to discover_device_create()Samuel Mendoza-Jonas2016-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently discover_device_create() will search for existing discover devices by id to determine if a new device is required. However it is possible under some circumstances for distinct devices to have the same name. This is especially troublesome if the following network events are seen in network_handle_nlmsg(): - New interface, 'foo' with uuid x:x:x:x:x:x -> new discover device created with dev->device->id = 'foo' dev->uuid = x:x:x:x:x:x - New interface, 'foo' with uuid y:y:y:y:y:y -> existing device 'foo' found dev->uuid = y:y:y:y:y:y This can occur if an interface rename event arrives *after* an old name is reused, where temporarily Petitboot will see two distinct network interfaces with the same name. Now the two interfaces point to the same discover device, which can quickly result in a segfault if a 'remove' event occurs for one of the interfaces and the discover device is freed. To generally avoid this a 'uuid' parameter is added to discover_device_create(), which if present allows existing devices to be looked up by UUID rather than just their name. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Update tests to support changes to pxe_parserSamuel Mendoza-Jonas2016-06-281-0/+57
| | | | | | | | | | | Substitute load_url_async() when running tests to support direct callers of load_url_async() who will expect to read a file in a callback. Stub out device_handler_discover_context_commit() since it will remove discover_options from the given discover_context, but the tests will check the discover_context to count boot_options. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* pb-discover: add dtb support for PXE configOliver O'Halloran2016-05-241-0/+3
| | | | | | | | | | | | | | Currently there is no way to manually specify a DTB file when with a PXE network boot configuration file. This makes it difficult when you need to work with or emulate a special snowflake machines with special snowflake hardware. Some ARM systems provide this feature with the "fdt" option so this patch adds support for using the ftd or dtb configuration options to the PXE config parser. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Allow evaluation of arbitrarily-positioned arguments in GRUB2 parserAlan Dunn2016-04-261-3/+3
| | | | | | | | | | | | | | | GRUB2 allows essentially arbitrary numbers of positional arguments, so ensure that they can be evaluated within scripts. GRUB2 also appears to support arbitrary numbers of leading 0's in positional parameters (i.e., $01 should evalute the same as $1), but this doesn't seem like a particularly important case to support. Tested: Modified test-grub2-pos-param to cover higher-numbered positional arguments. Signed-off-by: Alan Dunn <amdunn@google.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub2: Fix handling of positional parametersAlan Dunn2016-03-152-0/+36
| | | | | | | | | | | | | | Positional parameters are set in the environment with '$' prepended to the name. This causes lookups to fail because parameter lookups don't include the '$'. TESTED: Added a test that covers positional parameters in GRUB2 parser. Build succeeds, tests pass. Bootstrapped-by: Nancy Yuen <yuenn@google.com> Signed-off-by: Alan Dunn <amdunn@google.com> Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* Change parser interface to allow statAlan Dunn2016-03-154-6/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the GRUB2 parser incorrectly reports "[ -f <path> ]" as false if the size of the file is above 1 MB. This patch changes the parser interface to allow stating files (with parser_stat_file). Then in the implementation of "[ -f <path> ]", we can use parser_stat_file instead of parser_request_file which has the size limitation. I eliminate parser_check_dir in lieu of this new interface, which has the side effect of making "[ -d <path> ]" work (the error code for stat was not checked correctly before). I add a basic test for the test file operations -f, -s, and -d (to show that my changes to test file operations do not break them) and minorly modify the test framework to ensure it has enough fidelity to cause the expected results. Unfortunately the test wouldn't have caught the issue with -d, since the test framework stubs out the parser interface itself. Nor can the test framework catch the initial problem with -f because the imposed limit is (transitively) in function parser_request_file. Note that -f and -d follow symlinks despite the fact that GRUB does not (see http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00142.html discussing GRUB's behavior). This is not a change to Petitboot's behavior though. Tested: The test test-grub2-test-file-ops passes. I booted Petitboot against a GRUB snippet: status=success if [ ! -f /large_file -a $status = success ] then status=fail_large_file fi if [ ! -d /a_directory -a $status = success ] then status=fail_dir fi menuentry $status { linux /vmlinux } (after making /large_file a file of size > 1 MiB and /a_directory a directory) and the menuentry had title "success", as desired. Signed-off-by: Alan Dunn <amdunn@google.com> Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* In GRUB2 parser save_env, treat unset variable value as emptyAlan Dunn2016-03-151-0/+6
| | | | | | | | | | | | | | It seems better to treat unset variable values as empty rather than crashing in save_env. While GRUB's behavior is actually to delete the variable from the environment block, it seems useful to at least not crash while later on someone can do further work to improve GRUB compatibility if desired. Tested: Modified test-grub2-save-env to cover this case. Signed-off-by: Alan Dunn <amdunn@google.com> Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub: Fix handling of empty stringsSam Mendoza-Jonas2016-02-091-1/+4
| | | | | | | | | | | If "" or '' are used in a statement to omit a word, we must still return a TOKEN_WORD for an empty string. In particular this fixes an issue where Petitboot would fail to parse the grub.cfg included in the Debian 8.2 install image, which includes a menuentry statement with an empty name. Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub2: Fix behavior of save_env -fAlan Dunn2016-02-082-0/+38
| | | | | | | | | | | | | | | Currently, "save_env -f" in the GRUB2 parser only works with three arguments, which means only commands of the form "save_env -f <path>" that save *no* environment variables are allowed. Allow "save_env -f <path> [<var>]*", making "save_env -f" useful. Tested: Unit test test-grub2-save-env-dash-f tests this change, and the remaining unit tests still pass. Signed-off-by: Alan Dunn <amdunn@google.com> Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* discover/grub2: Allow unset and invalid defaultsJeremy Kerr2014-12-113-0/+53
| | | | | | | | | | | | | | If the default environment variable is unset or invalid (i.e., references a non-existent boot option), then GRUB2 will fallback to the first boot option present. This is preventing petitboot from autobooting where no default is explicitly set, or is stale. This change adds this fallback behaviour to petitboot. Because we don't know if the first option will be a default at parse time (as no other options matched the default env var), we need to keep options in a list, and register them with the discover server once the parse is complete. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: Format IPAPPEND mac addresses correctlySamuel Mendoza-Jonas2014-12-035-3/+63
| | | | | | | | | | | | | | | | | | | | | The SYSAPPEND/IPAPPEND option 2 in PXE configs requires the MAC address of the booting interface to be appended to the boot options. Previously we formatted this as "BOOTIF=01:02:03:04:05:06", but syslinux/pxelinux implementation use this format: "BOOTIF=01-01-02-03-04-05-06", where the leading '01' represents the hardware type. The relevant part of the pxelinux doc is at: http://www.syslinux.org/wiki/index.php/SYSLINUX#SYSAPPEND_bitmask Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add SLES btrfs snapshot stanzaJeremy Kerr2014-12-012-0/+28
| | | | | | | This has caused problems with the old delimiter code, add a test to ensure we don't regress. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: improve handling of word & delimiter tokensJeremy Kerr2014-12-014-0/+99
| | | | | | | | | | | | | | | | | | | | | | | Currently, the delimiter token handling is a little fragile: we try to ignore non-inter-word delimiters in the lexer with a selective set of regexes on the possible delimiter characters. This means we don't need to handle potential delimiters in every grammar rule, but there are other situations (not regex-able) where we may see delimters, and this will cause a parse error. Instead of relying on the regex behaviour, we have an 'inter_word' flag, which is set when we see the first word token, and cleared when we see an end-of-line token. We only emit TOKEN_DELIM when this flag is set. This means that we only get the delim tokens when they're required - when we're looking for word separators (becuase WORD DELIM WORD is distinct from WORD WORD - eg "linux /vmlinux" and "x$var"). We add a few new tests for the "menuentry" and "if" syntax, with different delimiter configurations. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add dependency on libpbcore.laJeremy Kerr2014-12-011-1/+1
| | | | | | | | | | | | | | Currently, build only a test object will fail: [jk@pablo obj]$ make ./test/parser/test-grub2-single CCLD test/parser/test-grub2-single libtool: link: cannot find the library `lib/libpbcore.la' or unhandled argument `lib/libpbcore.la' We're adding this to the link argument, but not as a dependency. This change adds the dependency. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Implement PXE SYSAPPEND syntaxJeremy Kerr2014-08-252-0/+36
| | | | | | | This change implements SYSAPPEND/IPAPPEND 2, to add a BOOTIF argument to the kernel command line. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud