Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/L2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref || github.ref }}

- name: Check out shared L2 coverage tooling
uses: actions/checkout@v4
with:
repository: 'rdkcentral/docker-device-mgt-service-test'
ref: 'develop'
path: docker-device-mgt-service-test

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -105,7 +112,9 @@ jobs:
- name: Generate L2_Coverage.md
if: (github.event_name == 'push' || github.event_name == 'pull_request') && steps.copy_tracefile.outcome == 'success'
run: |
python3 remote_debugger/test/functional-tests/generate_l2_coverage_report.py \
python3 docker-device-mgt-service-test/generate_l2_coverage_report.py \
--component "Remote Debugger" \
--report-details remote_debugger/test/functional-tests/l2_coverage_details.json \
--tracefile /tmp/coverage.info \
--src-dir remote_debugger/src \
--features-dir remote_debugger/test/functional-tests/features \
Expand Down
55 changes: 46 additions & 9 deletions docs/rrd_l2_function_coverage_HLD.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ The L2 suite terminates the daemon by signal during teardown in coverage mode. W

### 5.5 Coverage Report Generation

**Module:** `test/functional-tests/generate_l2_coverage_report.py` (as referenced by the workflow)
**Module:** `generate_l2_coverage_report.py` in the shared
`rdkcentral/docker-device-mgt-service-test` repository. The L2 workflow checks
out that repository alongside `remote_debugger` and invokes the shared script
with `--component "Remote Debugger"` and the module-owned
`test/functional-tests/l2_coverage_details.json` details file. There is no
module-local generator copy.

**Purpose:** Convert the raw coverage trace and the feature/test inventory into a human-readable summary and actionable gap analysis.

Expand All @@ -199,10 +204,32 @@ The L2 suite terminates the daemon by signal during teardown in coverage mode. W
- feature directory
- test directory
- source tree metadata
- `test/functional-tests/l2_coverage_details.json` for display metadata, source
ordering, behavior assessments, recommendations, and infrastructure notes

**Outputs:**
- Markdown report with summary metrics, tables, and scenario coverage status

For local use, check out both repositories into the same parent directory, using
`feature/l2docupdate` for `docker-device-mgt-service-test` to match the PR workflow.
Run from that parent directory after collecting the tracefile:

```bash
python3 docker-device-mgt-service-test/generate_l2_coverage_report.py \
--component "Remote Debugger" \
--report-details remote_debugger/test/functional-tests/l2_coverage_details.json \
--tracefile /tmp/coverage.info \
--src-dir remote_debugger/src \
--features-dir remote_debugger/test/functional-tests/features \
--tests-dir remote_debugger/test/functional-tests/tests \
--output remote_debugger/test/functional-tests/L2_Coverage.md
```

The shared generator uses Python's standard library. See the shared repository's
README for reuse by other modules and report limitations.
Update or remove the shared-tooling branch ref after these changes are available
on that repository's default branch.

## 6. Functional Workflow

### 6.1 Build Flow
Expand All @@ -225,10 +252,10 @@ The L2 suite terminates the daemon by signal during teardown in coverage mode. W
2. The Python report generator reads the trace file plus the feature/test directory metadata.
3. A Markdown report is produced with sections like:
- coverage overview
- direct and indirect coverage counts
- source function hit and miss counts
- mapped vs unmapped features
- orphan features and orphan tests
- gap analysis by behavior group
- scenario-to-test count gaps
4. On push-based workflow execution, the report is committed to the branch for review.

## 7. Data and Interface Model
Expand Down Expand Up @@ -256,13 +283,23 @@ The generator reads both and builds mappings to support consistent coverage narr
The generated report documents the following:

- total source-function estimate
- functions with direct L2 coverage
- functions with indirect coverage
- functions called at least once according to lcov
- functions with no L2 coverage
- active vs disabled tests
- active feature scenarios and expected gaps
- per-behavior coverage tables
- feature/test gap summary by area such as static profile handling, dynamic profile handling, upload flow, and harmful command detection
- test-definition counts and disabled-test estimates
- feature scenario counts and expected count gaps
- per-source-file line and function coverage
- unmatched features/tests and scenario-to-test count gaps
- excess tests, mapped-pair totals, source coverage bars, and full file inventories
- module-supplied behavior tables, priority recommendations, and infrastructure notes

The report retains all eight sections of the original `L2_Coverage.md`.
Static per-behavior coverage claims, RRD-specific infrastructure notes, and
hand-written priority recommendations are supplied by
`test/functional-tests/l2_coverage_details.json`, not inferred by the shared
script. The initial details preserve the existing report's assessments; module
owners must review them when behavior or tests change. Measured totals, mapping
tables, gaps, and inventories are recomputed on every run. Counts alone do not
prove behavior coverage.

