Files
erofs-freebsd-out-tree/tests/TC088-lz4-config-handling.md
T
2026-08-18 09:20:44 +02:00

2.8 KiB

Test Case: LZ4 Compression Configuration Handling

Test ID: TC088-lz4-config-handling

G5 fixture contract: Use G5-MANUAL-SETUP.md. Its generated paths, source comparisons, structured corruption offsets, and cleanup rules supersede placeholder examples in this file. Category: Compression
Priority: Medium
Regression: None

Objective

Verify correct handling of different LZ4 compression configurations.

Preconditions

  • Multiple EROFS images with different LZ4 configs:
    • lz4-pcluster-4k.erofs (4KB pcluster)
    • lz4-pcluster-64k.erofs (64KB pcluster)
    • lz4-pcluster-256k.erofs (256KB pcluster)
  • Test file in each: /files/test.dat (identical content)
  • Mount points: /mnt/test1, /mnt/test2, /mnt/test3
  • Generate the images explicitly with mkfs.erofs 1.8.6:
    mkfs.erofs -zlz4 -C4096 lz4-pcluster-4k.erofs source
    mkfs.erofs -zlz4 -C65536 lz4-pcluster-64k.erofs source
    mkfs.erofs -zlz4 -C262144 lz4-pcluster-256k.erofs source
    
  • Confirm the requested feature/configuration with dump.erofs -s before treating an image as a valid fixture.

Test Steps

  1. Mount all three images:

    mount -t erofs /dev/md0 /mnt/test1
    mount -t erofs /dev/md1 /mnt/test2
    mount -t erofs /dev/md2 /mnt/test3
    
  2. Read from each and verify identical output:

    sha256 /mnt/test1/files/test.dat
    sha256 /mnt/test2/files/test.dat
    sha256 /mnt/test3/files/test.dat
    
  3. Record image sizes without assuming a monotonic compression ratio:

    stat -f %z /root/lz4-pcluster-4k.erofs
    stat -f %z /root/lz4-pcluster-64k.erofs
    stat -f %z /root/lz4-pcluster-256k.erofs
    
  4. Verify the same offset read with each pcluster size. Timing is diagnostic only and is not a functional pass criterion:

    time dd if=/mnt/test1/files/test.dat of=/dev/null bs=4K skip=100 count=10
    time dd if=/mnt/test2/files/test.dat of=/dev/null bs=4K skip=100 count=10
    time dd if=/mnt/test3/files/test.dat of=/dev/null bs=4K skip=100 count=10
    

Expected Results

  • Step 1: All mounts succeed
  • Step 2: All three checksums identical (data integrity)
  • Step 3: Image sizes are recorded for the exact corpus and mkfs version
  • Step 4: All reads succeed and return identical data at the tested offset

Verification Method

  • Verify all pcluster configurations work correctly
  • Record pcluster size effects without assuming they are monotonic for every corpus or under a QEMU TCG guest
  • Test driver handles different configs transparently

Cleanup

umount /mnt/test1 /mnt/test2 /mnt/test3
mdconfig -d -u "${unit1#md}"
mdconfig -d -u "${unit2#md}"
mdconfig -d -u "${unit3#md}"

Notes

  • Pcluster size is compression unit (physical cluster)
  • Larger pcluster -> better compression, worse random access
  • Typical sizes: 4KB, 16KB, 64KB, 256KB
  • Related tests: TC089 (pcluster mapping)