Skip to content

Covered partition offset branches and raised the coverage floor - #127

Open
Dev10-sys wants to merge 1 commit into
eclipse-threadx:masterfrom
Dev10-sys:fix/partition-offset-branch-coverage
Open

Dev10-sys wants to merge 1 commit into
eclipse-threadx:masterfrom
Dev10-sys:fix/partition-offset-branch-coverage

Conversation

@Dev10-sys

Copy link
Copy Markdown

In fx_partition_offset_calculate.c, 21 of the 30 uncovered branches in the merged FileX coverage report remained unexercised. Most of these gaps were concentrated on the sectors-per-FAT condition at line 378, where only a single outcome was previously tested. Other missing paths included boot sector variations like 0xE9 and 0xEB with invalid secondary bytes, zero total sector counts falling through to partition parsing, NULL pointer handling for start and size parameters, secondary signature validation bytes, and extended LBA partitions using type 0x0F.

To address this, we added targeted test cases to filex_partition_offset_extended_test.c that exercise every one of these missing branches. The new test logic systematically tests each of the six sectors-per-FAT bytes individually as well as the all-zero condition, verifies both boot sector signatures, checks zero sector fallthrough, exercises NULL pointer combinations for both primary and extended partitions, validates secondary signature bytes, and drives extended partition discovery and chaining with type 0x0F.

Running the suite against the default coverage configuration passes all 138 regression tests cleanly. Branch coverage for fx_partition_offset_calculate.c increased from 81.3% to 99.1%, raising the total branch rate in the default coverage build from 99.48% (4233/4255) to 99.98% (4254/4255 branches). With these branches now covered, this change raises the repository branch coverage floor in test/cmake/coverage.sh from 99.3% to 99.6%.

Fixes #112

fx_partition_offset_calculate.c held 21 of the 30 uncovered branches in the
merged coverage report, including 11 uncovered outcomes of the sectors-per-FAT
condition, boot record signature variations (0xE9 vs 0xEB), total sector count
fallthrough when sectors are zero, NULL parameter handling for partition start
and size, secondary signature validation (0x55 with non-0xAA), and extended LBA
partition table handling (type 0x0F).

Added targeted test cases to filex_partition_offset_extended_test.c covering each
branch condition:
- 0xE9 direct boot sector branch and 0xEB with invalid secondary signature byte.
- All six sectors-per-FAT fields (0x16, 0x17, 0x24, 0x25, 0x26, 0x27) tested
  individually and when all six are zero.
- Zero total sector fallthrough to partition table parsing.
- NULL partition_start and partition_size parameter handling in boot sector and
  extended partition paths.
- Partition signature validation with byte 510 == 0x55 and byte 511 != 0xAA for
  both primary and extended tables.
- Extended partition discovery and chaining with type 0x0F (FX_PARTITION_TYPE_EXTENDED_LBA).

Branch coverage for fx_partition_offset_calculate.c rises from 81.3% to 99.1%
(4254 / 4255 branches covered in default_build_coverage). All 138 regression
tests pass. Raised the branch coverage floor in test/cmake/coverage.sh from
99.3% to 99.6%.

Fixes: eclipse-threadx#112
Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover the partition offset branches and raise the coverage floor

1 participant