diff options
| author | Peter Jones <pjones@redhat.com> | 2021-07-23 14:36:23 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-09-07 17:05:04 -0400 |
| commit | 397f820b8c091ca5e3023b6dbd2f26fb256a19f0 (patch) | |
| tree | 2c66ee7be8ed85edc6a4e9206127783ad8e35386 /include/mock-variables.h | |
| parent | 63a5ae1f7c9383f43e4431316eb0c77bcb079b98 (diff) | |
| download | efi-boot-shim-397f820b8c091ca5e3023b6dbd2f26fb256a19f0.tar.gz efi-boot-shim-397f820b8c091ca5e3023b6dbd2f26fb256a19f0.zip | |
tests: Add a unit test for mok mirroring
Test that our mok mirroring doesn't ever try to delete any variable that
it has previously created, and that it properly mirrors at least
MokList, MokListX, and SbatLevel, at least when variables actually work.
These tests will fail (rather a lot) without 7f64fd6da9458b73c4.
Currently valgrind shows a memory leak in this code which is not
introduced in this patch series. Since all of our memory is freed on
Exit() or when kernel does ExitBootServices(), this doesn't have any
significant repercussions.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'include/mock-variables.h')
| -rw-r--r-- | include/mock-variables.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/mock-variables.h b/include/mock-variables.h index 759fd1f0..3f282a68 100644 --- a/include/mock-variables.h +++ b/include/mock-variables.h @@ -124,6 +124,21 @@ typedef enum { REPLACE, } mock_variable_op_t; +static inline const char * +format_var_op(mock_variable_op_t op) +{ + static const char *var_op_names[] = { + "NONE", + "CREATE", + "DELETE", + "APPEND", + "REPLACE", + NULL + }; + + return var_op_names[op]; +} + typedef EFI_STATUS (mock_set_variable_pre_hook_t)(CHAR16 *name, EFI_GUID *guid, UINT32 attrs, UINTN size, VOID *data); |
