summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test/parser: Add pxe testsJeremy Kerr2013-07-233-1/+72
| | | | | | | Add a couple of tests to verify the pxe parser, particularly the different styles of initrd handling. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add check_resolved_url_resourceJeremy Kerr2013-07-232-0/+28
| | | | | | Add a check for external URL resources. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add test_set_conf_source()Jeremy Kerr2013-07-042-0/+7
| | | | | | | For non-local parsers (ie, PXE), we need to have the conf_url set. This change adds a function to provide the originating URL. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix automake warningsGeoff Levand2013-06-301-5/+4
| | | | | | | | | | | | | Change the Makfile.am relocatable output files from automake _LIBRARIES to automake _PROGRAMS. Also, change the output file name extension from .o to .ro to better show these are relocatable files. Fixes automake warnings like these: discover/Makefile.am: `libparser.o' is not a standard library name discover/Makefile.am: did you mean `libparser.a'? Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/parser: Cleanup Makefile.amGeoff Levand2013-06-301-30/+34
| | | | | | | General cleanup of Makefile.am. This cleanup should retain the same makefile behavior. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: implement default bootingJeremy Kerr2013-06-241-1/+1
| | | | | | | When we see a boot option with is_default set, store it in the handler and register a timeout waiter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* autotools: Fix make maintainer-cleanGeoff Levand2013-05-292-0/+4
| | | | | | Fixes to make maintainer-clean work properly. Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/parser: Remove gawk specificsGeoff Levand2013-05-292-2/+2
| | | | | | | Remove the GNU awk specifics to allow the use of a standard awk program. Fixes build errors on older distros. Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/parser: cleanup parser allocations on exitJeremy Kerr2013-05-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | We should talloc_free the parser list once we're done, enabling valgrind's leak check. Before: [jk@pablo parser]$ valgrind ./test-null ... ==9330== HEAP SUMMARY: ==9330== in use at exit: 288 bytes in 3 blocks ==9330== total heap usage: 11 allocs, 8 frees, 1,177 bytes allocated After: [jk@pablo parser]$ valgrind ./test-null ... ==9940== HEAP SUMMARY: ==9940== in use at exit: 0 bytes in 0 blocks ==9940== total heap usage: 11 allocs, 11 frees, 1,177 bytes allocated ==9940== ==9940== All heap blocks were freed -- no leaks are possible Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add check_not_present_resourceGeoff Levand2013-05-184-0/+23
| | | | | | | | | | | Add a new routine check_not_present_resource() to check that a resource is not present. This is typically used to check that an initrd entry has not been found. Also add any needed checks for no initrd to the existing tests. Signed-off-by: Geoff Levand <geoff@infradead.org>
* parser: Use list to hold parsersGeoff Levand2013-05-171-18/+16
| | | | | | | Now that we dynamically add parsers, we can use a list to hold them. Also simplifies the test_run_parser() routine. Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/parser: Add ubuntu grub testsGeoff Levand2013-05-173-0/+318
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/parser: Better message outputGeoff Levand2013-05-171-6/+7
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/parser: Add grub2 multiple resolution testJeremy Kerr2013-05-162-0/+42
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: handle search commands to specify root filesystemsJeremy Kerr2013-05-161-4/+23
| | | | | | Add a resource type for grub, allowing us to parse search parameters. 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>
* Makefiles: remove -I$(includedir)Jeremy Kerr2013-05-073-3/+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>
* lib/url: fix no-scheme URL parsingJeremy Kerr2013-05-062-1/+9
| | | | | | | | | | | | | | | | | | | | | | | 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>
* test/url: Add uncommitted data filesJeremy Kerr2013-05-063-0/+21
| | | | | | | Add a couple of data files for test that'd I'd ommitted from an earlier commit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Add empty list testJeremy Kerr2013-05-031-1/+17
| | | | | | | Check that the list iterators work on empty lists too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add configuration methodsJeremy Kerr2013-04-291-1/+1
| | | | | | | | | | | | We'd like to be able to download petitboot configurations from other sources (not just local files), but we'll need some way to indicate to the parsers that a chunk of config data is from a specific source. This change adds "configuration methods". At present, we have only one: CONF_METHOD_LOCAL_FILE. For any incoming configuration data, we only run parsers that have registered themselves with that configuration method. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: dynamically register parsersJeremy Kerr2013-04-291-1/+1
| | | | | | | | | | | | | | | Currently, we require all parsers to be defined in an array in parsers.c. This change removes this requirement, by introducting a register_parser() macro, which adds a constructor to register the parser with the core parser infrastructure. Because each parser no longer resolves an undefined symbol, we need to use a `ld -r` object for libparser, instead of using libtool, which creates a .a (and hence has no parsers included). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to emit resources rather than filenamesJeremy Kerr2013-04-291-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | This change switches the parsers over to populate the resources in discover_boot_option, rather than the string parameters in boot_option. To do this, we need a few things: * Add struct resources to discover_boot_option for the boot_image, initrd and icon data. * Have the parsers populate the resources, rather than the strings. Currently, parsers can all use the devpath resource type. * Add a resolve_resource callback to parsers; this is how the device handler will attempt to resolve resources. * Change load_file to load_url, as we should be only accessing (resolved) resources by URLs. This then allows us to remove the mount map, and associated lookup code, as well as the UUID and label links to devices. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Introduce a container type for boot optionsJeremy Kerr2013-04-291-8/+23
| | | | | | | | | This change introduces a new type, struct discover_boot_option. Like struct discover_device adds discover-specific data to struct device, struct discover_boot_option allows the discover server to store more than just the boot option strings for a boot option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: Add pb_join_urlJeremy Kerr2013-04-292-4/+15
| | | | | | Add a a function to join a string to a base URL Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Hook into `make check`Jeremy Kerr2013-04-292-2/+3
| | | | | | | This change hooks the new list tests into 'make check'. To do this, we need to fix the return code of the list-test program. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test: Rename test/list to test/libGeoff Levand2013-04-283-1/+1
| | | | | | | Having a test/list directory is a little too specific, so rename the test/list directory to test/lib as a place for any lib tests. Signed-off-by: Geoff Levand <geoff@infradead.org>
* test: Add list testGeoff Levand2013-04-233-1/+102
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Separate temporary and permanent device dataJeremy Kerr2013-04-161-5/+12
| | | | | | | | | | | At present, we keep both permanent (eg links/n_links) and temporary (event) data in struct discover_context. This change makes discover_context a temporary structure, just used during actual device discovery. Once discovery is complete, the permanent data (discover_device) is "committed" to the device handler. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: Move URL-handling code to libJeremy Kerr2013-04-152-5/+2
| | | | | | | We'll need to use the URL handling code in the server, so move it to the lib/ directory. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/urls: Fix distcheck breakagesJeremy Kerr2013-04-101-0/+4
| | | | | | | | We need a couple of extra automake variables to get `make distcheck` working. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/types: Create common file for type definitionsJeremy Kerr2013-04-101-1/+1
| | | | | | | | | | | | The device and boot_option types are defined in pb-protocol.h, but aren't really specific to the procotol. This means a lot of non-messaging-related files are #including the protocol definitions unnecessarily. This change separates the types out into lib/types/types.h. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/url: Add http-simple.testJeremy Kerr2013-03-061-0/+7
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* test: Add URL parser test infrastructureJeremy Kerr2013-03-065-1/+122
| | | | | | | | | | | | This change adds some simple testing infrastrcture to the URL parser. We use a small C binary (parse-url) to run the url parser on its argument, and compare the output with an expected datafile. An initial test is included, to check the behaviour of URLs with multiple slashes between host and pathname. This test currently fails. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add missing EXTRA_DIST filesGeoff Levand2012-03-292-1/+3
|
* Add grub.cfg from opensuse installGeoff Levand2012-03-262-0/+36
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
OpenPOWER on IntegriCloud