summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* discover: log cleanupJeremy Kerr2013-05-166-28/+26
| | | | | | | Remove some of the more noisy log messages, and add some information pertinent to device resolution events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add yaboot test from a ppc64 RH8 machineJeremy Kerr2013-05-163-2/+48
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add f18 grub config testJeremy Kerr2013-05-163-1/+191
| | | | | | Add a real-world config file from a f18 ppc64 machine. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add simple GRUB2 parser testJeremy Kerr2013-05-162-0/+31
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add simple kboot testJeremy Kerr2013-05-162-0/+27
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add yaboot test for external devicesJeremy Kerr2013-05-162-1/+38
| | | | | | | Add a yaboot test to add boot options for an external device, then hotplug that device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add simple yaboot testJeremy Kerr2013-05-162-2/+33
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add test device hotplug functionsJeremy Kerr2013-05-162-0/+37
| | | | | | | | Add a function, test_hotplug_device(), to simulate the addition of devices during tests. This should make it possible to observe boot options' resources changing from unresolved state to resolved. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add resource check helpersJeremy Kerr2013-05-162-0/+53
| | | | | | | Add check_resolved_local_resource and check_unresolved_resource to check the resources returned from parsers. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add check_name helperJeremy Kerr2013-05-162-0/+22
| | | | | | Simple function to check a boot_option's name. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add check_args helperJeremy Kerr2013-05-162-0/+28
| | | | | | Add a small helper to check boot option arguments. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add check_boot_option_count helper & get_boot_optionJeremy Kerr2013-05-162-0/+58
| | | | | | | Add a helper function to check the expected boot option counts, and print the boot option details if the check fails. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Error on invalid parser nameJeremy Kerr2013-05-161-0/+5
| | | | | | | We should error-out if we didn't find a valid parser, so it doesn't look like we found no boot options. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Allow raw config data in test .c filesJeremy Kerr2013-05-163-1/+38
| | | | | | | | Add a little post-processing script (extract-config.awk) to allow us to put the config data directly into the test .c files, without having to quote the C string. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Allow tests to provide pre-loaded config dataJeremy Kerr2013-05-162-0/+12
| | | | | | | Some tests may want to use an existing buffer as config data, so add test_read_config_data() to allow this. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test: Replace parser tests with empty frameworkJeremy Kerr2013-05-1630-782/+237
| | | | | | | | | | | | | | | | | This change is a major rework of the parser tests. Currently, the parser tests just run the parsers on each subdir of data/, but we don't actually check the results. Rather than just running parsers and expecting a certain fixed output, the new tests are arbitraty (short!) C programs. This allows us to set up the device configuration / discover context etc in whatever manner necessary, and check that the boot options that the parsers emit are correct. This change removes all of the old tests, and adds a new "null" test. Actual tests will be added in subsequent changes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Make device handler a little more testableJeremy Kerr2013-05-151-280/+307
| | | | | | | | | | | This change moves some of the device-handler code into an #ifdef-ed section, so we can easily drop the stuff that's not required for testing. Although the change is quite large, most of it is moving entire functions around. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: Add pb_url_to_stringJeremy Kerr2013-05-152-5/+9
| | | | | | Add a function to unparse a URL, to make comparisons in tests easy. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Allow devices with no device_pathJeremy Kerr2013-05-151-1/+4
| | | | | | | | Devices that have been added via the user path may not have a device path. In this case, don't segfault in device_match_path, and break out of mount_device early. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Always associate resources with a boot optionJeremy Kerr2013-05-154-15/+19
| | | | | | | | | | | We should always be tallocing resources to a boot option context; anything else (for example, the discover context) may have a different lifetime. In order to enforce this, we change the void *ctx argument to the context_create functions to a struct discover_boot_option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't access bytes before the start of empty stringsJeremy Kerr2013-05-151-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Always add a NUL byte to config dataJeremy Kerr2013-05-151-1/+3
| | | | | | | conf_get_pair will read one-byte past the end of the conf buffer, so always NUL-terminate. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Fix boot option stateJeremy Kerr2013-05-151-12/+13
| | | | | | We're only picking up every second boot option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: use devname (not devpath) for device IDsJeremy Kerr2013-05-151-1/+1
| | | | | | devnames are unique, and much shorter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add grub2/grub.cfg config fileJeremy Kerr2013-05-151-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils/Makefile: pb-console is dist_Jeremy Kerr2013-05-151-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/nc: Don't segfault if we can't open log_fileJeremy Kerr2013-05-091-0/+3
| | | | | | Fallback to logging to /dev/null. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/nc: Handle cui_opt_data with no boot option more gracefullyJeremy Kerr2013-05-091-0/+5
| | | | | | | | | | We can currently segfault petitboot by escaping from the option editor (before entering any details), then trying to boot the new, empty option. This change adds some sanity checks to prevent a segfault. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Simplify menu item namesJeremy Kerr2013-05-091-35/+2
| | | | | | Just use the item name, rather than including boot option details. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils: Add pb-console utilJeremy Kerr2013-05-092-0/+50
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-udhcpc: Look for more boot optionsJeremy Kerr2013-05-091-2/+82
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils/pb-udhcpc: Use command-line format of pb-eventJeremy Kerr2013-05-091-2/+5
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-event: move send code to a separate functionJeremy Kerr2013-05-091-30/+36
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils/pb-event: handle event data on command lineJeremy Kerr2013-05-091-24/+76
| | | | | | | It'd be nice to avoid using printf just for the \0 characters, so allow parsing events from the command line. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: handle boot_option->device_id entirely within handlerJeremy Kerr2013-05-093-3/+4
| | | | | | | No need for parsers to populate (or forget to populate, in the case of most parsers) opt->device_id, as we should do it on finalise. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Setup event params from udev propertiesJeremy Kerr2013-05-091-16/+17
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event: Add event_set_paramJeremy Kerr2013-05-092-2/+27
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Don't print properties of skipped devicesJeremy Kerr2013-05-091-2/+2
| | | | | | This cleans up the log output a little. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Rework config stateJeremy Kerr2013-05-081-13/+10
| | | | | | | Rather than creating boot options pre-emptively, in two paths, just do it once when we see the menuentry option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't invert option discovery orderJeremy Kerr2013-05-081-1/+1
| | | | | | | | Keep options in the order that we discovered them in; this makes testing a little easier, as the options appear in the list in the same order as the config file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't resend all options to all clientsJeremy Kerr2013-05-071-2/+1
| | | | | | | | | | Currently, when a new UI client connects, we send all boot options to all clients. This results in existing clients getting duplicate add events. Instead, we only want to send existing boot options to the new client. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event-parser: correctly populate boot option resourcesJeremy Kerr2013-05-071-13/+35
| | | | | | | The user event parser should be populating the discover_boot_option's resources, not the strings in struct boot_option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/resource.h: Add forward declarationsJeremy Kerr2013-05-071-0/+2
| | | | | | We need to define a few structs for the params of resource functions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Makefiles: remove -I$(includedir)Jeremy Kerr2013-05-078-8/+0
| | | | | | | | | | | Currently, we include the system include dir in some of our makefiles; this is causing build problems when cross-compiling, as the system include dir may not contain files for the host. The compiler should be searing in the proper system include dir, so just remove the redundant -I. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Remove -WinlineJeremy Kerr2013-05-071-1/+1
| | | | | | | | | | | | | | | I'm getting the following errors when compiling with --enable-werror: kboot-parser.c: In function 'kboot_process_pair': ./parser-conf.h:50:21: error: inlining failed in call to 'conf_get_pair_equal': call is unlikely and code size would grow [-Werror=inline] kboot-parser.c:65:7: error: called from here [-Werror=inline] Since this is a header function, the inline isn't there for optimisation reasons; the warning is just informing us of a code optimisation decision. Drop -Winline to allow -Werror builds. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/user-event: better event debugging outputJeremy Kerr2013-05-072-10/+22
| | | | | | | | | | | | | | | We don't currently handle conf events very well: user_event remove event: device: /net/eth0 name => (null) image => (null) args => (null) This change prints the event action properly, and prints all event params. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/kboot: Fix boot_option initialisationJeremy Kerr2013-05-061-0/+1
| | | | | | | We're not populating d_opt->option, so are returning invalid boot options from the kboot parser. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: fix no-scheme URL parsingJeremy Kerr2013-05-063-7/+17
| | | | | | | | | | | | | | | | | | | | | | | We were incorrectly dropping the first strlen("file://") characters from URLs with no scheme: --- test/urls/data/localpath.test 2013-05-02 17:26:48.826359036 +0800 +++ /tmp/tmp.gn4JsWLw5o 2013-05-02 17:26:50.262364613 +0800 @@ -2,6 +2,6 @@ scheme file host (null) port (null) -path /test/path/to/local/file -dir /test/path/to/local/ +path ath/to/local/file +dir ath/to/local/ file file This change fixes the issue by indicating "no scheme found" by a NULL return from pb_url_find_scheme, and hadling it appropriately. We add a testcase too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: log unresolved boot optionsJeremy Kerr2013-05-061-0/+3
| | | | | | | These are a bit of a special-case ("why isn't my boot option appearing?"), so add a log message. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: kexec harderJeremy Kerr2013-05-061-0/+15
| | | | | | | | `kexec -e` will just call shutdown, which we've already tried, so it's likely to fail. Add a further fallback to force a kexec with -e -f options. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud