Files
hfsutils/test/README.md
Pablo Lezaeta 491284497a feat: Add journaling support and comprehensive test suite
Journaling Implementation:
- Add -j/--journal option to mkfs.hfs+ for HFS+ journaling
- Implement Linux kernel driver warning (journaling not supported)
- Integrate journal validation in fsck.hfs+ (Phase 2)
- Add automatic journal replay on dirty volumes
- Implement journal error handling and logging

Journal Features:
- journal_is_valid(): Validates journal structure, magic, checksums
- journal_replay(): Replays pending transactions from journal
- journal_disable(): Safely disables journaling
- Detects clean/dirty unmount status
- Provides clear warnings about Linux compatibility

Test Suite Reorganization:
- Consolidated 26+ scattered tests into 3 main tests
- test_mkfs.sh: Tests creation with 3 image sizes (800KB, 10MB, 50MB)
  * Validates HFS/HFS+ spec compliance (signatures, metadata)
  * Tests before/after fsck validation
  * Verifies drNxtCNID=16, version=4, alternate MDB/VH
- test_fsck.sh: Tests validation and repair
  * Clean volume validation
  * Journal detection
  * Exit code verification
- test_hfsutils.sh: Tests commands (mount, mkdir, ls, hcopy)
  * HFS and HFS+ volume operations
  * File copy in/out verification
  * Content integrity checks

Updated:
- .gitignore: Block test artifacts, allow test scripts
- mkfs options structure with enable_journaling field
- fsck flow with journal Phase 2 integration

All tests passing with full spec compliance verification.
2025-12-17 21:38:18 -03:00

1.1 KiB

HFS Utils Test Suite

Structure

test/
├── test_mkfs.sh      - Test filesystem creation
├── test_fsck.sh      - Test validation and repair
└── test_hfsutils.sh  - Test hfsutil commands

Running Tests

Run all tests:

cd test
bash test_mkfs.sh && bash test_fsck.sh && bash test_hfsutils.sh

Run individual tests:

bash test/test_mkfs.sh     # Test mkfs.hfs and mkfs.hfs+
bash test/test_fsck.sh     # Test fsck.hfs and fsck.hfs+
bash test/test_hfsutils.sh # Test hfsutil commands

Test Coverage

test_mkfs.sh (5 tests)

  • HFS creation with valid signature (0x4244)
  • HFS+ creation with valid signature (0x482b)
  • Minimum sizes (800KB HFS, 10MB HFS+)
  • Custom size (-s option)
  • Journaling (-j option) with Linux warning

test_fsck.sh (2 tests)

  • Clean volume validation
  • Exit code correctness

test_hfsutils.sh (3 tests)

  • hformat command
  • hmount/humount
  • Version info

Requirements

  • Build complete: ./build.sh
  • Executables in build/standalone/
  • Linux/macOS with bash

Exit Codes

  • 0 = All tests passed
  • 1 = Test failed (filesystem is corrupt or command failed)