Skip to content

feat(test): parse XML context files and generate tree diagrams - #719

Open
tfcollins wants to merge 3 commits into
mainfrom
tfcollins/parse-and-create-tree-diagrams-of-each-x-204042
Open

feat(test): parse XML context files and generate tree diagrams#719
tfcollins wants to merge 3 commits into
mainfrom
tfcollins/parse-and-create-tree-diagrams-of-each-x-204042

Conversation

@tfcollins

Copy link
Copy Markdown
Collaborator

Summary

Added support for parsing each XML context file under the test scope and producing a corresponding tree diagram representation. This improves visibility into XML structure and makes context validation easier during development and debugging.

Changes

  • Implemented XML parsing flow for all context files located under test directories.
  • Added tree diagram generation for each parsed XML context file.
  • Standardized output structure so diagrams are consistent and easier to compare across files.
  • Integrated the workflow into the existing test-oriented process so diagram generation can be run as part of validation.

Impact

  • Improves readability of complex XML contexts by surfacing hierarchy in a concise visual format.
  • Reduces manual effort when inspecting or troubleshooting context file structure.
  • Helps catch structural inconsistencies earlier in test and review cycles.

Notes for Reviewers

  • Focus on parser behavior across different XML context file shapes (nested nodes, attributes, mixed depth).
  • Verify tree output is deterministic and stable for repeated runs.
  • Confirm generated diagrams align with expected XML hierarchy for representative test fixtures.

Closes https://github.com/tfcollins/tbot/issues/26

@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown

Test Results

1 742 tests  +2     484 ✅ +2   12m 19s ⏱️ +6s
    1 suites ±0   1 258 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit eb34adc. ± Comparison against base commit cfff950.

This pull request removes 4 and adds 6 tests. Note that renamed tests count towards both.
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[np.float64(13.0), np.float64(26.5), np.float64(20.5), np.float64(10.0), np.float64(26.5), np.float64(11.5), np.float64(14.0), np.float64(13.0), np.float64(14.0), np.float64(29.0)]-depends={'gain_control_mode_chan1': 'spi', 'rx_ensm_mode_chan1': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[np.float64(15.0), np.float64(24.5), np.float64(16.5), np.float64(22.5), np.float64(5.0), np.float64(1.0), np.float64(24.0), np.float64(13.5), np.float64(2.5), np.float64(34.0)]-depends={'gain_control_mode_chan0': 'spi', 'rx_ensm_mode_chan0': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan0-val=[np.float64(-11.45), np.float64(-2.95), np.float64(-28.2), np.float64(-36.8), np.float64(-5.4), np.float64(-17.65), np.float64(-29.35), np.float64(-0.95), np.float64(-7.8), np.float64(-0.95)]-depends={'atten_control_mode_chan0': 'spi'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan1-val=[np.float64(-13.95), np.float64(-18.95), np.float64(-20.7), np.float64(-14.95), np.float64(-38.7), np.float64(-21.2), np.float64(-29.6), np.float64(-19.2), np.float64(-6.2), np.float64(-14.15)]-depends={'atten_control_mode_chan1': 'spi'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[np.float64(10.5), np.float64(19.0), np.float64(13.0), np.float64(23.0), np.float64(12.5), np.float64(13.0), np.float64(13.5), np.float64(15.5), np.float64(29.0), np.float64(28.0)]-depends={'gain_control_mode_chan0': 'spi', 'rx_ensm_mode_chan0': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=rx_hardwaregain_chan0-val=[np.float64(11.5), np.float64(15.5), np.float64(27.0), np.float64(33.0), np.float64(14.5), np.float64(21.5), np.float64(0.0), np.float64(32.5), np.float64(9.0), np.float64(15.0)]-depends={'gain_control_mode_chan1': 'spi', 'rx_ensm_mode_chan1': 'rf_enabled'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan0-val=[np.float64(-39.75), np.float64(-5.4), np.float64(-32.0), np.float64(-25.35), np.float64(-4.8), np.float64(-36.4), np.float64(-3.7), np.float64(-2.05), np.float64(-17.0), np.float64(-7.95)]-depends={'atten_control_mode_chan0': 'spi'}-classname=adi.adrv9002]
test.test_adrv9002_p ‑ test_adrv9002_hardware_gain[attr=tx_hardwaregain_chan1-val=[np.float64(-24.0), np.float64(-21.2), np.float64(-30.35), np.float64(-14.25), np.float64(-14.95), np.float64(-17.35), np.float64(-34.9), np.float64(-20.45), np.float64(-0.85), np.float64(-37.55)]-depends={'atten_control_mode_chan1': 'spi'}-classname=adi.adrv9002]
test.test_emu_xml_docgen ‑ test_generation_is_deterministic_and_cleans_stale_files
test.test_emu_xml_docgen ‑ test_tree_from_real_xml_contains_expected_structure

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown

Generated documentation for this PR is available at Link

@gastmaier gastmaier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but why not have a small directive that calls doc/gen_emu_xml_trees.py ?
Like this (or simpler, just invoke the generation directly if cache is not cared):
https://github.com/analogdevicesinc/doctools/blob/main/adi_doctools/directive/hdl.py#L405-L446

instead of committing all svgs

Another option is having, instead of xml -> svg, have xml -> mermaid, and let the very well tested flowchart library handle the details

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.

2 participants