summaryrefslogtreecommitdiff
path: root/lib/efi_selftest
AgeCommit message (Collapse)Author
2017-10-13efi_selftest: correctly check return valuesHeinrich Schuchardt
When cancelling the timer we should check the return value provided by the set_timer service. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: error handling in SNP testHeinrich Schuchardt
Avoid NULL pointer dereference after setup failed due to a missing network. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: avoid dereferencing NULL in tpl testHeinrich Schuchardt
The task priority levels test uses two events one passes the notification counter as context. The other passes NULL. Both use the same notification function. So we need to check for NULL here. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: efi_st_memcmp return difference of bytesHeinrich Schuchardt
If the memory regions are different efi_st_memcmp currently returns the difference of the addresses. Insted the difference of the first differing byte pair should be returned. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: supply EFI network testHeinrich Schuchardt
This patch provides an EFI application to check the correct function of the Simple Network Protocol implementation. It sends a DHCP request and analyzes the DHCP offer. Different error conditions including a 10s timeout are checked. A successful execution will look like this: => bootefi nettest Scanning disk ide.blk#0... Found 1 disks WARNING: Invalid device tree, expect boot to fail Network test DHCP Discover DHCP reply received from 192.168.76.2 (52:55:c0:a8:4c:02) as broadcast message. OK. The test was completed successfully. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: allow printing MAC addressesHeinrich Schuchardt
Add %pm as format string to print a MAC address. This is helpful when analyzing network problems. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_loader: wrong type in wait_for_eventHeinrich Schuchardt
The UEFI spec defines parameter index of WaitForEvent as UINTN*. So we should use size_t here. I deliberately do not use UINTN because I hold a following patch that will eliminate UINTN because uppercase types to not match the U-Boot coding style. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: make tests easier to readHeinrich Schuchardt
Rename counter to more illustrative names. Update notification function description. Simplify notification function. Add comment for arbitrary non-zero value. Document @return. Use constants for return values of setup, execute, teardown. Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-09efi_selftest: use efi_st_error for all error messagesHeinrich Schuchardt
All error messages in the selftests should use efi_st_error. efi_st_error will print the file name and line number of the error. Splitting message texts due to lines being over 80 characters is avoided. This resolves the issue reported by Simon Glass in https://lists.denx.de/pipermail/u-boot/2017-September/307387.html Reported-by: Simon Glass <sjg@chromium.org> Fixes: 623b3a579765 efi_selftest: provide an EFI selftest application Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-18efi_selftest: check notification of ExitBootServicesHeinrich Schuchardt
Check that the notification function of an EVT_SIGNAL_EXIT_BOOT_SERVICES event is called exactly once. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-18efi_selftest: test task priority levelsHeinrich Schuchardt
Run a 10 ms periodic timer and check that it is called 10 times while waiting for 100 ms single shot timer. Raise the TPL level to the level of the 10 ms timer and observe that the notification function is not called again. Lower the TPL level and check that the queued notification function is called. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-18efi_selftest: provide unit test for event servicesHeinrich Schuchardt
This unit test uses timer events to check the implementation of the following boottime services: CreateEvent, CloseEvent, WaitForEvent, CheckEvent, SetTimer Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-18efi_selftest: provide an EFI selftest applicationHeinrich Schuchardt
A testing framework for the EFI API is provided. It can be executed with the 'bootefi selftest' command. It is coded in a way that at a later stage we may turn it into a standalone EFI application. The current build system does not allow this yet. All tests use a driver model and are run in three phases: setup, execute, teardown. A test may be setup and executed at boottime, it may be setup at boottime and executed at runtime, or it may be setup and executed at runtime. After executing all tests the system is reset. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>