On 2026-10-10T13:11:37, Alexey Charkov <[email protected]> wrote: > test: lib: Check the GPT round trip against a real block device > > lib_test_gpt_blksz() drives gpt_fill_header() and gpt_fill_pte() with a > synthetic struct blk_desc. That is what lets it sweep block sizes no real > device here can provide, but it also means it cannot reach anything that > touches the medium, so the protective MBR, the header CRCs and every > conversion behind them go unchecked. > > Add a companion test that backs a blkmap device with plain memory, writes > a table with gpt_restore(), reads it back with gpt_verify_partitions() > and parses it with part_get_info(), then checks that the backup header > really did land in the last block. That covers set_protective_mbr(), > is_pmbr_valid(), gpt_verify_headers(), is_gpt_valid() and > part_get_info_efi(). > > The two tests are complementary rather than alternatives: gpt_blksz > covers the block size arithmetic across sizes a device cannot easily > offer, gpt_blkmap covers the read and write paths a synthetic descriptor > cannot reach. Neither replaces the sandbox tests in > test/py/tests/test_gpt.py, which exercise the gpt command against images > built by sgdisk. > > A blkmap needs no host filesystem, so unlike 'host bind' this runs on > QEMU and on real hardware, which is what makes big-endian coverage > possible. Every blkmap is DEFAULT_BLKSZ today, so the block size stays a > parameter of the case table with a single entry, ready for a second one > should blkmap ever learn to be created with a block size. > > Signed-off-by: Alexey Charkov <[email protected]> > > test/lib/part_efi.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 170 insertions(+)
Reviewed-by: Simon Glass <[email protected]>
