Skip to content

Enable GhostFat auto-validation #93

@henrygab

Description

@henrygab
GhostFAT requires unit tests

GhostFAT is quite complex (file systems are inherently complex), and is critical functionality relied upon for updating devices. As seen with the RPi Pico, sometimes it even gets burned into ROM.

The need to validate GhostFAT is thus critical. However, today this is an extremely manual process.

For example, validation that it generates a correct file system:

  • Build bootloader with all substantial variations (base, >1 sector per cluster, various sized flash files, etc.)
  • Loading those bootloaders onto real devices
  • Plus those devices into machines
  • Dump the exposed USB flash drive to a disk image
  • Manually validating the file system image is correct

Similar steps are needed to validate that GhostFAT will extract the relevant portions of a .UF2 file, and send them to the board at the correct offset.

In short, it's a huge manual test effort, and confidence drops as additional features / combinations are supported.

The automated validation should compile as board variants, to keep the build environment identical where possible.

Here's a straw man of features and test cases that should be part of automated CI checks:

Features:

  • Verify generated file system is bit-for-bit match of known-good version (catch regressions)
    • Requires reproducible FS generation (explicit date/time stamp)
    • Requires compiling code native to build environment
    • Requires availability of known-good versions of file system
    • CI build to include new ports
    • CI build copies known-good file system to bin directory
    • CI build runs the native built test code after compilation

Test Cases:

  • Basic Image (512-byte sector, 1 sector per cluster, FAT16, Flash size of 4MB @ offset zero)
  • Various sectors per cluster (at least 8 and 64 sectors per cluster for 4k and 32k clusters)
  • Various flash sizes and starting offsets (at least all those currently in use)
  • Flash sizes that are not multiples of cluster size (only affects cases with >1 sector per cluster)
  • Edge cases for compilation date / time stamps ? (e.g., Feb 29th)

For Hathach to add via Ceedling/CMock/Unity

  • Verify written UF2 block result in writes to correct flash offsets, with expected data
  • Verify written UF2 blocks for non-matching BOARD_UF2_FAMILY_ID are NOT written to flash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions