-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for our load options parsing. #390
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64ae119
to
8d0c063
Compare
8d0c063
to
2048005
Compare
Signed-off-by: Peter Jones <pjones@redhat.com>
pause() is a posix function, and having it named the same as this makes it hard to include the asm.h header in some test cases. Signed-off-by: Peter Jones <pjones@redhat.com>
…pes. Signed-off-by: Peter Jones <pjones@redhat.com>
In some test cases, it's useful to be able to call some of the very common stuff in gnu-efi's efilib.h (i.e. CompareGuid()), but including that header itself is too big for me to tackle right now. This patch adds a few more decls to test.h. Signed-off-by: Peter Jones <pjones@redhat.com>
test.c duplicates a couple of objects (StrnCmp, StrCmp) that are in libefi.a, as well as SHIM_LOCK_GUID from lib/guid.o. While it's nice to have these at some places, we need to disable them if we're actually linking a test case against either of those. This patch adds HAVE_foo guards around those objects. Signed-off-by: Peter Jones <pjones@redhat.com>
This allows us to use library functions from libefi.a in our test programs. Signed-off-by: Peter Jones <pjones@redhat.com>
In some test cases, it may be useful to call libefi.a functions, such as the device path parsing functions, which allocate pages via BS->AllocatePool() or BS->AllocatePages. This patch ads a simple mock implementation of those functions, as well as the EFI_SYSTEM_TABLE, EFI_BOOT_SERVICES, and EFI_RUNTIME_SERVICES variables *ST, *BS, and *RT (respectively), and initializes them before the test cases run. Signed-off-by: Peter Jones <pjones@redhat.com>
This test helper was conspicuously missing, so this patch just adds it at the obvious place. Signed-off-by: Peter Jones <pjones@redhat.com>
Some tests have some complex flows, and it's useful to be able to see the call path when there's a failure. This patch adds a very simple traceback printer, along with changing the test build arguments to include more debug information. The result you get from this traceback printer just gives you a function name and the index into its .txt content, so to use it for more than "which function calls which", you'll need to use eu-addr2line with the output. Signed-off-by: Peter Jones <pjones@redhat.com>
This moves set_second_stage() and some of the helper functions it uses out of shim.c, so that it's easier to write test cases for. Signed-off-by: Peter Jones <pjones@redhat.com>
This adds tests for all the cases we've documented in the set_second_stage() comments. Each test checks that all of second_stage, loader_str, and loader_str_size are set correctly. Note that this adds a dependency on libefivar to build device paths to test against. Signed-off-by: Peter Jones <pjones@redhat.com>
2048005
to
d70c12b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patchset moves set_second_stage() and its helpers out of shim.c, and adds test-load-options.c, which attempts to comprehensively test the output from the function, including its intended side effects.
This patchset requires that #379 is merged first.