From 3ffaf5a6589af534dd878b0b24885e2e7bb4b162 Mon Sep 17 00:00:00 2001 From: William Douglas Date: Thu, 3 May 2018 20:41:21 +0000 Subject: [PATCH] Add test for freestanding initrds in image mode Verify that freestanding initrds are installed correctly in image mode. --- tests/check-uefi.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/check-uefi.c b/tests/check-uefi.c index fd9febc..9732da4 100644 --- a/tests/check-uefi.c +++ b/tests/check-uefi.c @@ -412,6 +412,32 @@ START_TEST(bootman_uefi_initrd_freestandings) } END_TEST +START_TEST(bootman_uefi_initrd_freestandings_image) +{ + autofree(BootManager) *m = NULL; + autofree(char) *path_initrd = NULL; + char *initrd_name = "00-initrd"; + + m = prepare_playground(&uefi_config); + fail_if(!m, "Failed to prepare update playground"); + + path_initrd = string_printf("%s%s/%s", + PLAYGROUND_ROOT, + INITRD_DIRECTORY, + initrd_name); + + file_set_text(path_initrd, "Placeholder initrd"); + /* Validate image install */ + boot_manager_set_image_mode(m, true); + fail_if(!boot_manager_enumerate_initrds_freestanding(m), "Failed to find freestanding initrd"); + + fail_if(!check_freestanding_initrds_available(m, initrd_name), "Failed reading from initrd path"); + fail_if(!boot_manager_update(m), "Failed to update image"); + fail_if(!check_initrd_file_exist(m, initrd_name), "Failed copying initrd file"); +} +END_TEST + + /** * Ensure all blobs are removed for garbage collected kernels */ @@ -463,6 +489,7 @@ static Suite *core_suite(void) tcase_add_test(tc, bootman_uefi_namespace_migration); tcase_add_test(tc, bootman_uefi_ensure_removed); tcase_add_test(tc, bootman_uefi_initrd_freestandings); + tcase_add_test(tc, bootman_uefi_initrd_freestandings_image); suite_add_tcase(s, tc); /* Tests without kernel modules */