## 8. Error Handling and Boundary Conditions

Expand Down
51 changes: 34 additions & 17 deletions test/functional-tests/L2_Coverage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Remote Debugger L2 Coverage Report

**Generated:** 2026-10-28
**Generated:** 2026-11-04
**Component:** `remotedebugger` (`src/`)
**Test suite:** `test/functional-tests/`
**Coverage tool:** lcov (source-level instrumentation via `--coverage`)
Expand All @@ -9,18 +9,6 @@

## 1. Executive Summary

**L2 Test Summary**

| Metric | Value |
|---|:---:|
| Feature files | 22 |
| Feature scenarios | 103 |
| Pytest files | 23 |
| Test functions (`test_*`) | 118 |
| Mapped feature/test pairs | 19 / 22 |
| Unmatched test files | 4 |
| Line coverage (lcov) | 49.7% (1508 of 3034 lines) |

**L2 Test Coverage**

| Metric | Value |
Expand All @@ -34,6 +22,24 @@
> Function coverage = functions called at least once during the L2 run (lcov `FNDA` > 0),
> divided by all function definitions in `src/*.c`, including those compiled out by `#if`.

**L2 Test Summary**

| Metric | Value |
|---|:---:|
| Feature files | 22 |
| Feature scenarios | 103 |
| Pytest files | 23 |
| Test functions (`test_*`) | 118 |
| Mapped feature/test pairs | 19 / 22 |
| Unmatched test files | 4 |
| Line coverage (lcov) | 49.7% (1508 of 3034 lines) |

> Function definitions are discovered with a heuristic C source scan.
> Disabled test functions (skip markers or commented definitions): 0;
> files with no enabled test functions: 0.
> Test counts include skipped definitions and are not pass/fail results. Skip counts are
> estimates; conditional, class-level and module-level skips are not evaluated.

---

## 2. Feature ↔ Test Mapping
Expand Down Expand Up @@ -63,9 +69,13 @@
| 19 | `test_rrd_static_profile_report_with_suffix_negative_case.feature` | 4 | `test_rrd_static_profile_report_with_suffix_negative_case.py` | 5 | PASS |
| | **Totals** | **90** | | **95** | |

> PASS means the test-definition count meets the scenario count, not that tests passed.
> Matching uses the same relative directory and feature stem, with an optional
> test_ prefix. Scenario Outline rows and parametrized cases are not expanded.

### 2.2 Tests Exceeding Scenario Count

> Extra functions handle setup/teardown split more granularly than feature scenarios.
> Extra functions can include setup/teardown split more granularly than feature scenarios.

| Feature File | Scenarios | Test File | Tests | Extra |
|---|:---:|---|:---:|:---:|
Expand Down Expand Up @@ -119,10 +129,15 @@
| `rrdIarmEvents.c` | 8.6% (12/140) | 20.0% (1/5) | `██░░░░░░░░░░░░░░░░░░` |
| `uploadRRDLogs.c` | 54.7% (35/64) | 100.0% (1/1) | `███████████░░░░░░░░░` |

> Only trace records matched to source files in this module contribute to line coverage.
> Ambiguous source paths are excluded; keep source-relative paths in the tracefile.

---

## 4. Per-Behavior Coverage Detail

> Module-supplied assessment; not inferred from lcov or test counts.

> Legend — **YES**: tested by an L2 scenario | **NO**: no test exists | **PARTIAL**: subset covered

### 4.1 Daemon Lifecycle
Expand Down Expand Up @@ -208,7 +223,6 @@
| Profile category load error | NO |
| Profile file write error | NO |


---

## 5. Scenario-to-Test Gap Analysis
Expand All @@ -218,17 +232,21 @@
| `rrd_c_api_upload.feature` | 21 | 5 | **16** |
| `rrd_start_control.feature` | 2 | 1 | **1** |

**Orphan tests** (no feature file — behavior is tested but not documented):
**Orphan tests** (no feature file):

- `test_rrd_append_dynamic_profile_static_notfound.py`
- `test_rrd_dynamic_profile_rdm_node_length_exceeded.py`
- `test_rrd_dynamic_subcategory_report.py`
- `test_rrd_profile_data.py`

> Unmatched features are listed in section 2.4; counts alone do not prove behavior coverage.

---

## 6. Gap Recommendations

> Module-supplied recommendations; review when the implementation or tests change.

### Priority 1 — Must Fix

| # | Gap | Impacted Modules |
Expand Down Expand Up @@ -259,7 +277,6 @@
| 14 | Output file write errors | `rrdRunCmdThread.c` |
| 15 | Invalid deep sleep event type | `rrdDynamic.c` |


---

## 7. Test Infrastructure Notes
Expand Down
Loading
Loading