summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
...
* lib/process: Add add_stderr flag to process moduleJeremy Kerr2014-01-143-0/+113
| | | | | | | | | | | | For some process execution functions, we'd like to capture stderr as well as stdout. Currently, we unconditionally redirect subprocess stderr to the petitboot log file. This change adds an add_stderr flag to struct process, which indicates to the process library that we want stderr as well as stdout. If this is specified, the subprocess' stderr is captured to stdout_buf. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add yaboot leftovers testJeremy Kerr2014-01-142-0/+36
| | | | | | | Add a test to ensure that boot option parameters don't leak into later options. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Clear globals_done when we see an image definitionJeremy Kerr2014-01-142-0/+31
| | | | | | | | | | Currently, we have a bug where a 'known_name' that appears before an image section will cause globals_done to be set, and we don't see any further global variables. This change sets globals_done only once we see an image section. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Use AC_GNU_SOURCEJeremy Kerr2013-12-181-2/+0
| | | | | | | Rather than #defining _GNU_SOURCE in our .c files, we can define this from config.h instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Add parent stdout testJeremy Kerr2013-12-182-0/+56
| | | | | | Looks like we missed adding a test source file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Fix assertion failure on empty yaboot filesJeremy Kerr2013-12-102-0/+13
| | | | | | | | | | yaboot configuration files with no option will cause an assertion failure (or segfault), as we unconditionally call yaboot_finish(). Check for the presence of an option in yaboot_finish() instead of asserting. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/device-handler: Ensure we free unresolved boot options on removeJeremy Kerr2013-12-024-1/+53
| | | | | | | | | | When we remove a device, some options may still be unresolved, and so won't be deallocated through freeing the device. This chagne explicitly removes & frees any currently-unresolved options for this device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Populate $prefix from config file locationJeremy Kerr2013-11-272-0/+30
| | | | | | | Rather than always using the default prefix, we should determine it from the location of the grub2 config file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser/grub2: Fix inconsistent conf/env pathsJeremy Kerr2013-11-272-2/+2
| | | | | | | | In an upcoming change, we'll populate $prefix (which is used to locate the environment file) based on the location of the config file, so these paths will need to be consistent. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add support for -s and -f commandsJeremy Kerr2013-11-272-0/+48
| | | | | | | Implement -s and -f checks for grub, and test with the standard GRUB2 saved_default config. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: populate sysinfo with block devicesJeremy Kerr2013-11-221-0/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use pxeconffile for udhcpc option nameJeremy Kerr2013-11-224-4/+4
| | | | | | | | | | | | The patch that went upstream for udhcpc's option 209 handling uses the option name 'pxeconffile' rather than 'conffile', and it was added as a non-default option: http://git.busybox.net/busybox/commit/?id=d3092c99ae90f This change uses the new name, and explicilty requests this option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Implement config messagesJeremy Kerr2013-11-131-0/+7
| | | | | | On client connect, send a PB_PROTOCOL_ACTION_CONFIG message. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: consolidate util macros in util/util.hJeremy Kerr2013-11-131-1/+1
| | | | | | | This change groups the offsetof, container_of and ARRAY_SIZE macros in a single header file util/util.h. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add local PXE testJeremy Kerr2013-11-072-1/+20
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add new test cases to pxe parserNeelesh Gupta2013-11-064-1/+121
| | | | | | | | | Adding new cases to the pxe parser code of having conffile file without complete URL and determining conffile names using mac and ip addresses passed from the udhcpc. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Update test cases as per new parser requesting conf filesNeelesh Gupta2013-11-0628-57/+125
| | | | | | | | | | Update the parser test code/cases as per new prototyping of parse() function which doesn't require buf and len to be passed from the caller, instead reading the configuration data either embedded or from file to a parser's known conffile. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to explicitly request configuration filesNeelesh Gupta2013-11-061-2/+1
| | | | | | | | | | | | | | | | | | | Add a new function parser_request_url() to read the data from configuration files present remotely. We deprecate iterate_parser_files() and download_config() functions along with the 'filenames' and 'method' members of the 'parser' structure so that individual parsers would now require to request the configuration files data from the parser code and doesn't necessarily export the list of configuration files. Add the support to handle incoming DHCP event, done by passing all the relevant environment variables of the udhcpc to the discover code. Also, update the pxe parser code to populate the list of configuration file names as per PXELINUX convention of fallback names using mac and ip addresses of the booting machine. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Allow an in-progress boot to be cancelledJeremy Kerr2013-10-151-2/+8
| | | | | | | | | Currently, once the boot() function is called, the boot process will ignore any cancellations. This change allows boot() to be cancelled, via boot_cancel(). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement save_env commandJeremy Kerr2013-10-042-0/+110
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add check_file_contentsJeremy Kerr2013-10-042-7/+82
| | | | | | | We want to test grub2's save_env command, which requires a new function to check the contents of a file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement load_envJeremy Kerr2013-10-012-0/+33
| | | | | | | Use the new parser_request_file API to access the GRUB environment block. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add device_{request,release}_writeJeremy Kerr2013-10-011-0/+30
| | | | | | | | Add a pair of functions to the parser API to allow write access to the underlying device. We'll use this in the GRUB2 parser to implement environment persistence. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add parser_request_fileJeremy Kerr2013-10-012-0/+51
| | | | | | Add a function to allow parsers to access files on a local device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add test_data member to struct discover_contextJeremy Kerr2013-10-011-0/+1
| | | | | | | | We have parsers passing discover_contexts around, which we want to hook into the test framework. Add a void * member, which the test code can use to reference the test. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Allow for already-mounted devicesJeremy Kerr2013-10-011-0/+1
| | | | | | | | | | | When we start the discover server, we may find that devices are already mounted. In this case, mount_device will fail, and we'll abort the parse. This change uses /proc/self/mounts to check if new devices are already mounted, and uses the existing mount point. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Clean up error-handling for grub2 parser & lexerJeremy Kerr2013-09-263-0/+28
| | | | | | | Rather than printf() & exit(), use the pb logging functions and abort the parse. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Enable logging to stdoutJeremy Kerr2013-09-261-0/+2
| | | | | | We may as well show the logs while testing. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/urls: Run URL tests under valgrindJeremy Kerr2013-09-263-3/+23
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Reimplement default optionsJeremy Kerr2013-09-254-0/+94
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add test-grub2-single-line-if testJeremy Kerr2013-09-242-0/+29
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Allow double-quotes in embedded configJeremy Kerr2013-09-241-0/+1
| | | | | | We need to escape any double-quotes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Allow checks for NULL boot_argsJeremy Kerr2013-09-242-1/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add variable expansion in Ubuntu conf file testJeremy Kerr2013-09-241-2/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Fix spacing in grub2-f18-ppc64 testJeremy Kerr2013-09-241-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Hook up flex/bison parser to discover serverJeremy Kerr2013-09-241-2/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: check for multiple default optionsJeremy Kerr2013-09-201-2/+11
| | | | | | | Update check_boot_option_count to check if a parser returned more than one boot option with is_default set. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: Implement default optionsJeremy Kerr2013-09-201-1/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Remove unnecessary event passingJeremy Kerr2013-09-1910-19/+50
| | | | | | | | | | | | | | | Currently, we pass "events" between the udev, user-event and device-handler layers. These events all get sent through device_handler_event, then de-multiplexed to an appropriate handler, depending on their source. Instead, just export relevant device_handler functions, and have the (old) event sources call these functions directly. This also means we can include a lot more of the device hander code in the parser tests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/log: Cleanup log APIJeremy Kerr2013-09-191-5/+0
| | | | | | | | | | Rather than exposing log internals (through always_flush and set_stream), do all logging init through pb_log_init(). If pb_log_init() hasn't been called, pb_log will drop messages. Also, add a pb_debug() function, specifically for debugging information. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: check for a valid boot option before addingJeremy Kerr2013-09-062-0/+20
| | | | | | | | | | If we didn't find any valid boot options in the pxe buffer, we'll call discover_context_add_boot_option with a NULL boot option. This change adds a check before we try to add the boot option, and a test to verify this situation. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: add 'partition' directive overriding test for yaboot conf fileNeelesh Gupta2013-08-302-0/+34
| | | | | | | | Check the overriding of 'partition' directive from yaboot conf file for 'petitboot', then verify the device name on which the resource resides Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test: add 'partition=directive' test for yaboot conf fileNeelesh Gupta2013-08-292-0/+34
| | | | | Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Implement process_init change in testcasesJeremy Kerr2013-08-296-6/+6
| | | | | | We need to provide the dry_run argument. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: add process testsJeremy Kerr2013-08-197-4/+407
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test: Add --enable-test-valgrindJeremy Kerr2013-08-191-0/+5
| | | | | | | Add an --enable-test-valgrind argument to configure, to run all tests under valgrind, configured to fail on leaked memory Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Use talloc in list testJeremy Kerr2013-08-191-1/+8
| | | | | | .. so we can free at exit Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: build with -DEBUGJeremy Kerr2013-08-191-3/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: implement default optionsJeremy Kerr2013-08-074-0/+47
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: fix device parsingJeremy Kerr2013-08-073-9/+82
| | | | | | | | | | | | | | | A couple of fixes for yaboot's device-handling code. Firstly, we need to use 'device=' rather than 'root=', as the latter is purely for ybin, to define where the yaboot binary goes. Secondly, we need to respect global and option-specific device= parameters. To do this, we keep all boot_image and initrd strings in the state, and create the actual resources in yaboot_finish. Add a test for all override cases, and fix the incorrect boot= parsing in the rh8 test. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud