[PATCH] test: boot: Add test for bootmeth_rauc
    Tom Rini 
    trini at konsulko.com
       
    Wed Oct  8 16:50:17 CEST 2025
    
    
  
On Wed, Oct 08, 2025 at 08:57:30AM +0200, Martin Schwan wrote:
> Add a simple unit test for testing the RAUC bootmethod. Provide only the
> very basic tests for now, running a scan and list, to verify correct
> detection of the RAUC bootmethod. More advanced boot tests of this
> bootmethod can be added in a separate patch.
> 
> This requires another mmc image (mmc9) to contain the following
> partitions:
> 
> 1. boot A: contains a dummy boot.scr
> 2. root A: contains an empty root filesystem
> 3. boot B: contains a dummy boot.scr
> 4. root B: contains an empty root filesystem
> 
> The bootmeth_rauc scans all four partitions for existence and expects a
> boot script in each boot partition.
> 
> Also add BOOTMETH_RAUC as a dependency on sandbox so that we can test
> this with:
> 
> $ ./test/py/test.py -B sandbox --build -k test_ut # build the mmc9.img
> $ ./test/py/test.py -B sandbox --build -k bootflow_rauc
> 
> Signed-off-by: Martin Schwan <m.schwan at phytec.de>
I'm glad to see the tests. A question:
[snip]
> +    # Generate boot script
> +    script = '# dummy boot script'
> +    bootdir = os.path.join(mnt, 'boot')
> +    utils.run_and_log(ubman, f'mkdir -p {bootdir}')
> +    cmd_fname = os.path.join(bootdir, 'boot.cmd')
> +    scr_fname = os.path.join(bootdir, 'boot.scr')
> +    with open(cmd_fname, 'w', encoding='ascii') as outf:
> +        print(script, file=outf)
> +
> +    mkimage = os.path.join(ubman.config.build_dir, 'tools/mkimage')
> +    utils.run_and_log(
> +        ubman, f'{mkimage} -C none -A arm -T script -d {cmd_fname} {scr_fname}')
> +
> +    # Create boot filesystem image with boot script in it and copy to disk image
> +    fsfile = 'rauc_boot.img'
> +    utils.run_and_log(ubman, f'fallocate -l 8M {fsfile}')
> +    utils.run_and_log(ubman, f'mkfs.vfat {fsfile}')
> +    utils.run_and_log(ubman, ['sh', '-c', f'mcopy -vs -i {fsfile} {scr_fname} ::/'])
> +    utils.run_and_log(ubman, f'dd if={fsfile} of=mmc{mmc_dev}.img bs=1M seek=1 conv=notrunc')
> +    utils.run_and_log(ubman, f'dd if={fsfile} of=mmc{mmc_dev}.img bs=1M seek=19 conv=notrunc')
> +    utils.run_and_log(ubman, f'rm -f {fsfile} {cmd_fname} {scr_fname}')
> +
> +    # Create empty root filesystem image and copy to disk image
> +    fsfile = 'rauc_root.img'
> +    utils.run_and_log(ubman, f'fallocate -l 10M {fsfile}')
> +    utils.run_and_log(ubman, f'mkfs.vfat {fsfile}')
> +    utils.run_and_log(ubman, f'dd if={fsfile} of=mmc{mmc_dev}.img bs=1M seek=9 conv=notrunc')
> +    utils.run_and_log(ubman, f'dd if={fsfile} of=mmc{mmc_dev}.img bs=1M seek=27 conv=notrunc')
> +    utils.run_and_log(ubman, f'rm -f {fsfile}')
Can we use mk_fs from test/py/tests/fs_helper.py for this part? I know
we can't use setup_image without further changes to allow for 'spec' to
be passed (which may or may not be worth doing, I'm not sure) but I
think we can use mk_fs here? Thanks.
-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20251008/616886fc/attachment.sig>
    
    
More information about the U-Boot
mailing list