tests: Add basic image test for syslinux

This test adds very basic coverage for doing a basic image installation,
using the syslinux legacy path.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
Ikey Doherty
2017-02-10 13:07:42 +00:00
committed by William Douglas
parent a204ecaff1
commit 920aee7125
3 changed files with 32 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@ EXTRA_DIST = ${top_srcdir}/README.md \
${top_srcdir}/tests/data/etc/kernel/cmdline.d/10_first.conf \
${top_srcdir}/tests/data/etc/kernel/cmdline.d/20_second.conf \
${top_srcdir}/tests/data/etc/kernel/cmdline.d/30_third.conf \
${top_srcdir}/tests/data/gptmbr.bin \
${top_srcdir}/sgcheck.suppressions \
${top_srcdir}/data/clr-boot-manager-booted.service \
${top_srcdir}/man/clr-boot-manager.1
+30
View File
@@ -29,6 +29,20 @@
#include "harness.h"
#include "system-harness.h"
#define PLAYGROUND_ROOT TOP_BUILD_DIR "/tests/update_playground"
/**
* Make a fake gptmbr.bin (440 bytes) available within the rootfs
*/
static void push_syslinux(void)
{
const char *mbr_src = TOP_DIR "/tests/data/gptmbr.bin";
const char *mbr_dst = PLAYGROUND_ROOT "/usr/share/syslinux/gptmbr.bin";
const char *mbr_dir = PLAYGROUND_ROOT "/usr/share/syslinux";
fail_if(!nc_mkdir_p(mbr_dir, 00755), "Failed to create source syslinux tree");
fail_if(!copy_file_atomic(mbr_src, mbr_dst, 00644), "Failed to copy gptmbr.bin");
}
/**
* Coerce legacy lookup
*/
@@ -90,6 +104,21 @@ START_TEST(bootman_legacy_get_boot_device)
}
END_TEST
START_TEST(bootman_legacy_image)
{
autofree(BootManager) *m = NULL;
m = prepare_playground(&legacy_config);
fail_if(!m, "Failed to prepare update playground");
/* Push bootloader */
push_syslinux();
/* Validate image install */
boot_manager_set_image_mode(m, true);
fail_if(!boot_manager_update(m), "Failed to update image");
}
END_TEST
static Suite *core_suite(void)
{
Suite *s = NULL;
@@ -98,6 +127,7 @@ static Suite *core_suite(void)
s = suite_create("bootman_legacy");
tc = tcase_create("bootman_legacy_functions");
tcase_add_test(tc, bootman_legacy_get_boot_device);
tcase_add_test(tc, bootman_legacy_image);
suite_add_tcase(s, tc);
return s;
+1
View File
@@ -0,0 +1 @@
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa