summaryrefslogtreecommitdiffstats
path: root/test/lib
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-08-02 17:29:37 +0000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-08-07 11:30:36 +1000
commitc44d4f11162d90c244b16375c3ff9a8a4a02bff6 (patch)
treed748945fb24005b9992b69651180529d65d913e7 /test/lib
parentc3dfc9b7b91045172d460651c0309b09b0ab121a (diff)
downloadtalos-petitboot-c44d4f11162d90c244b16375c3ff9a8a4a02bff6.tar.gz
talos-petitboot-c44d4f11162d90c244b16375c3ff9a8a4a02bff6.zip
test-efivar: Update to latest lib/efi routines
From: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/Makefile.am3
-rw-r--r--test/lib/test-efivar.c25
2 files changed, 17 insertions, 11 deletions
diff --git a/test/lib/Makefile.am b/test/lib/Makefile.am
index 047fcb2..65991a5 100644
--- a/test/lib/Makefile.am
+++ b/test/lib/Makefile.am
@@ -23,7 +23,8 @@ lib_TESTS = \
test/lib/test-process-parent-stdout \
test/lib/test-process-both \
test/lib/test-process-stdout-eintr \
- test/lib/test-fold
+ test/lib/test-fold \
+ test/lib/test-efivar
if WITH_OPENSSL
lib_TESTS += \
diff --git a/test/lib/test-efivar.c b/test/lib/test-efivar.c
index 8ceb8f5..a85b73c 100644
--- a/test/lib/test-efivar.c
+++ b/test/lib/test-efivar.c
@@ -87,33 +87,38 @@ int main(void)
{
void *ctx = NULL;
int rc, errno_value;
- size_t size;
- uint8_t *data = NULL;
uint32_t attr = DEF_ATTR;
char *path = NULL;
+ struct efi_data *efi_data;
if(!probe())
return ENOENT;
talloc_new(ctx);
- size = strlen(test_data) + 1;
- rc = efi_set_variable(ctx, test_efivar_guid, test_varname,
- (uint8_t *)test_data, size, attr);
+ efi_data = talloc_zero(ctx, struct efi_data);
+ efi_data->attributes = attr;
+ efi_data->data = talloc_strdup(efi_data, test_data);
+ efi_data->data_size = strlen(test_data) + 1;
+
+ rc = efi_set_variable(test_efivar_guid, test_varname,
+ efi_data);
+
+ talloc_free(efi_data);
rc = efi_get_variable(ctx, test_efivar_guid, test_varname,
- &data, &size, &attr);
+ &efi_data);
- assert(data != NULL);
- rc = strcmp((char *)data, test_data);
+ assert(efi_data->data != NULL);
+ rc = strcmp((char *)efi_data->data, test_data);
if (rc) {
talloc_free(ctx);
assert(0);
}
- rc = efi_del_variable(ctx, test_efivar_guid, test_varname);
+ rc = efi_del_variable(test_efivar_guid, test_varname);
rc = efi_get_variable(ctx, test_efivar_guid, test_varname,
- &data, &size, &attr);
+ &efi_data);
errno_value = errno;
talloc_free(ctx);
OpenPOWER on IntegriCloud